OSSP CVS Repository

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

Check-in Number: 550
Date: 2001-Jul-20 12:56:01 (local)
2001-Jul-20 10:56:01 (UTC)
User:simons
Branch:
Comment: Use xds_(u)int(8|16|32|64) instead of the system defines.
Tickets:
Inspections:
Files:
ossp-pkg/xds/configure.ac      1.1 -> 1.2     13 inserted, 1 deleted
ossp-pkg/xds/regression-tests/xdr-int32.c      added-> 1.4
ossp-pkg/xds/regression-tests/xdr-int64.c      added-> 1.4
ossp-pkg/xds/regression-tests/xdr-uint32.c      added-> 1.5
ossp-pkg/xds/regression-tests/xdr-uint64.c      added-> 1.5
ossp-pkg/xds/regression-tests/xds-mystruct.c      added-> 1.3
ossp-pkg/xds/xdr-decode-int32.c      added-> 1.2
ossp-pkg/xds/xdr-decode-int64.c      added-> 1.2
ossp-pkg/xds/xdr-decode-octetstream.c      added-> 1.2
ossp-pkg/xds/xdr-decode-string.c      added-> 1.2
ossp-pkg/xds/xdr-decode-uint32.c      added-> 1.2
ossp-pkg/xds/xdr-decode-uint64.c      added-> 1.2
ossp-pkg/xds/xdr-encode-int32.c      added-> 1.2
ossp-pkg/xds/xdr-encode-int64.c      added-> 1.2
ossp-pkg/xds/xdr-encode-octetstream.c      added-> 1.3
ossp-pkg/xds/xdr-encode-string.c      added-> 1.3
ossp-pkg/xds/xdr-encode-uint32.c      added-> 1.2
ossp-pkg/xds/xdr-encode-uint64.c      added-> 1.2
ossp-pkg/xds/xds.h.in      1.1 -> 1.2     2 inserted, 0 deleted

ossp-pkg/xds/configure.ac 1.1 -> 1.2

--- configure.ac 2001/07/20 10:42:34     1.1
+++ configure.ac 2001/07/20 10:56:01     1.2
@@ -1,6 +1,6 @@
 dnl configure.in -- Process this file with autoconf to produce a configure script.
 
-AC_INIT(libxds, [$Revision: 1.1 $])
+AC_INIT(libxds, [$Revision: 1.2 $])
 
 dnl Get rid of the lousy -g and -O defaults in CFLAGS.
 dnl
@@ -37,6 +37,12 @@
                             )]
              )
 AC_SUBST([xds_uint32_t])
+AC_CHECK_TYPE(u_int64_t, [xds_uint64_t=u_int64_t],
+              [AC_CHECK_TYPE(uint64_t, [xds_uint64_t=uint64_t],
+                             [AC_MSG_ERROR([no unsigned 64 bit data type found])]
+                            )]
+             )
+AC_SUBST([xds_uint64_t])
 AC_CHECK_TYPE(int8_t, [xds_int8_t=int8_t],
               [AC_CHECK_TYPE(int8_t, [xds_int8_t=int8_t],
                              [AC_MSG_ERROR([no signed 8 bit data type found])]
@@ -55,6 +61,12 @@
                             )]
              )
 AC_SUBST([xds_int32_t])
+AC_CHECK_TYPE(int64_t, [xds_int64_t=int64_t],
+              [AC_CHECK_TYPE(int64_t, [xds_int64_t=int64_t],
+                             [AC_MSG_ERROR([no signed 64 bit data type found])]
+                            )]
+             )
+AC_SUBST([xds_int64_t])
 
 dnl Write results.
 dnl


ossp-pkg/xds/regression-tests/xdr-int32.c -> 1.4

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,144 ----
+ /*
+    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.
+ */
+ 
+ #include <stdio.h>
+ #include <string.h>
+ #include <rpc/types.h>
+ #include <rpc/xdr.h>
+ #include "../internal.h"
+ 
+ int main()
+     {
+     XDR    xdrs;
+     char   xdr_buf[1024];
+     size_t xdr_buf_size;
+ 
+     xds_t* xds;
+     char*  xds_buf;
+     size_t xds_buf_size;
+ 
+     xds_int32_t values[] =
+        {
+         0x00000000,
+         0x12345678,
+        -0x12345678,
+         0xabcdef01,
+        -0xabcdef01,
+         0x7fffffff
+        };
+ 
+     size_t i;
+ 
+     /* Encode the values array using the RPC-XDR implementation. */
+ 
+     xdrmem_create(&xdrs, xdr_buf, sizeof(xdr_buf), XDR_ENCODE);
+     for (i = 0; i < sizeof(values)/sizeof(xds_int32_t); ++i)
+        xdr_int32_t(&xdrs, &values[i]);
+     xdr_buf_size = xdr_getpos(&xdrs);
+     xdr_destroy(&xdrs);
+ 
+     /* Encode the values array using the XDS implementation. */
+ 
+     xds = xds_init(XDS_ENCODE);
+     if (xds == NULL)
+        {
+        printf("Failed to initialize XDS context.\n");
+        return 1;
+        }
+     if (xds_register(xds, "int", &xdr_encode_int32, NULL) != XDS_OK)
+        {
+        printf("Failed to register my encoding engines.\n");
+        return 1;
+        }
+     for (i = 0; i < sizeof(values)/sizeof(xds_int32_t); ++i)
+        {
+        if (xds_encode(xds, "int", values[i]) != XDS_OK)
+            {
+            printf("xds_encode(values[%d]) failed!\n", i);
+            return 1;
+            }
+        }
+     if (xds_getbuffer(xds, XDS_GIFT, (void**)&xds_buf, &xds_buf_size) != XDS_OK)
+        {
+        printf("getbuffer() failed.\n");
+        return 1;
+        }
+     xds_destroy(xds);
+ 
+     /* Both buffers must be equal now. */
+ 
+     if (xdr_buf_size != xds_buf_size)
+        {
+        printf("The buffer sizes don't match: %d != %d.\n", xdr_buf_size, xds_buf_size);
+        return 1;
+        }
+     if (memcmp(xds_buf, xdr_buf, xds_buf_size) != 0)
+        {
+        printf("The buffers' contents is not identical!\n");
+        return 1;
+        }
+ 
+     /* Now we decode the values again using the XDS implementation and
+        compare them to our original values. Obviously, they should not
+        differ. */
+ 
+     xds = xds_init(XDS_DECODE);
+     if (xds == NULL)
+        {
+        printf("Failed to initialize XDS context.\n");
+        return 1;
+        }
+     if (xds_register(xds, "int", &xdr_decode_int32, NULL) != XDS_OK)
+        {
+        printf("Failed to register my decoding engines.\n");
+        return 1;
+        }
+     if (xds_setbuffer(xds, XDS_GIFT, xds_buf, xds_buf_size) != XDS_OK)
+        {
+        printf("setbuffer() failed.\n");
+        return 1;
+        }
+     for (i = 0; i < sizeof(values)/sizeof(xds_int32_t); ++i)
+        {
+        xds_int32_t tmp;
+        if (xds_decode(xds, "int", &tmp) != XDS_OK)
+            {
+            printf("xds_encode() failed for the %d value!\n", i);
+            return 1;
+            }
+        if (values[i] != tmp)
+            {
+            printf("The %dth value has not been decoded correctly!\n", i);
+            return 1;
+            }
+        }
+     xds_destroy(xds);
+ 
+     /* Everything went fine. */
+ 
+     return 0;
+     }


ossp-pkg/xds/regression-tests/xdr-int64.c -> 1.4

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,144 ----
+ /*
+    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.
+ */
+ 
+ #include <stdio.h>
+ #include <string.h>
+ #include <rpc/types.h>
+ #include <rpc/xdr.h>
+ #include "../internal.h"
+ 
+ int main()
+     {
+     XDR    xdrs;
+     char   xdr_buf[1024];
+     size_t xdr_buf_size;
+ 
+     xds_t* xds;
+     char*  xds_buf;
+     size_t xds_buf_size;
+ 
+     xds_int64_t values[] =
+        {
+         0x0000000000000000LL,
+         0x123456789abcdef0LL,
+        -0x123456789abcdef0LL,
+         0xabcdef01cc45bb9aLL,
+        -0xabcdef01cc45bb9aLL,
+         0x7fffffffffffffffLL
+        };
+ 
+     size_t i;
+ 
+     /* Encode the values array using the RPC-XDR implementation. */
+ 
+     xdrmem_create(&xdrs, xdr_buf, sizeof(xdr_buf), XDR_ENCODE);
+     for (i = 0; i < sizeof(values)/sizeof(xds_int64_t); ++i)
+        xdr_int64_t(&xdrs, &values[i]);
+     xdr_buf_size = xdr_getpos(&xdrs);
+     xdr_destroy(&xdrs);
+ 
+     /* Encode the values array using the XDS implementation. */
+ 
+     xds = xds_init(XDS_ENCODE);
+     if (xds == NULL)
+        {
+        printf("Failed to initialize XDS context.\n");
+        return 1;
+        }
+     if (xds_register(xds, "int", &xdr_encode_int64, NULL) != XDS_OK)
+        {
+        printf("Failed to register my encoding engines.\n");
+        return 1;
+        }
+     for (i = 0; i < sizeof(values)/sizeof(xds_int64_t); ++i)
+        {
+        if (xds_encode(xds, "int", values[i]) != XDS_OK)
+            {
+            printf("xds_encode(values[%d]) failed!\n", i);
+            return 1;
+            }
+        }
+     if (xds_getbuffer(xds, XDS_GIFT, (void**)&xds_buf, &xds_buf_size) != XDS_OK)
+        {
+        printf("getbuffer() failed.\n");
+        return 1;
+        }
+     xds_destroy(xds);
+ 
+     /* Both buffers must be equal now. */
+ 
+     if (xdr_buf_size != xds_buf_size)
+        {
+        printf("The buffer sizes don't match: %d != %d.\n", xdr_buf_size, xds_buf_size);
+        return 1;
+        }
+     if (memcmp(xds_buf, xdr_buf, xds_buf_size) != 0)
+        {
+        printf("The buffers' contents is not identical!\n");
+        return 1;
+        }
+ 
+     /* Now we decode the values again using the XDS implementation and
+        compare them to our original values. Obviously, they should not
+        differ. */
+ 
+     xds = xds_init(XDS_DECODE);
+     if (xds == NULL)
+        {
+        printf("Failed to initialize XDS context.\n");
+        return 1;
+        }
+     if (xds_register(xds, "int", &xdr_decode_int64, NULL) != XDS_OK)
+        {
+        printf("Failed to register my decoding engines.\n");
+        return 1;
+        }
+     if (xds_setbuffer(xds, XDS_GIFT, xds_buf, xds_buf_size) != XDS_OK)
+        {
+        printf("setbuffer() failed.\n");
+        return 1;
+        }
+     for (i = 0; i < sizeof(values)/sizeof(xds_int64_t); ++i)
+        {
+        xds_int64_t tmp;
+        if (xds_decode(xds, "int", &tmp) != XDS_OK)
+            {
+            printf("xds_encode() failed for the %d value!\n", i);
+            return 1;
+            }
+        if (values[i] != tmp)
+            {
+            printf("The %dth value has not been decoded correctly!\n", i);
+            return 1;
+            }
+        }
+     xds_destroy(xds);
+ 
+     /* Everything went fine. */
+ 
+     return 0;
+     }


ossp-pkg/xds/regression-tests/xdr-uint32.c -> 1.5

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,150 ----
+ /*
+    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.
+ */
+ 
+ #include <stdio.h>
+ #include <string.h>
+ #include <rpc/types.h>
+ #include <rpc/xdr.h>
+ #include "../internal.h"
+ 
+ #ifdef __FreeBSD__
+ static int xdr_uint32_t(XDR *xdrs, uint32_t *val)
+     {
+     return xdr_u_int32_t(xdrs, val);
+     }
+ #endif
+ 
+ int main()
+     {
+     XDR    xdrs;
+     char   xdr_buf[1024];
+     size_t xdr_buf_size;
+ 
+     xds_t* xds;
+     char*  xds_buf;
+     size_t xds_buf_size;
+ 
+     xds_uint32_t values[] =
+        {
+        0x00000000,
+        0x12345678,
+        0xabcdef01,
+        0xc500b3ef,
+        0xffffffff
+        };
+ 
+     size_t i;
+ 
+     /* Encode the values array using the RPC-XDR implementation. */
+ 
+     xdrmem_create(&xdrs, xdr_buf, sizeof(xdr_buf), XDR_ENCODE);
+     for (i = 0; i < sizeof(values)/sizeof(xds_uint32_t); ++i)
+        xdr_uint32_t(&xdrs, &values[i]);
+     xdr_buf_size = xdr_getpos(&xdrs);
+     xdr_destroy(&xdrs);
+ 
+     /* Encode the values array using the XDS implementation. */
+ 
+     xds = xds_init(XDS_ENCODE);
+     if (xds == NULL)
+        {
+        printf("Failed to initialize XDS context.\n");
+        return 1;
+        }
+     if (xds_register(xds, "uint", &xdr_encode_uint32, NULL) != XDS_OK)
+        {
+        printf("Failed to register my encoding engines.\n");
+        return 1;
+        }
+     for (i = 0; i < sizeof(values)/sizeof(uint32_t); ++i)
+        {
+        if (xds_encode(xds, "uint", values[i]) != XDS_OK)
+            {
+            printf("xds_encode(values[%d]) failed!\n", i);
+            return 1;
+            }
+        }
+     if (xds_getbuffer(xds, XDS_GIFT, (void**)&xds_buf, &xds_buf_size) != XDS_OK)
+        {
+        printf("getbuffer() failed.\n");
+        return 1;
+        }
+     xds_destroy(xds);
+ 
+     /* Both buffers must be equal now. */
+ 
+     if (xdr_buf_size != xds_buf_size)
+        {
+        printf("The buffer sizes don't match: %d != %d.\n", xdr_buf_size, xds_buf_size);
+        return 1;
+        }
+     if (memcmp(xds_buf, xdr_buf, xds_buf_size) != 0)
+        {
+        printf("The buffers' contents is not identical!\n");
+        return 1;
+        }
+ 
+     /* Now we decode the values again using the XDS implementation and
+        compare them to our original values. Obviously, they should not
+        differ. */
+ 
+     xds = xds_init(XDS_DECODE);
+     if (xds == NULL)
+        {
+        printf("Failed to initialize XDS context.\n");
+        return 1;
+        }
+     if (xds_register(xds, "uint", &xdr_decode_uint32, NULL) != XDS_OK)
+        {
+        printf("Failed to register my decoding engines.\n");
+        return 1;
+        }
+     if (xds_setbuffer(xds, XDS_GIFT, xds_buf, xds_buf_size) != XDS_OK)
+        {
+        printf("setbuffer() failed.\n");
+        return 1;
+        }
+     for (i = 0; i < sizeof(values)/sizeof(xds_uint32_t); ++i)
+        {
+        xds_uint32_t tmp;
+        if (xds_decode(xds, "uint", &tmp) != XDS_OK)
+            {
+            printf("xds_encode() failed for the %d value!\n", i);
+            return 1;
+            }
+        if (values[i] != tmp)
+            {
+            printf("The %dth value has not been decoded correctly!\n", i);
+            return 1;
+            }
+        }
+     xds_destroy(xds);
+ 
+     /* Everything went fine. */
+ 
+     return 0;
+     }


