OSSP CVS Repository

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

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

   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>

struct xds_ctx;

typedef int (*xds_fmt_cb_t)(struct xds_ctx* context,
			    void* fmt_context,
			    char* buf, size_t buf_size,
			    va_list val);

struct fmt_cb
    {
    char*          name;
    xds_fmt_cb_t   callback;
    void*          fmt_context;
    };

struct xds_ctx
    {
    struct fmt_cb* formatters;
    };
typedef struct xds_ctx xds_ctx_t;

xds_ctx_t*  xds_init(void);
void        xds_destroy(xds_ctx_t* context);

int xds_register(xds_ctx_t* context,
		 const char* name, xds_fmt_cb_t callback,
		 void* formatter_context);
int xds_unregister(xds_ctx_t* context, const char* name);

int xds_encode(xds_ctx_t* context, char* buf, size_t buf_size, const char* fmt, ...);
char* xds_aencode(xds_ctx_t* context, const char* fmt, ...);

int xds_decode(xds_ctx_t* context, const char* buf, const char* fmt, ...);

#endif /* !defined(__LIBXDS_H__) */

CVSTrac 2.0.1