mirror of
git://git.psyc.eu/libpsyc
synced 2024-08-15 03:19:02 +00:00
added state op return codes for psyc_parse, added stateop to PsycPacket
This commit is contained in:
parent
9f9bb2ffaa
commit
49dedd5864
9 changed files with 91 additions and 91 deletions
|
@ -63,6 +63,13 @@ typedef enum
|
|||
PSYC_OPERATOR_QUERY = '?',
|
||||
} PsycOperator;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PSYC_STATE_NOOP = 0,
|
||||
PSYC_STATE_RESET = '=',
|
||||
PSYC_STATE_SYNC = '?',
|
||||
} PsycStateOp;
|
||||
|
||||
/** Structure for a modifier. */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -91,15 +98,16 @@ typedef struct
|
|||
/** Intermediate struct for a PSYC packet */
|
||||
typedef struct
|
||||
{
|
||||
PsycHeader routing; ///< Routing header.
|
||||
PsycHeader entity; ///< Entity header.
|
||||
PsycString method; ///< Contains the method.
|
||||
PsycString data; ///< Contains the data.
|
||||
PsycString content; ///< Contains the whole content.
|
||||
PsycHeader routing; ///< Routing header.
|
||||
PsycHeader entity; ///< Entity header.
|
||||
char stateop; ///< State operation. @see PsycStateOp
|
||||
PsycString method; ///< Contains the method.
|
||||
PsycString data; ///< Contains the data.
|
||||
PsycString content; ///< Contains the whole content.
|
||||
size_t routingLength; ///< Length of routing part.
|
||||
size_t contentLength; ///< Length of content part.
|
||||
size_t length; ///< Total length of packet.
|
||||
PsycPacketFlag flag; ///< Packet flag.
|
||||
size_t length; ///< Total length of packet.
|
||||
PsycPacketFlag flag; ///< Packet flag.
|
||||
} PsycPacket;
|
||||
|
||||
/**
|
||||
|
@ -182,7 +190,7 @@ void psyc_packet_init (PsycPacket *packet,
|
|||
PsycModifier *entity, size_t entitylen,
|
||||
char *method, size_t methodlen,
|
||||
char *data, size_t datalen,
|
||||
PsycPacketFlag flag);
|
||||
char stateop, PsycPacketFlag flag);
|
||||
|
||||
/** Initialize packet with raw content. */
|
||||
void psyc_packet_init_raw (PsycPacket *packet,
|
||||
|
|
|
@ -152,42 +152,46 @@ typedef enum {
|
|||
/// Routing modifier parsing done.
|
||||
/// Operator, name & value contains the respective parts.
|
||||
PSYC_PARSE_ROUTING = 2,
|
||||
/// State sync operation.
|
||||
PSYC_PARSE_STATE_SYNC = 3,
|
||||
/// State reset operation.
|
||||
PSYC_PARSE_STATE_RESET = 4,
|
||||
/// Start of an incomplete entity modifier.
|
||||
/// Operator & name are complete, value is incomplete.
|
||||
PSYC_PARSE_ENTITY_START = 3,
|
||||
PSYC_PARSE_ENTITY_START = 5,
|
||||
/// Continuation of an incomplete entity modifier.
|
||||
PSYC_PARSE_ENTITY_CONT = 4,
|
||||
PSYC_PARSE_ENTITY_CONT = 6,
|
||||
/// End of an incomplete entity modifier.
|
||||
PSYC_PARSE_ENTITY_END = 5,
|
||||
PSYC_PARSE_ENTITY_END = 7,
|
||||
/// Entity modifier parsing done in one go.
|
||||
/// Operator, name & value contains the respective parts.
|
||||
PSYC_PARSE_ENTITY = 6,
|
||||
PSYC_PARSE_ENTITY = 8,
|
||||
/// Start of an incomplete body.
|
||||
/// Name contains method, value contains part of the body.
|
||||
/// Used when packet length is given
|
||||
PSYC_PARSE_BODY_START = 7,
|
||||
PSYC_PARSE_BODY_START = 9,
|
||||
/// Continuation of an incomplete body.
|
||||
/// Used when packet length is given
|
||||
PSYC_PARSE_BODY_CONT = 8,
|
||||
PSYC_PARSE_BODY_CONT = 10,
|
||||
/// End of an incomplete body.
|
||||
/// Used when packet length is given
|
||||
PSYC_PARSE_BODY_END = 9,
|
||||
PSYC_PARSE_BODY_END = 11,
|
||||
/// Body parsing done in one go, name contains method, value contains body.
|
||||
PSYC_PARSE_BODY = 10,
|
||||
PSYC_PARSE_BODY = 12,
|
||||
/// Start of an incomplete content, value contains part of content.
|
||||
/// Used when PSYC_PARSE_ROUTING_ONLY is set.
|
||||
PSYC_PARSE_CONTENT_START = 7,
|
||||
PSYC_PARSE_CONTENT_START = 9,
|
||||
/// Continuation of an incomplete content.
|
||||
/// Used when PSYC_PARSE_ROUTING_ONLY is set.
|
||||
PSYC_PARSE_CONTENT_CONT = 8,
|
||||
PSYC_PARSE_CONTENT_CONT = 10,
|
||||
/// End of an incomplete content.
|
||||
/// Used when PSYC_PARSE_ROUTING_ONLY is set.
|
||||
PSYC_PARSE_CONTENT_END = 9,
|
||||
PSYC_PARSE_CONTENT_END = 11,
|
||||
/// Content parsing done in one go, value contains the whole content.
|
||||
/// Used when PSYC_PARSE_ROUTING_ONLY is set.
|
||||
PSYC_PARSE_CONTENT = 10,
|
||||
PSYC_PARSE_CONTENT = 12,
|
||||
/// Finished parsing packet.
|
||||
PSYC_PARSE_COMPLETE = 11,
|
||||
PSYC_PARSE_COMPLETE = 13,
|
||||
} PsycParseRC;
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,32 +14,8 @@
|
|||
# define PSYC_MODIFIER_SIZE_THRESHOLD 404
|
||||
#endif
|
||||
|
||||
#define C_GLYPH_PACKET_DELIMITER '|'
|
||||
#define S_GLYPH_PACKET_DELIMITER "|"
|
||||
#define PSYC_PACKET_DELIMITER "\n|\n"
|
||||
|
||||
#define C_GLYPH_SEPARATOR_KEYWORD '_'
|
||||
#define S_GLYPH_SEPARATOR_KEYWORD "_"
|
||||
|
||||
#define C_GLYPH_OPERATOR_SET ':'
|
||||
#define S_GLYPH_OPERATOR_SET ":"
|
||||
|
||||
#define C_GLYPH_OPERATOR_ASSIGN '='
|
||||
#define S_GLYPH_OPERATOR_ASSIGN "="
|
||||
|
||||
#define C_GLYPH_OPERATOR_AUGMENT '+'
|
||||
#define S_GLYPH_OPERATOR_AUGMENT "+"
|
||||
|
||||
#define C_GLYPH_OPERATOR_DIMINISH '-'
|
||||
#define S_GLYPH_OPERATOR_DIMINISH "-"
|
||||
|
||||
#define C_GLYPH_OPERATOR_QUERY '?'
|
||||
#define S_GLYPH_OPERATOR_QUERY "?"
|
||||
|
||||
/* might move into routing.h or something */
|
||||
#define PSYC_ROUTING 1
|
||||
#define PSYC_ROUTING_MERGE 2
|
||||
#define PSYC_ROUTING_RENDER 4
|
||||
#define PSYC_PACKET_DELIMITER_CHAR '|'
|
||||
#define PSYC_PACKET_DELIMITER "\n|\n"
|
||||
|
||||
#define PSYC_SYNTAX_H
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue