OSSP CVS Repository

ossp - Check-in [4128]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4128
Date: 2001-Jun-28 16:42:06 (local)
2001-Jun-28 14:42:06 (UTC)
User:simons
Branch:
Comment: Revised the interface after reviewing it with RSE.
Tickets:
Inspections:
Files:
ossp-pkg/xds/xds.h      1.2 -> 1.3     31 inserted, 22 deleted

ossp-pkg/xds/xds.h 1.2 -> 1.3

--- xds.h        2001/06/28 12:42:10     1.2
+++ xds.h        2001/06/28 14:42:06     1.3
@@ -1,6 +1,6 @@
 /*
    $Source: /v/ossp/cvs/ossp-pkg/xds/Attic/xds.h,v $
-   $Revision: 1.2 $
+   $Revision: 1.3 $
 
    Copyright (c) 2001 by Cable & Wireless Deutschland.
 
@@ -19,30 +19,39 @@
 #define __LIBXDS_H__
 
 #include <stdlib.h>
+#include <stdarg.h>
 
-typedef int (*xds_formatter_cb)(char* buf, size_t buf_size, void* val);
-typedef struct
+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_formatter_cb callback;
-    }
-xds_formatter_cb_desc;
+    char*          name;
+    xds_fmt_cb_t   callback;
+    void*          fmt_context;
+    };
 
-typedef struct
+struct xds_ctx
     {
-    xds_formatter_cb_desc* formatters;
-    size_t formatters_size;
-    }
-xds_ctx;
-
-xds_ctx* xds_init(void);
-void     xds_destroy(xds_ctx* context);
-
-int xds_register(xds_ctx* context, const char* name, xds_formatter_cb callback);
-int xds_vregister(xds_ctx* context, const xds_formatter_cb_desc* callbacks, size_t size);
-
-int xds_mashal(xds_ctx* context, const char* fmt, ...);
-int xds_snmashal(xds_ctx* context, char* buf, size_t buf_size, const char* fmt, ...);
-int xds_amashal(xds_ctx* context, char** buf_p, size_t buf_size, const char* fmt, ...);
+    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