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

31 lines
1.1 KiB
C
Raw Normal View History

/**
* Struct for keeping render state.
*/
2011-04-20 20:22:55 +00:00
typedef enum {
PSYC_FINE = 0,
PSYC_NEED_LENGTH = 1
} PSYC_RenderFlag;
typedef struct {
PSYC_RenderFlag flag; ///< flags for the renderer
PSYC_Part part; ///< part of the packet being rendered
2011-04-20 20:22:55 +00:00
size_t cursor; ///< current position in buffer
size_t start; ///< position where the rendered packet starts
size_t contentLength; ///< length of the content part
2011-04-20 20:22:55 +00:00
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,
2011-04-18 14:54:56 +00:00
const uint8_t* name, const size_t nlength,
const uint8_t* value, const size_t vlength,
2011-04-20 20:22:55 +00:00
const uint8_t flags, const uint8_t modifier);
2011-04-18 14:54:56 +00:00
int PSYC_renderBody(PSYC_RenderState* render,
2011-04-18 14:54:56 +00:00
const uint8_t* method, const size_t mlength,
const uint8_t* data, const size_t dlength,
2011-04-20 20:22:55 +00:00
const uint8_t flags);
2011-04-18 14:54:56 +00:00
int PSYC_doneRender(PSYC_RenderState* render,
2011-04-18 14:54:56 +00:00
uint8_t** buf, size_t* written);