ossp-pkg/xds/regression-tests/xdr-uint64.c -> 1.5

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,150 ----
+ /*
+    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.
+ */
+ 
+ #include <stdio.h>
+ #include <string.h>
+ #include <rpc/types.h>
+ #include <rpc/xdr.h>
+ #include "../internal.h"
+ 
+ #ifdef __FreeBSD__
+ static int xdr_uint64_t(XDR *xdrs, uint64_t *val)
+     {
+     return xdr_u_int64_t(xdrs, val);
+     }
+ #endif
+ 
+ int main()
+     {
+     XDR    xdrs;
+     char   xdr_buf[1024];
+     size_t xdr_buf_size;
+ 
+     xds_t* xds;
+     char*  xds_buf;
+     size_t xds_buf_size;
+ 
+     xds_uint64_t values[] =
+        {
+        0x0000000000000000ULL,
+        0x123456789abcdef0ULL,
+        0xabcdef01cc45bb9aULL,
+        0xc500b3efdd34ca9eULL,
+        0xffffffffffffffffULL
+        };
+ 
+     size_t i;
+ 
+     /* Encode the values array using the RPC-XDR implementation. */
+ 
+     xdrmem_create(&xdrs, xdr_buf, sizeof(xdr_buf), XDR_ENCODE);
+     for (i = 0; i < sizeof(values)/sizeof(xds_uint64_t); ++i)
+        xdr_uint64_t(&xdrs, &values[i]);
+     xdr_buf_size = xdr_getpos(&xdrs);
+     xdr_destroy(&xdrs);
+ 
+     /* Encode the values array using the XDS implementation. */
+ 
+     xds = xds_init(XDS_ENCODE);
+     if (xds == NULL)
+        {
+        printf("Failed to initialize XDS context.\n");
+        return 1;
+        }
+     if (xds_register(xds, "uint", &xdr_encode_uint64, NULL) != XDS_OK)
+        {
+        printf("Failed to register my encoding engines.\n");
+        return 1;
+        }
+     for (i = 0; i < sizeof(values)/sizeof(uint64_t); ++i)
+        {
+        if (xds_encode(xds, "uint", values[i]) != XDS_OK)
+            {
+            printf("xds_encode(values[%d]) failed!\n", i);
+            return 1;
+            }
+        }
+     if (xds_getbuffer(xds, XDS_GIFT, (void**)&xds_buf, &xds_buf_size) != XDS_OK)
+        {
+        printf("getbuffer() failed.\n");
+        return 1;
+        }
+     xds_destroy(xds);
+ 
+     /* Both buffers must be equal now. */
+ 
+     if (xdr_buf_size != xds_buf_size)
+        {
+        printf("The buffer sizes don't match: %d != %d.\n", xdr_buf_size, xds_buf_size);
+        return 1;
+        }
+     if (memcmp(xds_buf, xdr_buf, xds_buf_size) != 0)
+        {
+        printf("The buffers' contents is not identical!\n");
+        return 1;
+        }
+ 
+     /* Now we decode the values again using the XDS implementation and
+        compare them to our original values. Obviously, they should not
+        differ. */
+ 
+     xds = xds_init(XDS_DECODE);
+     if (xds == NULL)
+        {
+        printf("Failed to initialize XDS context.\n");
+        return 1;
+        }
+     if (xds_register(xds, "uint", &xdr_decode_uint64, NULL) != XDS_OK)
+        {
+        printf("Failed to register my decoding engines.\n");
+        return 1;
+        }
+     if (xds_setbuffer(xds, XDS_GIFT, xds_buf, xds_buf_size) != XDS_OK)
+        {
+        printf("setbuffer() failed.\n");
+        return 1;
+        }
+     for (i = 0; i < sizeof(values)/sizeof(xds_uint64_t); ++i)
+        {
+        xds_uint64_t tmp;
+        if (xds_decode(xds, "uint", &tmp) != XDS_OK)
+            {
+            printf("xds_encode() failed for the %d value!\n", i);
+            return 1;
+            }
+        if (values[i] != tmp)
+            {
+            printf("The %dth value has not been decoded correctly!\n", i);
+            return 1;
+            }
+        }
+     xds_destroy(xds);
+ 
+     /* Everything went fine. */
+ 
+     return 0;
+     }


