📄 bionet-nxio.h
字号:
#ifndef __BIONET_NXIO_H#define __BIONET_NXIO_H#include <stdint.h>#include <sys/time.h>#include <libxml/tree.h>// nxio's glib log domain#define NXIO_LOG_DOMAIN "nxio"#undef NXIO_DEBUG// #define NXIO_DEBUG// // The NXIO header looks like this://// uint32_t Size_of_payload; // network byte order (big-endian)// uint8_t Packet_type; // 0x00 for XML, the rest are undefined//#define NXIO_MAX_MESSAGE_SIZE (256 * 1024)#define NXIO_HEADER_SIZE (5)//// a Network XML I/O framing system//typedef struct { int socket; char in_buffer[NXIO_MAX_MESSAGE_SIZE]; int in_index; // used by the nxio functions to handle DTD validation of XML messages xmlDtd *in_dtd; xmlValidCtxt *in_validation_context; char out_buffer[NXIO_MAX_MESSAGE_SIZE]; int out_index;} bionet_nxio_t;#define NXIO_CLOSE (-1)#define NXIO_INVALID_XML (-2)//// NAME: bionet_nxio_read()//// FUNCTION: Reads up to one XML document, DTD validates it (if the nxio// has a DTD), and returns it.//// ARGUMENTS: The nxio object to read on, the timeout (in seconds), and// a place to put the resulting XML document, if any.//// RETURNS: 0 on success, in which case *xml may point to a document or// to NULL (if the message was not fully received yet).// // NXIO_CLOSE on read error, socket is now invalid and should// be closed by the caller.//// NXIO_INVALID_XML if a frame was received but contained an// invalid XML document.////int bionet_nxio_read(bionet_nxio_t *nxio, struct timeval *timeout, xmlDoc **xml);int bionet_nxio_read_acceptable(bionet_nxio_t *nxio, struct timeval *timeout, xmlDoc **xml, const char **acceptable, GSList **queue);// nxio outint bionet_nxio_send(bionet_nxio_t *nxio, const char *fmt, ...);int bionet_nxio_append(bionet_nxio_t *nxio, const char *fmt, ...);int bionet_nxio_flush(bionet_nxio_t *nxio);// nxio miscbionet_nxio_t *bionet_nxio_new(const char *dtd_document);void bionet_nxio_free(bionet_nxio_t *nxio);int bionet_nxio_init(bionet_nxio_t *nxio, const char *dtd_document);void bionet_nxio_reset(bionet_nxio_t *nxio);#endif // __BIONET_NXIO_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -