New upstream version 8.1.0

This commit is contained in:
geos_one
2025-08-10 01:34:16 +02:00
commit c891bb7105
4398 changed files with 838833 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#include "RenameMsg.h"
const struct NetMessageOps RenameMsg_Ops = {
.serializePayload = RenameMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
.supportsSequenceNumbers = true,
};
void RenameMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
RenameMsg* thisCast = (RenameMsg*)this;
//entryType
Serialization_serializeUInt(ctx, thisCast->entryType);
// fromDirInfo
EntryInfo_serialize(ctx, thisCast->fromDirInfo);
// toDirInfo
EntryInfo_serialize(ctx, thisCast->toDirInfo);
// oldName
Serialization_serializeStrAlign4(ctx, thisCast->oldNameLen, thisCast->oldName);
// newName
Serialization_serializeStrAlign4(ctx, thisCast->newNameLen, thisCast->newName);
if (this->msgHeader.msgFeatureFlags & RENAMEMSG_FLAG_HAS_EVENT)
FileEvent_serialize(ctx, thisCast->fileEvent);
}

View File

@@ -0,0 +1,78 @@
#ifndef RENAMEMSG_H_
#define RENAMEMSG_H_
#include <common/storage/EntryInfo.h>
#include <common/storage/FileEvent.h>
#include <common/net/message/NetMessage.h>
#include <common/storage/Path.h>
#define RENAMEMSG_FLAG_HAS_EVENT 1 /* contains file event logging information */
/* This is the RenameMsg class, deserialization is not implemented, as the client is not supposed to
deserialize the message. There is also only a basic constructor, if a full constructor is
needed, it can be easily added later on */
struct RenameMsg;
typedef struct RenameMsg RenameMsg;
static inline void RenameMsg_init(RenameMsg* this);
static inline void RenameMsg_initFromEntryInfo(RenameMsg* this, const char* oldName,
unsigned oldLen, DirEntryType entryType, const EntryInfo* fromDirInfo, const char* newName,
unsigned newLen, const EntryInfo* toDirInfo, const struct FileEvent* fileEvent);
// virtual functions
extern void RenameMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
struct RenameMsg
{
NetMessage netMessage;
// for serialization
const char* oldName; // not owned by this object!
unsigned oldNameLen;
DirEntryType entryType;
const EntryInfo* fromDirInfo; // not owned by this object!
const char* newName; // not owned by this object!
unsigned newNameLen;
const EntryInfo* toDirInfo; // not owned by this object!
const struct FileEvent* fileEvent;
};
extern const struct NetMessageOps RenameMsg_Ops;
void RenameMsg_init(RenameMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_Rename, &RenameMsg_Ops);
}
/**
* @param oldName just a reference, so do not free it as long as you use this object!
* @param fromDirInfo just a reference, so do not free it as long as you use this object!
* @param newName just a reference, so do not free it as long as you use this object!
* @param toDirInfo just a reference, so do not free it as long as you use this object!
*/
void RenameMsg_initFromEntryInfo(RenameMsg* this, const char* oldName, unsigned oldLen,
DirEntryType entryType, const EntryInfo* fromDirInfo, const char* newName, unsigned newLen,
const EntryInfo* toDirInfo, const struct FileEvent* fileEvent)
{
RenameMsg_init(this);
this->oldName = oldName;
this->oldNameLen = oldLen;
this->entryType = entryType;
this->fromDirInfo = fromDirInfo;
this->newName = newName;
this->newNameLen = newLen;
this->toDirInfo = toDirInfo;
this->fileEvent = fileEvent;
if (fileEvent)
this->netMessage.msgHeader.msgFeatureFlags |= RENAMEMSG_FLAG_HAS_EVENT;
}
#endif /*RENAMEMSG_H_*/

View File

@@ -0,0 +1,32 @@
#ifndef RENAMERESPMSG_H_
#define RENAMERESPMSG_H_
#include <common/net/message/SimpleIntMsg.h>
struct RenameRespMsg;
typedef struct RenameRespMsg RenameRespMsg;
static inline void RenameRespMsg_init(RenameRespMsg* this);
// getters & setters
static inline int RenameRespMsg_getValue(RenameRespMsg* this);
struct RenameRespMsg
{
SimpleIntMsg simpleIntMsg;
};
void RenameRespMsg_init(RenameRespMsg* this)
{
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_RenameResp);
}
int RenameRespMsg_getValue(RenameRespMsg* this)
{
return SimpleIntMsg_getValue( (SimpleIntMsg*)this);
}
#endif /*RENAMERESPMSG_H_*/