ossp-pkg/xds/regression-tests/xds-mystruct.c -> 1.3

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,166 ----
+ /*
+    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.
+ */
+ 
+ #include <stdio.h>
+ #include <string.h>
+ #include <assert.h>
+ #include <sys/types.h>
+ #include "../internal.h"
+ 
+ struct mystruct
+     {
+     xds_int32_t   small;
+     xds_int64_t   big;
+     xds_uint32_t  positive;
+     };
+ 
+ static int encode_mystruct_engine(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     int rc;
+     struct mystruct* ms;
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(buffer_size != 0);
+     assert(args != NULL);
+ 
+     if (buffer_size >= sizeof(struct mystruct))
+        {
+        ms = va_arg(*args, struct mystruct*);
+        rc = xds_encode(xds, "int32 int64 uint32", ms->small, ms->big, ms->positive);
+        if (rc != XDS_OK)
+            return rc;
+        }
+     else
+        return sizeof(struct mystruct);
+ 
+     return 0;
+     }
+ 
+ static int decode_mystruct_engine(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     int rc;
+     struct mystruct* ms;
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(buffer_size != 0);
+     assert(args != NULL);
+ 
+     if (buffer_size >= sizeof(struct mystruct))
+        {
+        ms = va_arg(*args, struct mystruct*);
+        rc = xds_decode(xds, "int32 int64 uint32", &(ms->small), &(ms->big), &(ms->positive));
+        if (rc != XDS_OK)
+            return rc;
+        }
+     else
+        return XDS_ERR_UNDERFLOW;
+ 
+     return 0;
+     }
+ 
+ int main()
+     {
+     xds_t* xds;
+     char*  buffer;
+     size_t buffer_size;
+ 
+     struct mystruct ms, new_ms;
+     ms.small    = -0x1234567;
+     ms.big      = -0x1234567890abcdeLL;
+     ms.positive = 42;
+ 
+     /* Encode our copy of mystruct using our encoding callback. Then
+        get a the buffer and destroy the context again. */
+ 
+     xds = xds_init(XDS_ENCODE);
+     if (xds == NULL)
+        {
+        printf("Failed to initialize XDS context.\n");
+        return 1;
+        }
+     if (xds_register(xds, "mystruct", &encode_mystruct_engine, NULL) != XDS_OK ||
+        xds_register(xds, "int32", &xdr_encode_int32, NULL) != XDS_OK ||
+        xds_register(xds, "int64", &xdr_encode_int64, NULL) != XDS_OK ||
+        xds_register(xds, "uint32", &xdr_encode_uint32, NULL) != XDS_OK)
+        {
+        printf("Failed to register my encoding engines.\n");
+        return 1;
+        }
+     if (xds_encode(xds, "mystruct", &ms) != XDS_OK)
+        {
+        printf("xds_encode() failed!\n");
+        return 1;
+        }
+     if (xds_getbuffer(xds, XDS_GIFT, (void**)&buffer, &buffer_size) != XDS_OK)
+        {
+        printf("xds_setbuffer() failed!\n");
+        return 1;
+        }
+     xds_destroy(xds);
+ 
+     /* Now create a decoding context and decode the whole thing again. */
+ 
+     xds = xds_init(XDS_DECODE);
+     if (xds == NULL)
+        {
+        printf("Failed to initialize XDS context.\n");
+        return 1;
+        }
+     if (xds_register(xds, "mystruct", &decode_mystruct_engine, NULL) != XDS_OK ||
+        xds_register(xds, "int32", &xdr_decode_int32, NULL) != XDS_OK ||
+        xds_register(xds, "int64", &xdr_decode_int64, NULL) != XDS_OK ||
+        xds_register(xds, "uint32", &xdr_decode_uint32, NULL) != XDS_OK)
+        {
+        printf("Failed to register my decoding engines.\n");
+        return 1;
+        }
+     if (xds_setbuffer(xds, XDS_GIFT, buffer, buffer_size) != XDS_OK)
+        {
+        printf("xds_setbuffer() failed!\n");
+        return 1;
+        }
+     if (xds_decode(xds, "mystruct", &new_ms) != XDS_OK)
+        {
+        printf("xds_decode() failed!\n");
+        return 1;
+        }
+     xds_destroy(xds);
+ 
+     /* Both structures must be identical. */
+ 
+     if (memcmp(&ms, &new_ms, sizeof(struct mystruct)) != 0)
+        {
+        printf("Decoded data does not match the original!\n");
+        return 1;
+        }
+ 
+     /* Everything went fine. */
+ 
+     return 0;
+     }


ossp-pkg/xds/xdr-decode-int32.c -> 1.2

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,72 ----
+ /*
+    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.
+ */
+ 
+ #include <assert.h>
+ #include <sys/types.h>
+ #include "internal.h"
+ 
+ int xdr_decode_int32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     xds_int32_t*  value;
+     xds_uint32_t  tmp;
+ 
+     /* Consistency checks. */
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(args != NULL);
+     if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
+        return XDS_ERR_INVALID_ARG;
+     if (buffer_size < 4)
+        return XDS_ERR_UNDERFLOW;
+ 
+     /* Get value and format it into the buffer. */
+ 
+     value = va_arg(*args, xds_int32_t*);
+     assert(value != NULL);
+ 
+     if (((xds_uint8_t*)buffer)[0] & 0x80)
+        {                       /* negative number */
+        tmp  = ((xds_uint8_t*)buffer)[0]; tmp = tmp << 8;
+        tmp += ((xds_uint8_t*)buffer)[1]; tmp = tmp << 8;
+        tmp += ((xds_uint8_t*)buffer)[2]; tmp = tmp << 8;
+        tmp += ((xds_uint8_t*)buffer)[3];
+        tmp = 0 - tmp;
+        *value = 0 - (int32_t)tmp;
+        }
+     else
+        {                       /* positive number */
+        *value  = ((xds_uint8_t*)buffer)[0]; *value = *value << 8;
+        *value += ((xds_uint8_t*)buffer)[1]; *value = *value << 8;
+        *value += ((xds_uint8_t*)buffer)[2]; *value = *value << 8;
+        *value += ((xds_uint8_t*)buffer)[3];
+        }
+ 
+     /* Done. */
+ 
+     return 4;
+     }


