1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00

Merge commit 'origin'

This commit is contained in:
psyc://psyced.org/~lynX 2011-04-23 17:16:24 +02:00
commit 1c0d6f8e51

View file

@ -79,18 +79,20 @@ typedef enum
PSYC_LIST_BINARY = 2, PSYC_LIST_BINARY = 2,
} PSYC_ListType; } PSYC_ListType;
typedef enum { typedef enum
{
PSYC_MODIFIER_CHECK_LENGTH = 0, PSYC_MODIFIER_CHECK_LENGTH = 0,
PSYC_MODIFIER_NEED_LENGTH = 1, PSYC_MODIFIER_NEED_LENGTH = 1,
PSYC_MODIFIER_NO_LENGTH = 2, PSYC_MODIFIER_NO_LENGTH = 2,
PSYC_MODIFIER_ROUTING = 3, PSYC_MODIFIER_ROUTING = 3,
} PSYC_ModifierType; } PSYC_ModifierFlag;
typedef enum { typedef enum
PSYC_CONTENT_CHECK_LENGTH = 0, {
PSYC_CONTENT_NEED_LENGTH = 1, PSYC_PACKET_CHECK_LENGTH = 0,
PSYC_CONTENT_NO_LENGTH = 2, PSYC_PACKET_NEED_LENGTH = 1,
} PSYC_ContentType; PSYC_PACKET_NO_LENGTH = 2,
} PSYC_PacketFlag;
typedef struct typedef struct
{ {
@ -102,23 +104,32 @@ typedef struct
#define PSYC_C2ARG(string) string, sizeof(string)-1 #define PSYC_C2ARG(string) string, sizeof(string)-1
/* intermediate struct for a PSYC variable modification */ /* intermediate struct for a PSYC variable modification */
typedef struct { typedef struct
{
char oper; // not call it 'operator' as C++ may not like that..? char oper; // not call it 'operator' as C++ may not like that..?
PSYC_Array name; PSYC_Array name;
PSYC_Array value; PSYC_Array value;
PSYC_ModifierType type; PSYC_ModifierFlag flag;
} PSYC_Modifier; } PSYC_Modifier;
/* intermediate struct for a PSYC packet */ /* intermediate struct for a PSYC packet */
typedef struct { typedef struct
PSYC_Modifier **routing; // Header {
PSYC_Modifier **entity; // Header PSYC_Modifier** routing; // Routing header
PSYC_Modifier** entity; // Entitiy header
PSYC_Array method; PSYC_Array method;
PSYC_Array data; PSYC_Array data;
PSYC_ContentType contentType; size_t length; /// Length of content part
size_t contentLength; PSYC_PacketFlag flag;
} PSYC_Packet; } PSYC_Packet;
PSYC_Modifier PSYC_newModifier(char* oper, PSYC_Array* name, PSYC_Array* value, PSYC_ModifierFlag flag);
PSYC_Modifier PSYC_newModifier2(char* oper, char* name, size_t namelen, char* value, size_t valuelen, PSYC_ModifierFlag flag);
PSYC_Packet PSYC_newPacket(PSYC_Modifier** routing, PSYC_Modifier **entity, PSYC_Array* method, PSYC_Array* data, PSYC_PacketFlag flag);
PSYC_Packet PSYC_newPacket2(PSYC_Modifier** routing, PSYC_Modifier **entity, char* method, size_t methodlen, char* data, size_t datalen, PSYC_PacketFlag flag);
/// Routing vars in alphabetical order. /// Routing vars in alphabetical order.
extern const PSYC_Array PSYC_routingVars[]; extern const PSYC_Array PSYC_routingVars[];