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

69 lines
1.7 KiB
C
Raw Normal View History

2011-04-22 15:09:32 +00:00
#ifndef PSYC_RENDER_H
2011-11-11 21:18:24 +00:00
#define PSYC_RENDER_H
2011-04-22 15:09:32 +00:00
2011-11-30 12:51:50 +00:00
#include "packet.h"
2011-04-25 21:14:22 +00:00
/**
* @file psyc/render.h
* @brief Interface for PSYC packet rendering.
*
2011-05-09 12:37:57 +00:00
* All rendering functions and the definitions they use are defined here.
2011-04-25 21:14:22 +00:00
*/
2011-04-22 09:50:13 +00:00
2011-04-25 21:14:22 +00:00
/**
2011-05-03 23:30:09 +00:00
* @defgroup render Rendering Functions
2011-04-25 21:14:22 +00:00
*
* This module contains all rendering functions.
* @{
*/
/**
* Return codes for psyc_render.
2011-04-25 21:14:22 +00:00
*/
2011-11-11 21:18:24 +00:00
typedef enum {
/// Error, method is missing, but data is present.
PSYC_RENDER_ERROR_METHOD_MISSING = -3,
/// Error, a modifier name is missing.
PSYC_RENDER_ERROR_MODIFIER_NAME_MISSING = -2,
/// Error, buffer is too small to render the packet.
PSYC_RENDER_ERROR = -1,
/// Packet is rendered successfully in the buffer.
PSYC_RENDER_SUCCESS = 0,
2011-10-31 19:26:47 +00:00
} PsycRenderRC;
2011-04-25 21:14:22 +00:00
/**
* Render a PSYC packet into a buffer.
2011-05-09 14:32:39 +00:00
*
* 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-05-09 14:56:26 +00:00
* This function renders packet->length bytes to the buffer,
* if buflen is less than that an error is returned.
2011-05-09 14:32:39 +00:00
*
2011-11-03 13:27:01 +00:00
* @see psyc_packet_init()
* @see psyc_packet_init_raw()
* @see psyc_packet_length_set()
2011-04-25 21:14:22 +00:00
*/
#ifdef __INLINE_PSYC_RENDER
static inline
#endif
2011-11-11 21:18:24 +00:00
PsycRenderRC
psyc_render (PsycPacket *packet, char *buffer, size_t buflen);
2011-04-25 21:14:22 +00:00
2011-04-26 15:23:06 +00:00
/**
* Render a PSYC list into a buffer.
*/
#ifdef __INLINE_PSYC_RENDER
static inline
#endif
2011-11-26 14:03:10 +00:00
PsycRenderRC
2011-11-11 21:18:24 +00:00
psyc_render_list (PsycList *list, char *buffer, size_t buflen);
2011-04-26 15:23:06 +00:00
2011-11-26 14:03:10 +00:00
PsycRenderRC
psyc_render_table (PsycTable *table, char *buffer, size_t buflen);
2011-05-09 12:37:57 +00:00
/** @} */ // end of render group
2011-05-09 07:02:15 +00:00
#endif