ossp-pkg/xds/xdr-decode-int64.c -> 1.2

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,80 ----
+ /*
+    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.
+ */
+ 
+ #include <assert.h>
+ #include <sys/types.h>
+ #include "internal.h"
+ 
+ int xdr_decode_int64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     xds_int64_t*  value;
+     xds_uint64_t  tmp;
+ 
+     /* Consistency checks. */
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(args != NULL);
+     if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
+        return XDS_ERR_INVALID_ARG;
+     if (buffer_size < 8)
+        return XDS_ERR_UNDERFLOW;
+ 
+     /* Get value and format it into the buffer. */
+ 
+     value = va_arg(*args, xds_int64_t*);
+     assert(value != NULL);
+ 
+     if (((xds_uint8_t*)buffer)[0] & 0x80)
+        {                       /* negative number */
+        tmp  = ((xds_uint8_t*)buffer)[0]; tmp = tmp << 8;
+        tmp += ((xds_uint8_t*)buffer)[1]; tmp = tmp << 8;
+        tmp += ((xds_uint8_t*)buffer)[2]; tmp = tmp << 8;
+        tmp += ((xds_uint8_t*)buffer)[3]; tmp = tmp << 8;
+        tmp += ((xds_uint8_t*)buffer)[4]; tmp = tmp << 8;
+        tmp += ((xds_uint8_t*)buffer)[5]; tmp = tmp << 8;
+        tmp += ((xds_uint8_t*)buffer)[6]; tmp = tmp << 8;
+        tmp += ((xds_uint8_t*)buffer)[7];
+        tmp = 0 - tmp;
+        *value = 0 - (xds_int64_t)tmp;
+        }
+     else
+        {                       /* positive number */
+        *value  = ((xds_uint8_t*)buffer)[0]; *value = *value << 8;
+        *value += ((xds_uint8_t*)buffer)[1]; *value = *value << 8;
+        *value += ((xds_uint8_t*)buffer)[2]; *value = *value << 8;
+        *value += ((xds_uint8_t*)buffer)[3]; *value = *value << 8;
+        *value += ((xds_uint8_t*)buffer)[4]; *value = *value << 8;
+        *value += ((xds_uint8_t*)buffer)[5]; *value = *value << 8;
+        *value += ((xds_uint8_t*)buffer)[6]; *value = *value << 8;
+        *value += ((xds_uint8_t*)buffer)[7];
+        }
+ 
+     /* Done. */
+ 
+     return 8;
+     }


ossp-pkg/xds/xdr-decode-octetstream.c -> 1.2

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,89 ----
+ /*
+    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.
+ */
+ 
+ #include <string.h>
+ #include <assert.h>
+ #include <sys/types.h>
+ #include "internal.h"
+ 
+ int xdr_decode_octetstream(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     void**  p;
+     size_t* p_len;
+     size_t  padding;
+ 
+     /* Consistency checks. */
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(buffer_size != 0);
+     assert(args != NULL);
+     if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
+        return XDS_ERR_INVALID_ARG;
+ 
+     /* Get pointers from the stack. */
+ 
+     p     = va_arg(*args, void**);
+     p_len = va_arg(*args, size_t*);
+     assert(p != NULL);
+     assert(p_len != NULL);
+ 
+     /* Read the size of the message. */
+ 
+     if (buffer_size >= 4)
+        {
+        *p_len  = ((xds_uint8_t*)buffer)[0]; *p_len = *p_len << 8;
+        *p_len += ((xds_uint8_t*)buffer)[1]; *p_len = *p_len << 8;
+        *p_len += ((xds_uint8_t*)buffer)[2]; *p_len = *p_len << 8;
+        *p_len += ((xds_uint8_t*)buffer)[3];
+        }
+     else
+        return XDS_ERR_UNDERFLOW;
+ 
+     /* Calculate padding. */
+ 
+     padding = (4 - (*p_len & 0x03)) & 0x03;
+ 
+     /* Do we have enough data?. */
+ 
+     if (buffer_size < 4 + *p_len + padding)
+        return XDS_ERR_UNDERFLOW;
+ 
+     /* Allocate buffer for the data. */
+ 
+     *p = malloc(*p_len);
+     if (*p == NULL)
+        return XDS_ERR_NO_MEM;
+ 
+     /* Copy data into the buffer. */
+ 
+     memmove(*p, (xds_uint8_t*)buffer+4, *p_len);
+ 
+     /* Done. */
+ 
+     return 4 + *p_len + padding;
+     }


ossp-pkg/xds/xdr-decode-string.c -> 1.2

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,90 ----
+ /*
+    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.
+ */
+ 
+ #include <string.h>
+ #include <assert.h>
+ #include <sys/types.h>
+ #include "internal.h"
+ 
+ int xdr_decode_string(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     void**  p;
+     size_t* p_len;
+     size_t  padding;
+ 
+     /* Consistency checks. */
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(buffer_size != 0);
+     assert(args != NULL);
+     if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
+        return XDS_ERR_INVALID_ARG;
+ 
+     /* Get pointers from the stack. */
+ 
+     p     = va_arg(*args, void**);
+     p_len = va_arg(*args, size_t*);
+     assert(p != NULL);
+     assert(p_len != NULL);
+ 
+     /* Read the size of the message. */
+ 
+     if (buffer_size >= 4)
+        {
+        *p_len  = ((xds_uint8_t*)buffer)[0]; *p_len = *p_len << 8;
+        *p_len += ((xds_uint8_t*)buffer)[1]; *p_len = *p_len << 8;
+        *p_len += ((xds_uint8_t*)buffer)[2]; *p_len = *p_len << 8;
+        *p_len += ((xds_uint8_t*)buffer)[3];
+        }
+     else
+        return XDS_ERR_UNDERFLOW;
+ 
+     /* Calculate padding. */
+ 
+     padding = (4 - (*p_len & 0x03)) & 0x03;
+ 
+     /* Do we have enough data?. */
+ 
+     if (buffer_size < 4 + *p_len + padding)
+        return XDS_ERR_UNDERFLOW;
+ 
+     /* Allocate buffer for the data. */
+ 
+     *p = malloc(*p_len + 1);
+     if (*p == NULL)
+        return XDS_ERR_NO_MEM;
+ 
+     /* Copy data into the buffer. */
+ 
+     memmove(*p, (xds_uint8_t*)buffer+4, *p_len);
+     ((xds_uint8_t*)buffer)[4+*p_len] = '\0';
+ 
+     /* Done. */
+ 
+     return 4 + *p_len + padding;
+     }


