OSSP CVS Repository

ossp - ossp-pkg/xds/xds.h 1.9
Not logged in
[Honeypot]  [Browse]  [Directory]  [Home]  [Login
[Reports]  [Search]  [Ticket]  [Timeline
  [Raw

ossp-pkg/xds/xds.h 1.9
/*
   $Source: /v/ossp/cvs/ossp-pkg/xds/Attic/xds.h,v $
   $Revision: 1.9 $

   Copyright (c) 2001 by Cable & Wireless Deutschland.

   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 distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   included license for more details.
*/

#ifndef __LIBXDS_H__
#define __LIBXDS_H__

#include <stdlib.h>
#include <stdarg.h>

enum
    {
    XDS_OK = 0,
    XDS_ERR_NO_MEM = -1,
    XDS_ERR_OVERFLOW = -2,
    XDS_ERR_INVALID_ARG = -3,
    XDS_ERR_TYPE_MISMATCH = -4
    };
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_size);
int xds_getbuffer(xds_t* xds, xds_scope_t flag, void** buffer, size_t* buffer_size);

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);

#endif /* !defined(__LIBXDS_H__) */

CVSTrac 2.0.1