mirror of
git://git.psyc.eu/libpsyc
synced 2024-08-15 03:19:02 +00:00
RenderHeader
This commit is contained in:
parent
9fd39c72a1
commit
893a318b82
5 changed files with 90 additions and 14 deletions
|
@ -1,3 +1,5 @@
|
|||
#include "syntax.h"
|
||||
|
||||
/**
|
||||
* Struct for keeping render state.
|
||||
*/
|
||||
|
@ -6,25 +8,28 @@ typedef enum {
|
|||
PSYC_NEED_LENGTH = 1
|
||||
} PSYC_RenderFlag;
|
||||
|
||||
typedef enum {
|
||||
PSYC_FLAG_ROUTING = 1
|
||||
} PSYC_RenderHeaderFlag;
|
||||
|
||||
typedef struct {
|
||||
PSYC_RenderFlag flag; ///< flags for the renderer
|
||||
PSYC_Part part; ///< part of the packet being rendered
|
||||
size_t cursor; ///< current position in buffer
|
||||
size_t start; ///< position where the rendered packet starts
|
||||
size_t spot; ///< space for rendered length between the headers
|
||||
size_t contentLength; ///< length of the content part
|
||||
size_t length; ///< how big is the buffer we allocated
|
||||
uint8_t buffer[]; ///< OMG a C99 feature! variable size buffer!
|
||||
char 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 uint8_t flags, const uint8_t modifier);
|
||||
const char* name, size_t nlength,
|
||||
const char* value, size_t vlength,
|
||||
PSYC_RenderHeaderFlag flags, char modifier);
|
||||
|
||||
int PSYC_renderBody(PSYC_RenderState* render,
|
||||
const uint8_t* method, const size_t mlength,
|
||||
const uint8_t* data, const size_t dlength,
|
||||
const uint8_t flags);
|
||||
const char* method, size_t mlength,
|
||||
const char* data, size_t dlength);
|
||||
|
||||
int PSYC_doneRender(PSYC_RenderState* render,
|
||||
uint8_t** buf, size_t* written);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue