Index: ossp-pkg/xds/Makefile RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/Makefile,v co -q -kk -p'1.19' '/v/ossp/cvs/ossp-pkg/xds/Attic/Makefile,v' | diff -u - /dev/null -L'ossp-pkg/xds/Makefile' 2>/dev/null --- ossp-pkg/xds/Makefile +++ /dev/null 2024-05-10 02:15:23.000000000 +0200 @@ -1,69 +0,0 @@ -# Build libxds and support/test programs. - -CC = gcc -CXX = g++ -AR = ar -RANLIB = ranlib - -WARNFLAGS = -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wcast-align -Winline -Wmissing-prototypes \ - -Wmissing-declarations -Wnested-externs -OPTFLAGS = -O3 -pipe - -CPPFLAGS = -D_GNU_SOURCE -CFLAGS = -CXXFLAGS = -LDFLAGS = - -OBJS = decode.o destroy.o encode.o getbuffer.o init.o register.o \ - setbuffer.o unregister.o vdecode.o vencode.o find-engine.o \ - set-capacity.o xdr-encode-int32.o xdr-encode-int64.o \ - xdr-encode-uint32.o xdr-encode-uint64.o xdr-decode-int32.o \ - xdr-decode-int64.o xdr-decode-uint32.o xdr-decode-uint64.o \ - xdr-encode-octedstream.o xdr-decode-octedstream.o \ - xdr-encode-string.o xdr-decode-string.o -.c.o: - $(CC) $(CPPFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(CFLAGS) -c $< - -.cpp.o: - $(CXX) $(CPPFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(CXXFLAGS) -c $< - -all: libxds.a xds.3 - -libxds.a: $(OBJS) - @rm -f $@ - $(AR) cr $@ $(OBJS) - $(RANLIB) $@ - -xds.3: xds.pod - pod2man --section=3 --center="XDS Library Programmer API " xds.pod >xds.3 - -clean:: - @(cd regression-tests && $(MAKE) clean) - rm -f $(OBJS) - rm -f libxds.a test.o test xds.3 - -check: libxds.a - (cd regression-tests && $(MAKE) check) - -# Dependencies - -decode.o: internal.h xds.h -destroy.o: internal.h xds.h -encode.o: internal.h xds.h -find-engine.o: internal.h xds.h -getbuffer.o: internal.h xds.h -init.o: internal.h xds.h -register.o: internal.h xds.h -set-capacity.o: internal.h xds.h -setbuffer.o: internal.h xds.h -unregister.o: internal.h xds.h -vdecode.o: internal.h xds.h -vencode.o: internal.h xds.h -xdr-decode-int32.o: internal.h xds.h -xdr-decode-int64.o: internal.h xds.h -xdr-decode-uint32.o: internal.h xds.h -xdr-decode-uint64.o: internal.h xds.h -xdr-encode-int32.o: internal.h xds.h -xdr-encode-int64.o: internal.h xds.h -xdr-encode-uint32.o: internal.h xds.h -xdr-encode-uint64.o: internal.h xds.h Index: ossp-pkg/xds/regression-tests/Makefile RCS File: /v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/Makefile,v co -q -kk -p'1.18' '/v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/Makefile,v' | diff -u - /dev/null -L'ossp-pkg/xds/regression-tests/Makefile' 2>/dev/null --- ossp-pkg/xds/regression-tests/Makefile +++ /dev/null 2024-05-10 02:15:23.000000000 +0200 @@ -1,40 +0,0 @@ -# Build and run the regression tests. - -CC = gcc - -WARNFLAGS = -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wcast-align -Winline \ - -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-long-long \ - -Werror -OPTFLAGS = -O3 -pipe -CPPFLAGS = -D_GNU_SOURCE -CFLAGS = -LDFLAGS = -L.. - -TESTS = xds-core.exe xds-find-engine.exe xds-register.exe xds-encode.exe \ - xds-getbuffer.exe xds-decode.exe xds-setbuffer.exe xds-engine-restart.exe \ - xdr-uint32.exe xdr-int32.exe xdr-uint64.exe xdr-int64.exe \ - xdr-octedstream.exe xdr-octedstream-empty.exe xdr-string.exe \ - xdr-string-empty.exe xds-mystruct.exe - -.SUFFIXES: -.SUFFIXES: .c .exe - -.c.exe: - $(CC) $(CPPFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< -lxds - -.cpp.exe: - $(CXX) $(CPPFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $< -lxds - -all: $(TESTS) - -check: all - @./.run-tests $(TESTS) - -../libxds.a: - (cd .. && $(MAKE) libxds.a) -clean:: - rm -f $(TESTS) *.log - -# Dependencies - -$(TESTS): ../libxds.a Index: ossp-pkg/xds/regression-tests/xdr-octedstream-empty.c RCS File: /v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/xdr-octedstream-empty.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/xdr-octedstream-empty.c,v' | diff -u - /dev/null -L'ossp-pkg/xds/regression-tests/xdr-octedstream-empty.c' 2>/dev/null --- ossp-pkg/xds/regression-tests/xdr-octedstream-empty.c +++ /dev/null 2024-05-10 02:15:23.000000000 +0200 @@ -1,110 +0,0 @@ -/* - 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 -#include -#include "../internal.h" - -int main() - { - xds_t* xds; - char* buffer; - size_t buffer_size; - - char msg[] = ""; - char* new_msg; - size_t new_msg_size; - - /* Encode the string as octed stream. Then erase the buffer and - decode the string back, verifying that it hasn't changed. */ - - xds = xds_init(XDS_ENCODE); - if (xds == NULL) - { - printf("Failed to initialize XDS context.\n"); - return 1; - } - if (xds_register(xds, "os", &xdr_encode_octedstream, NULL) != XDS_OK) - { - printf("Failed to register my encoding engines.\n"); - return 1; - } - if (xds_encode(xds, "os", msg, 0) != XDS_OK) - { - printf("xds_encode() failed.\n"); - return 1; - } - if (xds_getbuffer(xds, XDS_GIFT, (void**)&buffer, &buffer_size) != XDS_OK) - { - printf("xds_getbuffer() failed.\n"); - return 1; - } - xds_destroy(xds); - if (buffer_size % 4 != 0) - { - printf("The encoded octed stream's buffer size is not a multiple of 4.\n"); - return 1; - } - - xds = xds_init(XDS_DECODE); - if (xds == NULL) - { - printf("Failed to initialize XDS context.\n"); - return 1; - } - if (xds_register(xds, "os", &xdr_decode_octedstream, 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, "os", &new_msg, &new_msg_size) != XDS_OK) - { - printf("xds_decode() failed.\n"); - return 1; - } - if (new_msg_size != 0) - { - printf("The size of the decoded message is wrong.\n"); - return 1; - } - if (strncmp(msg, new_msg, new_msg_size) != 0) - { - printf("The decoded octed stream is not correct.\n"); - return 1; - } - xds_destroy(xds); - free(new_msg); - - /* Everything went fine. */ - - return 0; - } Index: ossp-pkg/xds/regression-tests/xdr-octedstream.c RCS File: /v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/xdr-octedstream.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/xdr-octedstream.c,v' | diff -u - /dev/null -L'ossp-pkg/xds/regression-tests/xdr-octedstream.c' 2>/dev/null --- ossp-pkg/xds/regression-tests/xdr-octedstream.c +++ /dev/null 2024-05-10 02:15:23.000000000 +0200 @@ -1,110 +0,0 @@ -/* - 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 -#include -#include "../internal.h" - -int main() - { - xds_t* xds; - char* buffer; - size_t buffer_size; - - char msg[] = "Hello World"; - char* new_msg; - size_t new_msg_size; - - /* Encode the string as octed stream. Then erase the buffer and - decode the string back, verifying that it hasn't changed. */ - - xds = xds_init(XDS_ENCODE); - if (xds == NULL) - { - printf("Failed to initialize XDS context.\n"); - return 1; - } - if (xds_register(xds, "os", &xdr_encode_octedstream, NULL) != XDS_OK) - { - printf("Failed to register my encoding engines.\n"); - return 1; - } - if (xds_encode(xds, "os", msg, strlen(msg)) != XDS_OK) - { - printf("xds_encode() failed.\n"); - return 1; - } - if (xds_getbuffer(xds, XDS_GIFT, (void**)&buffer, &buffer_size) != XDS_OK) - { - printf("xds_getbuffer() failed.\n"); - return 1; - } - xds_destroy(xds); - if (buffer_size % 4 != 0) - { - printf("The encoded octed stream's buffer size is not a multiple of 4.\n"); - return 1; - } - - xds = xds_init(XDS_DECODE); - if (xds == NULL) - { - printf("Failed to initialize XDS context.\n"); - return 1; - } - if (xds_register(xds, "os", &xdr_decode_octedstream, 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, "os", &new_msg, &new_msg_size) != XDS_OK) - { - printf("xds_decode() failed.\n"); - return 1; - } - if (new_msg_size != strlen(msg)) - { - printf("The size of the decoded message is wrong.\n"); - return 1; - } - if (strncmp(msg, new_msg, new_msg_size) != 0) - { - printf("The decoded octed stream is not correct.\n"); - return 1; - } - xds_destroy(xds); - free(new_msg); - - /* Everything went fine. */ - - return 0; - } Index: ossp-pkg/xds/regression-tests/xdr-octetstream-empty.c RCS File: /v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/xdr-octetstream-empty.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/xdr-octetstream-empty.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/regression-tests/xdr-octetstream-empty.c' 2>/dev/null --- ossp-pkg/xds/regression-tests/xdr-octetstream-empty.c +++ - 2024-05-10 02:17:36.838194745 +0200 @@ -0,0 +1,110 @@ +/* + 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 +#include +#include "../internal.h" + +int main() + { + xds_t* xds; + char* buffer; + size_t buffer_size; + + char msg[] = ""; + char* new_msg; + size_t new_msg_size; + + /* Encode the string as octet stream. Then erase the buffer and + decode the string back, verifying that it hasn't changed. */ + + xds = xds_init(XDS_ENCODE); + if (xds == NULL) + { + printf("Failed to initialize XDS context.\n"); + return 1; + } + if (xds_register(xds, "os", &xdr_encode_octetstream, NULL) != XDS_OK) + { + printf("Failed to register my encoding engines.\n"); + return 1; + } + if (xds_encode(xds, "os", msg, 0) != XDS_OK) + { + printf("xds_encode() failed.\n"); + return 1; + } + if (xds_getbuffer(xds, XDS_GIFT, (void**)&buffer, &buffer_size) != XDS_OK) + { + printf("xds_getbuffer() failed.\n"); + return 1; + } + xds_destroy(xds); + if (buffer_size % 4 != 0) + { + printf("The encoded octet stream's buffer size is not a multiple of 4.\n"); + return 1; + } + + xds = xds_init(XDS_DECODE); + if (xds == NULL) + { + printf("Failed to initialize XDS context.\n"); + return 1; + } + if (xds_register(xds, "os", &xdr_decode_octetstream, 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, "os", &new_msg, &new_msg_size) != XDS_OK) + { + printf("xds_decode() failed.\n"); + return 1; + } + if (new_msg_size != 0) + { + printf("The size of the decoded message is wrong.\n"); + return 1; + } + if (strncmp(msg, new_msg, new_msg_size) != 0) + { + printf("The decoded octet stream is not correct.\n"); + return 1; + } + xds_destroy(xds); + free(new_msg); + + /* Everything went fine. */ + + return 0; + } Index: ossp-pkg/xds/regression-tests/xdr-octetstream.c RCS File: /v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/xdr-octetstream.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/xdr-octetstream.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/regression-tests/xdr-octetstream.c' 2>/dev/null --- ossp-pkg/xds/regression-tests/xdr-octetstream.c +++ - 2024-05-10 02:17:36.840842405 +0200 @@ -0,0 +1,110 @@ +/* + 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 +#include +#include "../internal.h" + +int main() + { + xds_t* xds; + char* buffer; + size_t buffer_size; + + char msg[] = "Hello World"; + char* new_msg; + size_t new_msg_size; + + /* Encode the string as octet stream. Then erase the buffer and + decode the string back, verifying that it hasn't changed. */ + + xds = xds_init(XDS_ENCODE); + if (xds == NULL) + { + printf("Failed to initialize XDS context.\n"); + return 1; + } + if (xds_register(xds, "os", &xdr_encode_octetstream, NULL) != XDS_OK) + { + printf("Failed to register my encoding engines.\n"); + return 1; + } + if (xds_encode(xds, "os", msg, strlen(msg)) != XDS_OK) + { + printf("xds_encode() failed.\n"); + return 1; + } + if (xds_getbuffer(xds, XDS_GIFT, (void**)&buffer, &buffer_size) != XDS_OK) + { + printf("xds_getbuffer() failed.\n"); + return 1; + } + xds_destroy(xds); + if (buffer_size % 4 != 0) + { + printf("The encoded octet stream's buffer size is not a multiple of 4.\n"); + return 1; + } + + xds = xds_init(XDS_DECODE); + if (xds == NULL) + { + printf("Failed to initialize XDS context.\n"); + return 1; + } + if (xds_register(xds, "os", &xdr_decode_octetstream, 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, "os", &new_msg, &new_msg_size) != XDS_OK) + { + printf("xds_decode() failed.\n"); + return 1; + } + if (new_msg_size != strlen(msg)) + { + printf("The size of the decoded message is wrong.\n"); + return 1; + } + if (strncmp(msg, new_msg, new_msg_size) != 0) + { + printf("The decoded octet stream is not correct.\n"); + return 1; + } + xds_destroy(xds); + free(new_msg); + + /* Everything went fine. */ + + return 0; + } Index: ossp-pkg/xds/regression-tests/xdr-string-empty.c RCS File: /v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/xdr-string-empty.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/xdr-string-empty.c,v' 2>/dev/null --- xdr-string-empty.c 2001/07/19 15:20:47 1.1 +++ xdr-string-empty.c 2001/07/20 09:22:26 1.2 @@ -39,7 +39,7 @@ char* new_msg; size_t new_msg_size; - /* Encode the string as octed stream. Then erase the buffer and + /* Encode the string as octet stream. Then erase the buffer and decode the string back, verifying that it hasn't changed. */ xds = xds_init(XDS_ENCODE); @@ -66,7 +66,7 @@ xds_destroy(xds); if (buffer_size % 4 != 0) { - printf("The encoded octed stream's buffer size is not a multiple of 4.\n"); + printf("The encoded strings' buffer size is not a multiple of 4.\n"); return 1; } @@ -98,7 +98,7 @@ } if (strncmp(msg, new_msg, new_msg_size) != 0) { - printf("The decoded octed stream is not correct.\n"); + printf("The decoded string is not correct.\n"); return 1; } xds_destroy(xds); Index: ossp-pkg/xds/regression-tests/xdr-string.c RCS File: /v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/xdr-string.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/xds/regression-tests/Attic/xdr-string.c,v' 2>/dev/null --- xdr-string.c 2001/07/19 15:13:40 1.1 +++ xdr-string.c 2001/07/20 09:22:26 1.2 @@ -39,7 +39,7 @@ char* new_msg; size_t new_msg_size; - /* Encode the string as octed stream. Then erase the buffer and + /* Encode the string as octet stream. Then erase the buffer and decode the string back, verifying that it hasn't changed. */ xds = xds_init(XDS_ENCODE); @@ -66,7 +66,7 @@ xds_destroy(xds); if (buffer_size % 4 != 0) { - printf("The encoded octed stream's buffer size is not a multiple of 4.\n"); + printf("The encoded strings' buffer size is not a multiple of 4.\n"); return 1; } @@ -98,7 +98,7 @@ } if (strncmp(msg, new_msg, new_msg_size) != 0) { - printf("The decoded octed stream is not correct.\n"); + printf("The decoded string is not correct.\n"); return 1; } xds_destroy(xds); Index: ossp-pkg/xds/xdr-decode-octedstream.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-octedstream.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-octedstream.c,v' | diff -u - /dev/null -L'ossp-pkg/xds/xdr-decode-octedstream.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-octedstream.c +++ /dev/null 2024-05-10 02:15:23.000000000 +0200 @@ -1,89 +0,0 @@ -/* - 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 -#include -#include -#include "internal.h" - -int xdr_decode_octedstream(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 = ((u_int8_t*)buffer)[0]; *p_len = *p_len << 8; - *p_len += ((u_int8_t*)buffer)[1]; *p_len = *p_len << 8; - *p_len += ((u_int8_t*)buffer)[2]; *p_len = *p_len << 8; - *p_len += ((u_int8_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, (u_int8_t*)buffer+4, *p_len); - - /* Done. */ - - return 4 + *p_len + padding; - } Index: ossp-pkg/xds/xdr-decode-octetstream.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-octetstream.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-octetstream.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-decode-octetstream.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-octetstream.c +++ - 2024-05-10 02:17:36.854574326 +0200 @@ -0,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 +#include +#include +#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 = ((u_int8_t*)buffer)[0]; *p_len = *p_len << 8; + *p_len += ((u_int8_t*)buffer)[1]; *p_len = *p_len << 8; + *p_len += ((u_int8_t*)buffer)[2]; *p_len = *p_len << 8; + *p_len += ((u_int8_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, (u_int8_t*)buffer+4, *p_len); + + /* Done. */ + + return 4 + *p_len + padding; + } Index: ossp-pkg/xds/xdr-encode-octedstream.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-octedstream.c,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-octedstream.c,v' | diff -u - /dev/null -L'ossp-pkg/xds/xdr-encode-octedstream.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-octedstream.c +++ /dev/null 2024-05-10 02:15:23.000000000 +0200 @@ -1,72 +0,0 @@ -/* - 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 -#include -#include -#include "internal.h" - -int xdr_encode_octedstream(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args) - { - u_int8_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 = (u_int8_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) - { - ((u_int8_t*)buffer)[0] = (p_len >> 24) & 0x000000ff; - ((u_int8_t*)buffer)[1] = (p_len >> 16) & 0x000000ff; - ((u_int8_t*)buffer)[2] = (p_len >> 8) & 0x000000ff; - ((u_int8_t*)buffer)[3] = (p_len >> 0) & 0x000000ff; - memmove((u_int8_t*)buffer+4, p, p_len); - memset(buffer+4+p_len, 0, padding); - } - - /* Done. */ - - return 4 + p_len + padding; - } Index: ossp-pkg/xds/xdr-encode-octetstream.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-octetstream.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-octetstream.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-encode-octetstream.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-octetstream.c +++ - 2024-05-10 02:17:36.859945515 +0200 @@ -0,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 +#include +#include +#include "internal.h" + +int xdr_encode_octetstream(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args) + { + u_int8_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 = (u_int8_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) + { + ((u_int8_t*)buffer)[0] = (p_len >> 24) & 0x000000ff; + ((u_int8_t*)buffer)[1] = (p_len >> 16) & 0x000000ff; + ((u_int8_t*)buffer)[2] = (p_len >> 8) & 0x000000ff; + ((u_int8_t*)buffer)[3] = (p_len >> 0) & 0x000000ff; + memmove((u_int8_t*)buffer+4, p, p_len); + memset(buffer+4+p_len, 0, padding); + } + + /* Done. */ + + return 4 + p_len + padding; + } Index: ossp-pkg/xds/xds.h RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xds.h,v co -q -kk -p'1.21' '/v/ossp/cvs/ossp-pkg/xds/Attic/xds.h,v' | diff -u - /dev/null -L'ossp-pkg/xds/xds.h' 2>/dev/null --- ossp-pkg/xds/xds.h +++ /dev/null 2024-05-10 02:15:23.000000000 +0200 @@ -1,89 +0,0 @@ -/* - 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); -int xdr_encode_uint64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args); -int xdr_encode_int64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args); - -int xdr_decode_uint32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args); -int xdr_decode_int32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args); -int xdr_decode_uint64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args); -int xdr_decode_int64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args); - -int xdr_encode_octedstream(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args); -int xdr_decode_octedstream(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args); - -int xdr_encode_string(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args); -int xdr_decode_string(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args); - -#endif /* !defined(__LIBXDS_H__) */