New upstream version 8.1.0
This commit is contained in:
40
client_module/source/common/net/message/control/AckMsgEx.h
Normal file
40
client_module/source/common/net/message/control/AckMsgEx.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef ACKMSGEX_H_
|
||||
#define ACKMSGEX_H_
|
||||
|
||||
#include "../SimpleStringMsg.h"
|
||||
|
||||
|
||||
struct AckMsgEx;
|
||||
typedef struct AckMsgEx AckMsgEx;
|
||||
|
||||
static inline void AckMsgEx_init(AckMsgEx* this);
|
||||
static inline void AckMsgEx_initFromValue(AckMsgEx* this,
|
||||
const char* value);
|
||||
|
||||
// getters & setters
|
||||
static inline const char* AckMsgEx_getValue(AckMsgEx* this);
|
||||
|
||||
|
||||
struct AckMsgEx
|
||||
{
|
||||
SimpleStringMsg simpleStringMsg;
|
||||
};
|
||||
|
||||
|
||||
void AckMsgEx_init(AckMsgEx* this)
|
||||
{
|
||||
SimpleStringMsg_init( (SimpleStringMsg*)this, NETMSGTYPE_Ack);
|
||||
}
|
||||
|
||||
void AckMsgEx_initFromValue(AckMsgEx* this, const char* value)
|
||||
{
|
||||
SimpleStringMsg_initFromValue( (SimpleStringMsg*)this, NETMSGTYPE_Ack, value);
|
||||
}
|
||||
|
||||
const char* AckMsgEx_getValue(AckMsgEx* this)
|
||||
{
|
||||
return SimpleStringMsg_getValue( (SimpleStringMsg*)this);
|
||||
}
|
||||
|
||||
|
||||
#endif /* ACKMSGEX_H_ */
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef AUTHENTICATECHANNELMSG_H_
|
||||
#define AUTHENTICATECHANNELMSG_H_
|
||||
|
||||
#include <common/net/message/SimpleInt64Msg.h>
|
||||
|
||||
|
||||
struct AuthenticateChannelMsg;
|
||||
typedef struct AuthenticateChannelMsg AuthenticateChannelMsg;
|
||||
|
||||
|
||||
static inline void AuthenticateChannelMsg_init(AuthenticateChannelMsg* this);
|
||||
static inline void AuthenticateChannelMsg_initFromValue(AuthenticateChannelMsg* this,
|
||||
uint64_t authHash);
|
||||
|
||||
|
||||
struct AuthenticateChannelMsg
|
||||
{
|
||||
SimpleInt64Msg simpleInt64Msg;
|
||||
};
|
||||
|
||||
|
||||
void AuthenticateChannelMsg_init(AuthenticateChannelMsg* this)
|
||||
{
|
||||
SimpleInt64Msg_init( (SimpleInt64Msg*)this, NETMSGTYPE_AuthenticateChannel);
|
||||
}
|
||||
|
||||
void AuthenticateChannelMsg_initFromValue(AuthenticateChannelMsg* this, uint64_t authHash)
|
||||
{
|
||||
SimpleInt64Msg_initFromValue( (SimpleInt64Msg*)this, NETMSGTYPE_AuthenticateChannel, authHash);
|
||||
}
|
||||
|
||||
#endif /* AUTHENTICATECHANNELMSG_H_ */
|
||||
@@ -0,0 +1,65 @@
|
||||
#ifndef GENERICRESPONSEMSG_H_
|
||||
#define GENERICRESPONSEMSG_H_
|
||||
|
||||
#include <common/net/message/SimpleIntStringMsg.h>
|
||||
|
||||
|
||||
/**
|
||||
* Note: Remember to keep this in sync with userspace common lib.
|
||||
*/
|
||||
enum GenericRespMsgCode
|
||||
{
|
||||
GenericRespMsgCode_TRYAGAIN = 0, /* requestor shall try again in a few seconds */
|
||||
GenericRespMsgCode_INDIRECTCOMMERR = 1, /* indirect communication error and requestor should
|
||||
try again (e.g. msg forwarding to other server failed) */
|
||||
GenericRespMsgCode_NEWSEQNOBASE = 2, /* client has restarted its seq# sequence. server provides
|
||||
the new starting seq#. */
|
||||
};
|
||||
typedef enum GenericRespMsgCode GenericRespMsgCode;
|
||||
|
||||
|
||||
struct GenericResponseMsg;
|
||||
typedef struct GenericResponseMsg GenericResponseMsg;
|
||||
|
||||
|
||||
static inline void GenericResponseMsg_init(GenericResponseMsg* this);
|
||||
|
||||
// getters & setters
|
||||
static inline GenericRespMsgCode GenericResponseMsg_getControlCode(GenericResponseMsg* this);
|
||||
static inline const char* GenericResponseMsg_getLogStr(GenericResponseMsg* this);
|
||||
|
||||
|
||||
/**
|
||||
* A generic response that can be sent as a reply to any message. This special control message will
|
||||
* be handled internally by the requestors MessageTk::requestResponse...() method.
|
||||
*
|
||||
* This is intended to submit internal information (like asking for a communication retry) to the
|
||||
* requestors MessageTk through the control code. So the MessageTk caller on the requestor side
|
||||
* will never actually see this GenericResponseMsg.
|
||||
*
|
||||
* The message string is intended to provide additional human-readable information like why this
|
||||
* control code was submitted instead of the actually expected response msg.
|
||||
*/
|
||||
struct GenericResponseMsg
|
||||
{
|
||||
SimpleIntStringMsg simpleIntStringMsg;
|
||||
};
|
||||
|
||||
|
||||
void GenericResponseMsg_init(GenericResponseMsg* this)
|
||||
{
|
||||
SimpleIntStringMsg_init( (SimpleIntStringMsg*)this, NETMSGTYPE_GenericResponse);
|
||||
}
|
||||
|
||||
GenericRespMsgCode GenericResponseMsg_getControlCode(GenericResponseMsg* this)
|
||||
{
|
||||
return (GenericRespMsgCode)SimpleIntStringMsg_getIntValue( (SimpleIntStringMsg*)this);
|
||||
}
|
||||
|
||||
const char* GenericResponseMsg_getLogStr(GenericResponseMsg* this)
|
||||
{
|
||||
return SimpleIntStringMsg_getStrValue( (SimpleIntStringMsg*)this);
|
||||
}
|
||||
|
||||
|
||||
#endif /* GENERICRESPONSEMSG_H_ */
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "PeerInfoMsg.h"
|
||||
|
||||
static void PeerInfoMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
|
||||
{
|
||||
PeerInfoMsg* thisCast = (PeerInfoMsg*)this;
|
||||
|
||||
Serialization_serializeUInt(ctx, thisCast->type);
|
||||
NumNodeID_serialize(ctx, &thisCast->id);
|
||||
}
|
||||
|
||||
static bool PeerInfoMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx)
|
||||
{
|
||||
PeerInfoMsg* thisCast = (PeerInfoMsg*)this;
|
||||
|
||||
unsigned type = 0;
|
||||
bool result =
|
||||
Serialization_deserializeUInt(ctx, &type)
|
||||
&& NumNodeID_deserialize(ctx, &thisCast->id);
|
||||
|
||||
thisCast->type = type;
|
||||
return result;
|
||||
}
|
||||
|
||||
const struct NetMessageOps PeerInfoMsg_Ops = {
|
||||
.serializePayload = PeerInfoMsg_serializePayload,
|
||||
.deserializePayload = PeerInfoMsg_deserializePayload,
|
||||
.processIncoming = NetMessage_processIncoming,
|
||||
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef COMMON_NET_MESSAGE_CONTROL_PEERINFOMSG_H
|
||||
#define COMMON_NET_MESSAGE_CONTROL_PEERINFOMSG_H
|
||||
|
||||
#include <common/net/message/NetMessage.h>
|
||||
#include <common/nodes/Node.h>
|
||||
|
||||
struct PeerInfoMsg;
|
||||
typedef struct PeerInfoMsg PeerInfoMsg;
|
||||
|
||||
struct PeerInfoMsg
|
||||
{
|
||||
NetMessage netMessage;
|
||||
|
||||
NodeType type;
|
||||
NumNodeID id;
|
||||
};
|
||||
|
||||
extern const struct NetMessageOps PeerInfoMsg_Ops;
|
||||
|
||||
static inline void PeerInfoMsg_init(PeerInfoMsg* this, NodeType type, NumNodeID id)
|
||||
{
|
||||
NetMessage_init(&this->netMessage, NETMSGTYPE_PeerInfo, &PeerInfoMsg_Ops);
|
||||
|
||||
this->type = type;
|
||||
this->id = id;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef SETCHANNELDIRECTMSG_H_
|
||||
#define SETCHANNELDIRECTMSG_H_
|
||||
|
||||
#include <common/net/message/SimpleIntMsg.h>
|
||||
|
||||
|
||||
struct SetChannelDirectMsg;
|
||||
typedef struct SetChannelDirectMsg SetChannelDirectMsg;
|
||||
|
||||
static inline void SetChannelDirectMsg_init(SetChannelDirectMsg* this);
|
||||
static inline void SetChannelDirectMsg_initFromValue(SetChannelDirectMsg* this, int value);
|
||||
|
||||
struct SetChannelDirectMsg
|
||||
{
|
||||
SimpleIntMsg simpleIntMsg;
|
||||
};
|
||||
|
||||
|
||||
void SetChannelDirectMsg_init(SetChannelDirectMsg* this)
|
||||
{
|
||||
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_SetChannelDirect);
|
||||
}
|
||||
|
||||
void SetChannelDirectMsg_initFromValue(SetChannelDirectMsg* this, int value)
|
||||
{
|
||||
SimpleIntMsg_initFromValue( (SimpleIntMsg*)this, NETMSGTYPE_SetChannelDirect, value);
|
||||
}
|
||||
|
||||
#endif /*SETCHANNELDIRECTMSG_H_*/
|
||||
Reference in New Issue
Block a user