/* XDS - OSSP Extensible Data Serialization Library Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) This file is part of OSSP XDS, an extensible data serialization library which can be found at http://www.ossp.com/pkg/xds/. Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. xds.h: C API */ #ifndef __LIBXDS_H__ #define __LIBXDS_H__ #include #include enum { XDS_OK = 0, XDS_ERR_NO_MEM = -1, XDS_ERR_OVERFLOW = -2, XDS_ERR_INVALID_ARG = -3, XDS_ERR_TYPE_MISMATCH = -4, XDS_ERR_UNKNOWN_ENGINE = -5, XDS_ERR_INVALID_MODE = -6, XDS_ERR_UNDERFLOW = -7 }; typedef enum { XDS_ENCODE, XDS_DECODE } xds_mode_t; typedef enum { XDS_LOAN, XDS_GIFT } xds_scope_t; struct xds_context; typedef struct xds_context xds_t; typedef int (*xds_engine_t)(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args); xds_t* xds_init(xds_mode_t); void xds_destroy(xds_t* xds); int xds_register(xds_t* xds, const char* name, xds_engine_t engine, void* engine_context); int xds_unregister(xds_t* xds, const char* name); int xds_setbuffer(xds_t* xds, xds_scope_t flag, void* buffer, size_t buffer_len); int xds_getbuffer(xds_t* xds, xds_scope_t flag, void** buffer, size_t* buffer_len); int xds_encode(xds_t* xds, const char* fmt, ...); int xds_decode(xds_t* xds, const char* fmt, ...); int xds_vencode(xds_t* xds, const char* fmt, va_list args); int xds_vdecode(xds_t* xds, const char* fmt, va_list args); int xdr_encode_uint32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args); int xdr_encode_int32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args); #endif /* !defined(__LIBXDS_H__) */