ossp-pkg/xds/xdr-decode-uint32.c -> 1.2

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,59 ----
+ /*
+    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.
+ */
+ 
+ #include <assert.h>
+ #include <sys/types.h>
+ #include "internal.h"
+ 
+ int xdr_decode_uint32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     xds_uint32_t*  value;
+ 
+     /* Consistency checks. */
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(args != NULL);
+     if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
+        return XDS_ERR_INVALID_ARG;
+     if (buffer_size < 4)
+        return XDS_ERR_UNDERFLOW;
+ 
+     /* Get value and format it into the buffer. */
+ 
+     value = va_arg(*args, xds_uint32_t*);
+     assert(value != NULL);
+ 
+     *value  = ((xds_uint8_t*)buffer)[0]; *value = *value << 8;
+     *value += ((xds_uint8_t*)buffer)[1]; *value = *value << 8;
+     *value += ((xds_uint8_t*)buffer)[2]; *value = *value << 8;
+     *value += ((xds_uint8_t*)buffer)[3];
+ 
+     /* Done. */
+ 
+     return 4;
+     }


ossp-pkg/xds/xdr-decode-uint64.c -> 1.2

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,63 ----
+ /*
+    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.
+ */
+ 
+ #include <assert.h>
+ #include <sys/types.h>
+ #include "internal.h"
+ 
+ int xdr_decode_uint64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     xds_uint64_t*  value;
+ 
+     /* Consistency checks. */
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(args != NULL);
+     if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
+        return XDS_ERR_INVALID_ARG;
+     if (buffer_size < 8)
+        return XDS_ERR_UNDERFLOW;
+ 
+     /* Get value and format it into the buffer. */
+ 
+     value = va_arg(*args, xds_uint64_t*);
+     assert(value != NULL);
+ 
+     *value  = ((xds_uint8_t*)buffer)[0]; *value = *value << 8;
+     *value += ((xds_uint8_t*)buffer)[1]; *value = *value << 8;
+     *value += ((xds_uint8_t*)buffer)[2]; *value = *value << 8;
+     *value += ((xds_uint8_t*)buffer)[3]; *value = *value << 8;
+     *value += ((xds_uint8_t*)buffer)[4]; *value = *value << 8;
+     *value += ((xds_uint8_t*)buffer)[5]; *value = *value << 8;
+     *value += ((xds_uint8_t*)buffer)[6]; *value = *value << 8;
+     *value += ((xds_uint8_t*)buffer)[7];
+ 
+     /* Done. */
+ 
+     return 8;
+     }


ossp-pkg/xds/xdr-encode-int32.c -> 1.2

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,65 ----
+ /*
+    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.
+ */
+ 
+ #include <assert.h>
+ #include <sys/types.h>
+ #include "internal.h"
+ 
+ int xdr_encode_int32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     /* Consistency checks. */
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(buffer_size != 0);
+     assert(args != NULL);
+     if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
+        return XDS_ERR_INVALID_ARG;
+ 
+     /* Get value and format it into the buffer. */
+ 
+     if (buffer_size >= 4)
+        {
+        xds_uint32_t tmp;
+        xds_int32_t value = va_arg(*args, xds_uint32_t);
+        if (value < 0)
+            {
+            value = 0 - value;
+            tmp = 0 - (xds_uint32_t)value;
+            }
+        else
+            tmp = (xds_uint32_t)value;
+        ((xds_uint8_t*)buffer)[0] = (tmp >> 24) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[1] = (tmp >> 16) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[2] = (tmp >>  8) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[3] = (tmp >>  0) & 0x000000ff;
+        }
+ 
+     /* Done. */
+ 
+     return 4;
+     }


ossp-pkg/xds/xdr-encode-int64.c -> 1.2

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,69 ----
+ /*
+    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.
+ */
+ 
+ #include <assert.h>
+ #include <sys/types.h>
+ #include "internal.h"
+ 
+ int xdr_encode_int64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     /* Consistency checks. */
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(buffer_size != 0);
+     assert(args != NULL);
+     if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
+        return XDS_ERR_INVALID_ARG;
+ 
+     /* Get value and format it into the buffer. */
+ 
+     if (buffer_size >= 8)
+        {
+        xds_uint64_t tmp;
+        xds_int64_t  value = va_arg(*args, xds_uint64_t);
+        if (value < 0)
+            {
+            value = 0 - value;
+            tmp = 0 - (xds_uint64_t)value;
+            }
+        else
+            tmp = (xds_uint64_t)value;
+        ((xds_uint8_t*)buffer)[0] = (tmp >> 56) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[1] = (tmp >> 48) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[2] = (tmp >> 40) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[3] = (tmp >> 32) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[4] = (tmp >> 24) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[5] = (tmp >> 16) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[6] = (tmp >>  8) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[7] = (tmp >>  0) & 0x000000ff;
+        }
+ 
+     /* Done. */
+ 
+     return 8;
+     }


