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

59 lines
1.4 KiB
D
Raw Normal View History

2011-06-02 19:59:00 +00:00
module psyc.render;
import psyc.packet;
2011-06-12 11:13:17 +00:00
extern (C):
2011-06-02 19:59:00 +00:00
/*
* All rendering functions and the definitions they use are defined here.
*/
/**
* Return codes for psyc_render.
*/
enum RenderRC
{
/// Error, method is missing, but data is present.
ERROR_METHOD_MISSING = -3,
/// Error, a modifier name is missing.
ERROR_MODIFIER_NAME_MISSING = -2,
/// Error, buffer is too small to render the packet.
ERROR = -1,
/// Packet is rendered successfully in the buffer.
SUCCESS = 0,
} ;
/**
2011-10-31 19:04:16 +00:00
* Return codes for psyc_render_list.
2011-06-02 19:59:00 +00:00
*/
enum RenderListRC
{
/// Error, buffer is too small to render the list.
ERROR = -1,
/// List is rendered successfully in the buffer.
SUCCESS = 0,
};
/**
* Render a PSYC packet into a buffer.
*
* The packet structure should contain the packet parts, either routing, entity,
* method & data, or routing & content when rendering raw content.
* It should also contain the contentLength & total length of the packet,
2011-10-31 19:04:16 +00:00
* you can use psyc_packet_length_set() for calculating & setting these values.
2011-06-02 19:59:00 +00:00
* This function renders packet->length bytes to the buffer,
* if buflen is less than that an error is returned.
*
2011-11-03 13:27:01 +00:00
* @see psyc_packet_init()
* @see psyc_packet_init_raw()
* @see psyc_packet_length_set()
2011-06-02 19:59:00 +00:00
*/
RenderRC psyc_render (Packet *packet, ubyte *buffer, size_t buflen);
2011-06-02 19:59:00 +00:00
/**
* Render a PSYC list into a buffer.
*/
2011-10-31 19:04:16 +00:00
RenderListRC psyc_render_list (List *list, ubyte *buffer, size_t buflen);
2011-06-02 19:59:00 +00:00