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

memmem, not rendering yet

This commit is contained in:
psyc://psyced.org/~lynX 2011-04-20 22:22:55 +02:00
parent 88d9a10ab8
commit a3fdc3d6b7
6 changed files with 119 additions and 9 deletions

View file

@ -7,3 +7,8 @@
#define unless(COND) if (!(COND))
#define until(COND) while (!(COND))
#ifndef _GNU_SOURCE
void *memmem(const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen);
#endif

View file

@ -1,13 +1,26 @@
int PSYC_renderHeader(struct PSYC_Buffers* pbuf,
typedef enum {
PSYC_FINE = 0,
PSYC_NEED_LENGTH = 1
} PSYC_RenderFlag;
typedef struct {
PSYC_RenderFlag flag; ///< flags for the renderer
size_t cursor; ///< current position in buffer
size_t start; ///< position where the rendered packet starts
size_t length; ///< how big is the buffer we allocated
uint8_t buffer[]; ///< OMG a C99 feature! variable size buffer!
} PSYC_RenderState;
int PSYC_renderHeader(PSYC_RenderState render,
const uint8_t* name, const size_t nlength,
const uint8_t* value, const size_t vlength,
const uchar flags, const uchar modifier);
const uint8_t flags, const uint8_t modifier);
int PSYC_renderBody(struct PSYC_Buffers* pbuf,
int PSYC_renderBody(PSYC_RenderState render,
const uint8_t* method, const size_t mlength,
const uint8_t* data, const size_t dlength,
const uchar flags);
const uint8_t flags);
int PSYC_doneRender(struct PSYC_Buffers* pbuf,
int PSYC_doneRender(PSYC_RenderState render,
uint8_t** buf, size_t* written);

View file

@ -10,8 +10,9 @@
# define PSYC_CONTENT_SIZE_THRESHOLD 444
#endif
#define C_GLYPH_PACKET_DELIMITER '.'
#define S_GLYPH_PACKET_DELIMITER "."
#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 "_"