ossp-pkg/xds/xdr-encode-octetstream.c -> 1.3

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,72 ----
+ /*
+    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.
+ */
+ 
+ #include <assert.h>
+ #include <string.h>
+ #include <sys/types.h>
+ #include "internal.h"
+ 
+ int xdr_encode_octetstream(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     xds_uint8_t* p;
+     size_t       p_len;
+     size_t       padding;
+ 
+     /* Consistency checks. */
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(buffer_size != 0);
+     assert(args != NULL);
+     if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
+        return XDS_ERR_INVALID_ARG;
+ 
+     /* Get value from stack and calculate the correct amount of
+        padding. */
+ 
+     p       = (xds_uint8_t*)va_arg(*args, void*);
+     assert(p != NULL);
+     p_len   = va_arg(*args, size_t);
+     padding = (4 - (p_len & 0x03)) & 0x03;
+     assert((p_len + padding) % 4 == 0);
+ 
+     /* Format the values into the buffer. */
+ 
+     if (buffer_size >= 4 + p_len + padding)
+        {
+        ((xds_uint8_t*)buffer)[0] = (p_len >> 24) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[1] = (p_len >> 16) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[2] = (p_len >>  8) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[3] = (p_len >>  0) & 0x000000ff;
+        memmove((xds_uint8_t*)buffer+4, p, p_len);
+        memset((xds_uint8_t*)buffer+4+p_len, 0, padding);
+        }
+ 
+     /* Done. */
+ 
+     return 4 + p_len + padding;
+     }


ossp-pkg/xds/xdr-encode-string.c -> 1.3

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,72 ----
+ /*
+    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.
+ */
+ 
+ #include <assert.h>
+ #include <string.h>
+ #include <sys/types.h>
+ #include "internal.h"
+ 
+ int xdr_encode_string(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     xds_uint8_t* p;
+     size_t    p_len;
+     size_t    padding;
+ 
+     /* Consistency checks. */
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(buffer_size != 0);
+     assert(args != NULL);
+     if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
+        return XDS_ERR_INVALID_ARG;
+ 
+     /* Get value from stack and calculate the correct amount of
+        padding. */
+ 
+     p       = (xds_uint8_t*)va_arg(*args, void*);
+     assert(p != NULL);
+     p_len   = strlen((char*)p);
+     padding = (4 - (p_len & 0x03)) & 0x03;
+     assert((p_len + padding) % 4 == 0);
+ 
+     /* Format the values into the buffer. */
+ 
+     if (buffer_size >= 4 + p_len + padding)
+        {
+        ((xds_uint8_t*)buffer)[0] = (p_len >> 24) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[1] = (p_len >> 16) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[2] = (p_len >>  8) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[3] = (p_len >>  0) & 0x000000ff;
+        memmove((xds_uint8_t*)buffer+4, p, p_len);
+        memset((xds_uint8_t*)buffer+4+p_len, 0, padding);
+        }
+ 
+     /* Done. */
+ 
+     return 4 + p_len + padding;
+     }


ossp-pkg/xds/xdr-encode-uint32.c -> 1.2

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,57 ----
+ /*
+    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.
+ */
+ 
+ #include <assert.h>
+ #include <sys/types.h>
+ #include "internal.h"
+ 
+ int xdr_encode_uint32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     /* Consistency checks. */
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(buffer_size != 0);
+     assert(args != NULL);
+     if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
+        return XDS_ERR_INVALID_ARG;
+ 
+     /* Get value and format it into the buffer. */
+ 
+     if (buffer_size >= 4)
+        {
+        xds_uint32_t value = va_arg(*args, xds_uint32_t);
+        ((xds_uint8_t*)buffer)[0] = (value >> 24) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[1] = (value >> 16) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[2] = (value >>  8) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[3] = (value >>  0) & 0x000000ff;
+        }
+ 
+     /* Done. */
+ 
+     return 4;
+     }


ossp-pkg/xds/xdr-encode-uint64.c -> 1.2

*** /dev/null    Sun Apr 28 18:37:10 2024
--- -    Sun Apr 28 18:37:38 2024
***************
*** 0 ****
--- 1,61 ----
+ /*
+    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.
+ */
+ 
+ #include <assert.h>
+ #include <sys/types.h>
+ #include "internal.h"
+ 
+ int xdr_encode_uint64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+     {
+     /* Consistency checks. */
+ 
+     assert(xds != NULL);
+     assert(buffer != NULL);
+     assert(buffer_size != 0);
+     assert(args != NULL);
+     if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
+        return XDS_ERR_INVALID_ARG;
+ 
+     /* Get value and format it into the buffer. */
+ 
+     if (buffer_size >= 8)
+        {
+        xds_uint64_t value = va_arg(*args, xds_uint64_t);
+        ((xds_uint8_t*)buffer)[0] = (value >> 56) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[1] = (value >> 48) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[2] = (value >> 40) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[3] = (value >> 32) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[4] = (value >> 24) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[5] = (value >> 16) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[6] = (value >>  8) & 0x000000ff;
+        ((xds_uint8_t*)buffer)[7] = (value >>  0) & 0x000000ff;
+        }
+ 
+     /* Done. */
+ 
+     return 8;
+     }


ossp-pkg/xds/xds.h.in 1.1 -> 1.2

--- xds.h.in     2001/07/20 10:42:34     1.1
+++ xds.h.in     2001/07/20 10:56:01     1.2
@@ -37,9 +37,11 @@
 typedef @xds_uint8_t@ xds_uint8_t;
 typedef @xds_uint16_t@ xds_uint16_t;
 typedef @xds_uint32_t@ xds_uint32_t;
+typedef @xds_uint64_t@ xds_uint64_t;
 typedef @xds_int8_t@ xds_int8_t;
 typedef @xds_int16_t@ xds_int16_t;
 typedef @xds_int32_t@ xds_int32_t;
+typedef @xds_int64_t@ xds_int64_t;
 
 enum
     {

CVSTrac 2.0.1