New upstream version 8.1.0
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#include "GetXAttrMsg.h"
|
||||
|
||||
const struct NetMessageOps GetXAttrMsg_Ops = {
|
||||
.serializePayload = GetXAttrMsg_serializePayload,
|
||||
.deserializePayload = _NetMessage_deserializeDummy,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
|
||||
};
|
||||
|
||||
void GetXAttrMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
|
||||
{
|
||||
GetXAttrMsg* thisCast = (GetXAttrMsg*)this;
|
||||
|
||||
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
|
||||
Serialization_serializeStr(ctx, strlen(thisCast->name), thisCast->name);
|
||||
Serialization_serializeInt(ctx, thisCast->size);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef GETXATTRMSG_H_
|
||||
#define GETXATTRMSG_H_
|
||||
|
||||
#include <common/net/message/NetMessage.h>
|
||||
#include <common/storage/EntryInfo.h>
|
||||
|
||||
struct GetXAttrMsg;
|
||||
typedef struct GetXAttrMsg GetXAttrMsg;
|
||||
|
||||
static inline void GetXAttrMsg_init(GetXAttrMsg* this);
|
||||
static inline void GetXAttrMsg_initFromEntryInfoNameAndSize(GetXAttrMsg* this,
|
||||
const EntryInfo* entryInfo, const char* name, ssize_t size);
|
||||
|
||||
// virtual functions
|
||||
extern void GetXAttrMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
|
||||
|
||||
|
||||
struct GetXAttrMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
const EntryInfo* entryInfoPtr;
|
||||
|
||||
const char* name;
|
||||
int size;
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps GetXAttrMsg_Ops;
|
||||
|
||||
void GetXAttrMsg_init(GetXAttrMsg* this)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_GetXAttr, &GetXAttrMsg_Ops);
|
||||
}
|
||||
|
||||
void GetXAttrMsg_initFromEntryInfoNameAndSize(GetXAttrMsg* this, const EntryInfo* entryInfo,
|
||||
const char* name, ssize_t size)
|
||||
{
|
||||
GetXAttrMsg_init(this);
|
||||
this->entryInfoPtr = entryInfo;
|
||||
this->name = name;
|
||||
this->size = size;
|
||||
}
|
||||
|
||||
#endif /*GETXATTRMSG_H_*/
|
||||
@@ -0,0 +1,32 @@
|
||||
#include <common/toolkit/Serialization.h>
|
||||
|
||||
#include "GetXAttrRespMsg.h"
|
||||
|
||||
const struct NetMessageOps GetXAttrRespMsg_Ops = {
|
||||
.serializePayload = _NetMessage_serializeDummy,
|
||||
.deserializePayload = GetXAttrRespMsg_deserializePayload,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
|
||||
};
|
||||
|
||||
bool GetXAttrRespMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx)
|
||||
{
|
||||
GetXAttrRespMsg* thisCast = (GetXAttrRespMsg*)this;
|
||||
|
||||
const char** valueBufPtr = (const char**)&thisCast->valueBuf;
|
||||
|
||||
{
|
||||
unsigned valueFieldLen;
|
||||
if (!Serialization_deserializeCharArray(ctx, &thisCast->valueBufLen,
|
||||
valueBufPtr, &valueFieldLen) )
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Serialization_deserializeInt(ctx, &thisCast->size) )
|
||||
return false;
|
||||
|
||||
if (!Serialization_deserializeInt(ctx, &thisCast->returnCode) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#ifndef GETXATTRRESPMSG_H_
|
||||
#define GETXATTRRESPMSG_H_
|
||||
|
||||
#include <common/net/message/NetMessage.h>
|
||||
|
||||
struct GetXAttrRespMsg;
|
||||
typedef struct GetXAttrRespMsg GetXAttrRespMsg;
|
||||
|
||||
static inline void GetXAttrRespMsg_init(GetXAttrRespMsg* this);
|
||||
|
||||
// virtual functions
|
||||
extern bool GetXAttrRespMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx);
|
||||
|
||||
// getters and setters
|
||||
static inline char* GetXAttrRespMsg_getValueBuf(GetXAttrRespMsg* this);
|
||||
static inline int GetXAttrRespMsg_getReturnCode(GetXAttrRespMsg* this);
|
||||
static inline int GetXAttrRespMsg_getSize(GetXAttrRespMsg* this);
|
||||
|
||||
struct GetXAttrRespMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
unsigned valueBufLen; // only used for deserialization
|
||||
char* valueBuf;
|
||||
int size;
|
||||
int returnCode;
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps GetXAttrRespMsg_Ops;
|
||||
|
||||
void GetXAttrRespMsg_init(GetXAttrRespMsg* this)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_GetXAttrResp, &GetXAttrRespMsg_Ops);
|
||||
}
|
||||
|
||||
char* GetXAttrRespMsg_getValueBuf(GetXAttrRespMsg* this)
|
||||
{
|
||||
return this->valueBuf;
|
||||
}
|
||||
|
||||
int GetXAttrRespMsg_getReturnCode(GetXAttrRespMsg* this)
|
||||
{
|
||||
return this->returnCode;
|
||||
}
|
||||
|
||||
int GetXAttrRespMsg_getSize(GetXAttrRespMsg* this)
|
||||
{
|
||||
return this->size;
|
||||
}
|
||||
|
||||
#endif /*GETXATTRRESPMSG_H_*/
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "ListXAttrMsg.h"
|
||||
|
||||
const struct NetMessageOps ListXAttrMsg_Ops = {
|
||||
.serializePayload = ListXAttrMsg_serializePayload,
|
||||
.deserializePayload = _NetMessage_deserializeDummy,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
|
||||
};
|
||||
|
||||
void ListXAttrMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
|
||||
{
|
||||
ListXAttrMsg* thisCast = (ListXAttrMsg*)this;
|
||||
|
||||
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
|
||||
Serialization_serializeInt(ctx, thisCast->size);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef LISTXATTRMSG_H_
|
||||
#define LISTXATTRMSG_H_
|
||||
|
||||
#include <common/net/message/NetMessage.h>
|
||||
#include <common/storage/EntryInfo.h>
|
||||
|
||||
struct ListXAttrMsg;
|
||||
typedef struct ListXAttrMsg ListXAttrMsg;
|
||||
|
||||
static inline void ListXAttrMsg_init(ListXAttrMsg* this);
|
||||
static inline void ListXAttrMsg_initFromEntryInfoAndSize(ListXAttrMsg* this,
|
||||
const EntryInfo* entryInfo, ssize_t size);
|
||||
|
||||
// virtual functions
|
||||
extern void ListXAttrMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
|
||||
|
||||
|
||||
struct ListXAttrMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
const EntryInfo* entryInfoPtr; // not owned by this object
|
||||
int size; // buffer size for the list buffer of the listxattr call
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps ListXAttrMsg_Ops;
|
||||
|
||||
void ListXAttrMsg_init(ListXAttrMsg* this)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_ListXAttr, &ListXAttrMsg_Ops);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entryID just a reference, so do not free it as long as you use this object!
|
||||
*/
|
||||
void ListXAttrMsg_initFromEntryInfoAndSize(ListXAttrMsg* this, const EntryInfo* entryInfo,
|
||||
ssize_t size)
|
||||
{
|
||||
ListXAttrMsg_init(this);
|
||||
this->entryInfoPtr = entryInfo;
|
||||
this->size = size;
|
||||
}
|
||||
|
||||
#endif /*LISTXATTRMSG_H_*/
|
||||
@@ -0,0 +1,35 @@
|
||||
#include <common/toolkit/Serialization.h>
|
||||
|
||||
#include "ListXAttrRespMsg.h"
|
||||
|
||||
const struct NetMessageOps ListXAttrRespMsg_Ops = {
|
||||
.serializePayload = _NetMessage_serializeDummy,
|
||||
.deserializePayload = ListXAttrRespMsg_deserializePayload,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
|
||||
};
|
||||
|
||||
bool ListXAttrRespMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx)
|
||||
{
|
||||
ListXAttrRespMsg* thisCast = (ListXAttrRespMsg*)this;
|
||||
|
||||
{ // value
|
||||
RawList valueField;
|
||||
|
||||
if(!Serialization_deserializeStrCpyVecPreprocess(ctx, &valueField) )
|
||||
return false;
|
||||
|
||||
thisCast->valueElemNum = valueField.elemCount;
|
||||
thisCast->valueBuf = (char*) valueField.data;
|
||||
}
|
||||
|
||||
// size
|
||||
if (!Serialization_deserializeInt(ctx, &thisCast->size) )
|
||||
return false;
|
||||
|
||||
// returnCode
|
||||
if (!Serialization_deserializeInt(ctx, &thisCast->returnCode) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#ifndef LISTXATTRRESPMSG_H_
|
||||
#define LISTXATTRRESPMSG_H_
|
||||
|
||||
#include <common/net/message/NetMessage.h>
|
||||
|
||||
struct ListXAttrRespMsg;
|
||||
typedef struct ListXAttrRespMsg ListXAttrRespMsg;
|
||||
|
||||
static inline void ListXAttrRespMsg_init(ListXAttrRespMsg* this);
|
||||
|
||||
// virtual functions
|
||||
extern bool ListXAttrRespMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx);
|
||||
|
||||
// getters and setters
|
||||
static inline char* ListXAttrRespMsg_getValueBuf(ListXAttrRespMsg* this);
|
||||
static inline int ListXAttrRespMsg_getReturnCode(ListXAttrRespMsg* this);
|
||||
static inline int ListXAttrRespMsg_getSize(ListXAttrRespMsg* this);
|
||||
|
||||
struct ListXAttrRespMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
unsigned valueElemNum;
|
||||
char* valueBuf;
|
||||
int size;
|
||||
int returnCode;
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps ListXAttrRespMsg_Ops;
|
||||
|
||||
void ListXAttrRespMsg_init(ListXAttrRespMsg* this)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_ListXAttrResp, &ListXAttrRespMsg_Ops);
|
||||
}
|
||||
|
||||
char* ListXAttrRespMsg_getValueBuf(ListXAttrRespMsg* this)
|
||||
{
|
||||
return this->valueBuf;
|
||||
}
|
||||
|
||||
int ListXAttrRespMsg_getReturnCode(ListXAttrRespMsg* this)
|
||||
{
|
||||
return this->returnCode;
|
||||
}
|
||||
|
||||
int ListXAttrRespMsg_getSize(ListXAttrRespMsg* this)
|
||||
{
|
||||
return this->size;
|
||||
}
|
||||
|
||||
#endif /*LISTXATTRRESPMSG_H_*/
|
||||
@@ -0,0 +1,18 @@
|
||||
#include "RefreshEntryInfoMsg.h"
|
||||
|
||||
|
||||
const struct NetMessageOps RefreshEntryInfoMsg_Ops = {
|
||||
.serializePayload = RefreshEntryInfoMsg_serializePayload,
|
||||
.deserializePayload = _NetMessage_deserializeDummy,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
|
||||
.supportsSequenceNumbers = true,
|
||||
};
|
||||
|
||||
void RefreshEntryInfoMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
|
||||
{
|
||||
RefreshEntryInfoMsg* thisCast = (RefreshEntryInfoMsg*)this;
|
||||
|
||||
// entryInfo
|
||||
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef REFRESHENTRYINFO_H_
|
||||
#define REFRESHENTRYINFO_H_
|
||||
|
||||
#include <common/net/message/NetMessage.h>
|
||||
#include <common/storage/EntryInfo.h>
|
||||
|
||||
|
||||
struct RefreshEntryInfoMsg;
|
||||
typedef struct RefreshEntryInfoMsg RefreshEntryInfoMsg;
|
||||
|
||||
static inline void RefreshEntryInfoMsg_init(RefreshEntryInfoMsg* this);
|
||||
static inline void RefreshEntryInfoMsg_initFromEntryInfo(RefreshEntryInfoMsg* this, const EntryInfo* entryInfo);
|
||||
|
||||
// virtual functions
|
||||
extern void RefreshEntryInfoMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
|
||||
|
||||
|
||||
struct RefreshEntryInfoMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
const EntryInfo* entryInfoPtr; // not owned by this object
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps RefreshEntryInfoMsg_Ops;
|
||||
|
||||
void RefreshEntryInfoMsg_init(RefreshEntryInfoMsg* this)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_RefreshEntryInfo, &RefreshEntryInfoMsg_Ops);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entryInfo just a reference, so do not free it as long as you use this object!
|
||||
*/
|
||||
void RefreshEntryInfoMsg_initFromEntryInfo(RefreshEntryInfoMsg* this, const EntryInfo* entryInfo)
|
||||
{
|
||||
RefreshEntryInfoMsg_init(this);
|
||||
|
||||
this->entryInfoPtr = entryInfo;
|
||||
}
|
||||
|
||||
#endif /*REFRESHENTRYINFO_H_*/
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef REFRESHENTRYINFORESPMSG_H_
|
||||
#define REFRESHENTRYINFORESPMSG_H_
|
||||
|
||||
#include <common/net/message/SimpleIntMsg.h>
|
||||
|
||||
|
||||
struct RefreshEntryInfoRespMsg;
|
||||
typedef struct RefreshEntryInfoRespMsg RefreshEntryInfoRespMsg;
|
||||
|
||||
static inline void RefreshEntryInfoRespMsg_init(RefreshEntryInfoRespMsg* this);
|
||||
|
||||
// getters & setters
|
||||
static inline int RefreshEntryInfoRespMsg_getResult(RefreshEntryInfoRespMsg* this);
|
||||
|
||||
struct RefreshEntryInfoRespMsg
|
||||
{
|
||||
SimpleIntMsg simpleIntMsg;
|
||||
};
|
||||
|
||||
|
||||
void RefreshEntryInfoRespMsg_init(RefreshEntryInfoRespMsg* this)
|
||||
{
|
||||
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_RefreshEntryInfoResp);
|
||||
}
|
||||
|
||||
int RefreshEntryInfoRespMsg_getResult(RefreshEntryInfoRespMsg* this)
|
||||
{
|
||||
return SimpleIntMsg_getValue( (SimpleIntMsg*)this);
|
||||
}
|
||||
|
||||
#endif /*REFRESHENTRYINFORESPMSG_H_*/
|
||||
@@ -0,0 +1,17 @@
|
||||
#include "RemoveXAttrMsg.h"
|
||||
|
||||
const struct NetMessageOps RemoveXAttrMsg_Ops = {
|
||||
.serializePayload = RemoveXAttrMsg_serializePayload,
|
||||
.deserializePayload = _NetMessage_deserializeDummy,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
|
||||
.supportsSequenceNumbers = true,
|
||||
};
|
||||
|
||||
void RemoveXAttrMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
|
||||
{
|
||||
RemoveXAttrMsg* thisCast = (RemoveXAttrMsg*)this;
|
||||
|
||||
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
|
||||
Serialization_serializeStr(ctx, strlen(thisCast->name), thisCast->name);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#ifndef REMOVEXATTRMSG_H_
|
||||
#define REMOVEXATTRMSG_H_
|
||||
|
||||
#include <common/net/message/NetMessage.h>
|
||||
#include <common/storage/EntryInfo.h>
|
||||
|
||||
struct RemoveXAttrMsg;
|
||||
typedef struct RemoveXAttrMsg RemoveXAttrMsg;
|
||||
|
||||
static inline void RemoveXAttrMsg_init(RemoveXAttrMsg* this);
|
||||
static inline void RemoveXAttrMsg_initFromEntryInfoAndName(RemoveXAttrMsg* this,
|
||||
const EntryInfo* entryInfo, const char* name);
|
||||
|
||||
// virtual functions
|
||||
extern void RemoveXAttrMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
|
||||
|
||||
struct RemoveXAttrMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
const EntryInfo* entryInfoPtr;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps RemoveXAttrMsg_Ops;
|
||||
|
||||
void RemoveXAttrMsg_init(RemoveXAttrMsg* this)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_RemoveXAttr, &RemoveXAttrMsg_Ops);
|
||||
}
|
||||
|
||||
void RemoveXAttrMsg_initFromEntryInfoAndName(RemoveXAttrMsg* this, const EntryInfo* entryInfo,
|
||||
const char* name)
|
||||
{
|
||||
RemoveXAttrMsg_init(this);
|
||||
this->entryInfoPtr = entryInfo;
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
#endif /*REMOVEXATTRMSG_H_*/
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef REMOVEXATTRRESPMSG_H_
|
||||
#define REMOVEXATTRRESPMSG_H_
|
||||
|
||||
#include <common/net/message/SimpleIntMsg.h>
|
||||
|
||||
struct RemoveXAttrRespMsg;
|
||||
typedef struct RemoveXAttrRespMsg RemoveXAttrRespMsg;
|
||||
|
||||
static inline void RemoveXAttrRespMsg_init(RemoveXAttrRespMsg* this);
|
||||
|
||||
struct RemoveXAttrRespMsg
|
||||
{
|
||||
SimpleIntMsg simpleIntMsg;
|
||||
};
|
||||
|
||||
void RemoveXAttrRespMsg_init(RemoveXAttrRespMsg* this)
|
||||
{
|
||||
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_RemoveXAttrResp);
|
||||
}
|
||||
|
||||
// getters & setters
|
||||
static inline int RemoveXAttrRespMsg_getValue(RemoveXAttrRespMsg* this)
|
||||
{
|
||||
return SimpleIntMsg_getValue( (SimpleIntMsg*)this);
|
||||
}
|
||||
|
||||
#endif /*REMOVEXATTRRESPMSG_H_*/
|
||||
@@ -0,0 +1,39 @@
|
||||
#include "SetAttrMsg.h"
|
||||
|
||||
|
||||
const struct NetMessageOps SetAttrMsg_Ops = {
|
||||
.serializePayload = SetAttrMsg_serializePayload,
|
||||
.deserializePayload = _NetMessage_deserializeDummy,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
|
||||
.supportsSequenceNumbers = true,
|
||||
};
|
||||
|
||||
void SetAttrMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
|
||||
{
|
||||
SetAttrMsg* thisCast = (SetAttrMsg*)this;
|
||||
|
||||
// validAttribs
|
||||
Serialization_serializeInt(ctx, thisCast->validAttribs);
|
||||
|
||||
// mode
|
||||
Serialization_serializeInt(ctx, thisCast->attribs.mode);
|
||||
|
||||
// modificationTimeSecs
|
||||
Serialization_serializeInt64(ctx, thisCast->attribs.modificationTimeSecs);
|
||||
|
||||
// lastAccessTimeSecs
|
||||
Serialization_serializeInt64(ctx, thisCast->attribs.lastAccessTimeSecs);
|
||||
|
||||
// userID
|
||||
Serialization_serializeUInt(ctx, thisCast->attribs.userID);
|
||||
|
||||
// groupID
|
||||
Serialization_serializeUInt(ctx, thisCast->attribs.groupID);
|
||||
|
||||
// entryInfo
|
||||
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
|
||||
|
||||
if (this->msgHeader.msgFeatureFlags & SETATTRMSG_FLAG_HAS_EVENT)
|
||||
FileEvent_serialize(ctx, thisCast->fileEvent);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
#ifndef SETATTRMSG_H_
|
||||
#define SETATTRMSG_H_
|
||||
|
||||
#include <common/net/message/NetMessage.h>
|
||||
#include <common/storage/StorageDefinitions.h>
|
||||
#include <common/storage/EntryInfo.h>
|
||||
#include <common/storage/FileEvent.h>
|
||||
|
||||
|
||||
#define SETATTRMSG_FLAG_USE_QUOTA 1 /* if the message contains quota informations */
|
||||
#define SETATTRMSG_FLAG_BUDDYMIRROR_SECOND 2 /* secondary of group, otherwise primary */
|
||||
#define SETATTRMSG_FLAG_HAS_EVENT 4 /* contains file event logging information */
|
||||
|
||||
|
||||
struct SetAttrMsg;
|
||||
typedef struct SetAttrMsg SetAttrMsg;
|
||||
|
||||
static inline void SetAttrMsg_init(SetAttrMsg* this);
|
||||
static inline void SetAttrMsg_initFromEntryInfo(SetAttrMsg* this, const EntryInfo* entryInfo,
|
||||
int validAttribs, SettableFileAttribs* attribs, const struct FileEvent* fileEvent);
|
||||
|
||||
// virtual functions
|
||||
extern void SetAttrMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
|
||||
|
||||
|
||||
struct SetAttrMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
int validAttribs;
|
||||
SettableFileAttribs attribs;
|
||||
|
||||
// for serialization
|
||||
const EntryInfo* entryInfoPtr;
|
||||
const struct FileEvent* fileEvent;
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps SetAttrMsg_Ops;
|
||||
|
||||
void SetAttrMsg_init(SetAttrMsg* this)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_SetAttr, &SetAttrMsg_Ops);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entryInfo just a reference, so do not free it as long as you use this object!
|
||||
* @param validAttribs a combination of SETATTR_CHANGE_...-Flags
|
||||
*/
|
||||
void SetAttrMsg_initFromEntryInfo(SetAttrMsg* this, const EntryInfo* entryInfo, int validAttribs,
|
||||
SettableFileAttribs* attribs, const struct FileEvent* fileEvent)
|
||||
{
|
||||
SetAttrMsg_init(this);
|
||||
|
||||
this->entryInfoPtr = entryInfo;
|
||||
this->validAttribs = validAttribs;
|
||||
this->attribs = *attribs;
|
||||
this->fileEvent = fileEvent;
|
||||
|
||||
if (fileEvent)
|
||||
this->netMessage.msgHeader.msgFeatureFlags |= SETATTRMSG_FLAG_HAS_EVENT;
|
||||
}
|
||||
|
||||
#endif /*SETATTRMSG_H_*/
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef SETATTRRESPMSG_H_
|
||||
#define SETATTRRESPMSG_H_
|
||||
|
||||
#include <common/net/message/SimpleIntMsg.h>
|
||||
|
||||
|
||||
struct SetAttrRespMsg;
|
||||
typedef struct SetAttrRespMsg SetAttrRespMsg;
|
||||
|
||||
static inline void SetAttrRespMsg_init(SetAttrRespMsg* this);
|
||||
|
||||
// getters & setters
|
||||
static inline int SetAttrRespMsg_getValue(SetAttrRespMsg* this);
|
||||
|
||||
struct SetAttrRespMsg
|
||||
{
|
||||
SimpleIntMsg simpleIntMsg;
|
||||
};
|
||||
|
||||
|
||||
void SetAttrRespMsg_init(SetAttrRespMsg* this)
|
||||
{
|
||||
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_SetAttrResp);
|
||||
}
|
||||
|
||||
int SetAttrRespMsg_getValue(SetAttrRespMsg* this)
|
||||
{
|
||||
return SimpleIntMsg_getValue( (SimpleIntMsg*)this);
|
||||
}
|
||||
|
||||
#endif /*SETATTRRESPMSG_H_*/
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "SetXAttrMsg.h"
|
||||
|
||||
const struct NetMessageOps SetXAttrMsg_Ops = {
|
||||
.serializePayload = SetXAttrMsg_serializePayload,
|
||||
.deserializePayload = _NetMessage_deserializeDummy,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
|
||||
.supportsSequenceNumbers = true,
|
||||
};
|
||||
|
||||
void SetXAttrMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
|
||||
{
|
||||
SetXAttrMsg* thisCast = (SetXAttrMsg*)this;
|
||||
|
||||
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
|
||||
Serialization_serializeStr(ctx, strlen(thisCast->name), thisCast->name);
|
||||
Serialization_serializeCharArray(ctx, thisCast->size, thisCast->value);
|
||||
Serialization_serializeInt(ctx, thisCast->flags);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef SETXATTRMSG_H_
|
||||
#define SETXATTRMSG_H_
|
||||
|
||||
#include <common/net/message/NetMessage.h>
|
||||
#include <common/storage/EntryInfo.h>
|
||||
|
||||
struct SetXAttrMsg;
|
||||
typedef struct SetXAttrMsg SetXAttrMsg;
|
||||
|
||||
static inline void SetXAttrMsg_init(SetXAttrMsg* this);
|
||||
static inline void SetXAttrMsg_initFromEntryInfoNameValueAndSize(SetXAttrMsg* this,
|
||||
const EntryInfo* entryInfo, const char* name, const char* value, const size_t size,
|
||||
const int flags);
|
||||
|
||||
// virtual functions
|
||||
extern void SetXAttrMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
|
||||
|
||||
struct SetXAttrMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
const EntryInfo* entryInfoPtr;
|
||||
|
||||
const char* name;
|
||||
const char* value;
|
||||
size_t size;
|
||||
int flags;
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps SetXAttrMsg_Ops;
|
||||
|
||||
void SetXAttrMsg_init(SetXAttrMsg* this)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_SetXAttr, &SetXAttrMsg_Ops);
|
||||
}
|
||||
|
||||
void SetXAttrMsg_initFromEntryInfoNameValueAndSize(SetXAttrMsg* this, const EntryInfo* entryInfo,
|
||||
const char* name, const char* value, const size_t size, const int flags)
|
||||
{
|
||||
SetXAttrMsg_init(this);
|
||||
this->entryInfoPtr = entryInfo;
|
||||
this->name = name;
|
||||
this->value = value;
|
||||
this->size = size;
|
||||
this->flags = flags;
|
||||
}
|
||||
|
||||
#endif /*SETXATTRMSG_H_*/
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef SETXATTRRESPMSG_H_
|
||||
#define SETXATTRRESPMSG_H_
|
||||
|
||||
#include <common/net/message/SimpleIntMsg.h>
|
||||
|
||||
struct SetXAttrRespMsg;
|
||||
typedef struct SetXAttrRespMsg SetXAttrRespMsg;
|
||||
|
||||
static inline void SetXAttrRespMsg_init(SetXAttrRespMsg* this);
|
||||
|
||||
struct SetXAttrRespMsg
|
||||
{
|
||||
SimpleIntMsg simpleIntMsg;
|
||||
};
|
||||
|
||||
void SetXAttrRespMsg_init(SetXAttrRespMsg* this)
|
||||
{
|
||||
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_SetXAttrResp);
|
||||
}
|
||||
|
||||
// getters & setters
|
||||
static inline int SetXAttrRespMsg_getValue(SetXAttrRespMsg* this)
|
||||
{
|
||||
return SimpleIntMsg_getValue( (SimpleIntMsg*)this);
|
||||
}
|
||||
|
||||
#endif /*SETXATTRRESPMSG_H_*/
|
||||
@@ -0,0 +1,22 @@
|
||||
#include "StatMsg.h"
|
||||
|
||||
|
||||
const struct NetMessageOps StatMsg_Ops = {
|
||||
.serializePayload = StatMsg_serializePayload,
|
||||
.deserializePayload = _NetMessage_deserializeDummy,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = StatMsg_getSupportedHeaderFeatureFlagsMask,
|
||||
};
|
||||
|
||||
void StatMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
|
||||
{
|
||||
StatMsg* thisCast = (StatMsg*)this;
|
||||
|
||||
// entryInfo
|
||||
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
|
||||
}
|
||||
|
||||
unsigned StatMsg_getSupportedHeaderFeatureFlagsMask(NetMessage* this)
|
||||
{
|
||||
return STATMSG_FLAG_GET_PARENTINFO;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
#ifndef STATMSG_H_
|
||||
#define STATMSG_H_
|
||||
|
||||
#include <common/net/message/NetMessage.h>
|
||||
#include <common/storage/Path.h>
|
||||
#include <common/toolkit/MetadataTk.h>
|
||||
|
||||
#define STATMSG_FLAG_GET_PARENTINFO 1 /* caller wants to have parentOwnerNodeID and parentEntryID */
|
||||
|
||||
|
||||
struct StatMsg;
|
||||
typedef struct StatMsg StatMsg;
|
||||
|
||||
static inline void StatMsg_init(StatMsg* this);
|
||||
static inline void StatMsg_initFromEntryInfo(StatMsg* this, const EntryInfo* entryInfo);
|
||||
static inline void StatMsg_addParentInfoRequest(StatMsg* this);
|
||||
|
||||
// virtual functions
|
||||
extern void StatMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
|
||||
extern unsigned StatMsg_getSupportedHeaderFeatureFlagsMask(NetMessage* this);
|
||||
|
||||
|
||||
struct StatMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
const EntryInfo* entryInfoPtr; // not owed by this object
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps StatMsg_Ops;
|
||||
|
||||
void StatMsg_init(StatMsg* this)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_Stat, &StatMsg_Ops);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entryInfo just a reference, so do not free it as long as you use this object!
|
||||
*/
|
||||
void StatMsg_initFromEntryInfo(StatMsg* this, const EntryInfo* entryInfo)
|
||||
{
|
||||
StatMsg_init(this);
|
||||
|
||||
this->entryInfoPtr = entryInfo;
|
||||
}
|
||||
|
||||
void StatMsg_addParentInfoRequest(StatMsg* this)
|
||||
{
|
||||
NetMessage* netMsg = (NetMessage*) this;
|
||||
|
||||
NetMessage_addMsgHeaderFeatureFlag(netMsg, STATMSG_FLAG_GET_PARENTINFO);
|
||||
}
|
||||
|
||||
|
||||
#endif /*STATMSG_H_*/
|
||||
@@ -0,0 +1,44 @@
|
||||
#include "StatRespMsg.h"
|
||||
|
||||
|
||||
const struct NetMessageOps StatRespMsg_Ops = {
|
||||
.serializePayload = _NetMessage_serializeDummy,
|
||||
.deserializePayload = StatRespMsg_deserializePayload,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = StatRespMsg_getSupportedHeaderFeatureFlagsMask,
|
||||
};
|
||||
|
||||
bool StatRespMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx)
|
||||
{
|
||||
StatRespMsg* thisCast = (StatRespMsg*)this;
|
||||
|
||||
// result
|
||||
if(!Serialization_deserializeInt(ctx, &thisCast->result) )
|
||||
return false;
|
||||
|
||||
// statData
|
||||
if(!StatData_deserialize(ctx, &thisCast->statData) )
|
||||
return false;
|
||||
|
||||
if(NetMessage_isMsgHeaderFeatureFlagSet(this, STATRESPMSG_FLAG_HAS_PARENTINFO) )
|
||||
{
|
||||
{ // parentEntryID
|
||||
unsigned strLen;
|
||||
|
||||
if (!Serialization_deserializeStrAlign4(ctx, &strLen, &thisCast->parentEntryID) )
|
||||
return false;
|
||||
}
|
||||
|
||||
// parentNodeID
|
||||
if(!NumNodeID_deserialize(ctx, &thisCast->parentNodeID) )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned StatRespMsg_getSupportedHeaderFeatureFlagsMask(NetMessage* this)
|
||||
{
|
||||
return STATRESPMSG_FLAG_HAS_PARENTINFO;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
#ifndef STATRESPMSG_H_
|
||||
#define STATRESPMSG_H_
|
||||
|
||||
#include <common/net/message/NetMessage.h>
|
||||
#include <common/storage/StatData.h>
|
||||
|
||||
|
||||
#define STATRESPMSG_FLAG_HAS_PARENTINFO 1 /* msg includes parentOwnerNodeID and
|
||||
parentEntryID */
|
||||
|
||||
|
||||
struct StatRespMsg;
|
||||
typedef struct StatRespMsg StatRespMsg;
|
||||
|
||||
static inline void StatRespMsg_init(StatRespMsg* this);
|
||||
static inline void StatRespMsg_getParentInfo(StatRespMsg* this, NumNodeID* outParentNodeID,
|
||||
char** outParentEntryID);
|
||||
|
||||
// virtual functions
|
||||
extern bool StatRespMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx);
|
||||
extern unsigned StatRespMsg_getSupportedHeaderFeatureFlagsMask(NetMessage* this);
|
||||
|
||||
// getters & setters
|
||||
static inline int StatRespMsg_getResult(StatRespMsg* this);
|
||||
static inline StatData* StatRespMsg_getStatData(StatRespMsg* this);
|
||||
|
||||
struct StatRespMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
int result;
|
||||
StatData statData;
|
||||
|
||||
const char* parentEntryID;
|
||||
NumNodeID parentNodeID;
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps StatRespMsg_Ops;
|
||||
|
||||
void StatRespMsg_init(StatRespMsg* this)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_StatResp, &StatRespMsg_Ops);
|
||||
|
||||
NumNodeID_set(&this->parentNodeID, 0);
|
||||
this->parentEntryID = NULL;
|
||||
}
|
||||
|
||||
int StatRespMsg_getResult(StatRespMsg* this)
|
||||
{
|
||||
return this->result;
|
||||
}
|
||||
|
||||
|
||||
StatData* StatRespMsg_getStatData(StatRespMsg* this)
|
||||
{
|
||||
return &this->statData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parentInfo
|
||||
*
|
||||
* Note: outParentEntryID is a string copy
|
||||
*/
|
||||
void StatRespMsg_getParentInfo(StatRespMsg* this, NumNodeID* outParentNodeID, char** outParentEntryID)
|
||||
{
|
||||
if (outParentNodeID)
|
||||
{
|
||||
*outParentNodeID = this->parentNodeID;
|
||||
|
||||
if (likely(outParentEntryID) )
|
||||
*outParentEntryID = StringTk_strDup(this->parentEntryID);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*STATRESPMSG_H_*/
|
||||
Reference in New Issue
Block a user