Index: ossp-pkg/xds/Makefile RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/Makefile,v rcsdiff -q -kk '-r1.15' '-r1.16' -u '/v/ossp/cvs/ossp-pkg/xds/Attic/Makefile,v' 2>/dev/null --- Makefile 2001/07/18 18:26:32 1.15 +++ Makefile 2001/07/19 12:28:15 1.16 @@ -16,8 +16,9 @@ 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-int.o xdr-decode-int.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 .c.o: $(CC) $(CPPFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(CFLAGS) -c $< Index: ossp-pkg/xds/xdr-decode-int.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-int.c,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-int.c,v' | diff -u - /dev/null -L'ossp-pkg/xds/xdr-decode-int.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-int.c +++ /dev/null 2024-05-10 16:08:11.000000000 +0200 @@ -1,184 +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 xdr_decode_int32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args) - { - int32_t* value; - u_int32_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, int32_t*); - assert(value != NULL); - - if (((u_int8_t*)buffer)[0] & 0x80) - { /* negative number */ - tmp = ((u_int8_t*)buffer)[0]; tmp = tmp << 8; - tmp += ((u_int8_t*)buffer)[1]; tmp = tmp << 8; - tmp += ((u_int8_t*)buffer)[2]; tmp = tmp << 8; - tmp += ((u_int8_t*)buffer)[3]; - tmp = 0 - tmp; - *value = 0 - (int32_t)tmp; - } - else - { /* positive number */ - *value = ((u_int8_t*)buffer)[0]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[1]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[2]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[3]; - } - - /* Done. */ - - return 4; - } - -int xdr_decode_uint32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args) - { - u_int32_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, u_int32_t*); - assert(value != NULL); - - *value = ((u_int8_t*)buffer)[0]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[1]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[2]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[3]; - - /* Done. */ - - return 4; - } - -int xdr_decode_int64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args) - { - int64_t* value; - u_int64_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, int64_t*); - assert(value != NULL); - - if (((u_int8_t*)buffer)[0] & 0x80) - { /* negative number */ - tmp = ((u_int8_t*)buffer)[0]; tmp = tmp << 8; - tmp += ((u_int8_t*)buffer)[1]; tmp = tmp << 8; - tmp += ((u_int8_t*)buffer)[2]; tmp = tmp << 8; - tmp += ((u_int8_t*)buffer)[3]; tmp = tmp << 8; - tmp += ((u_int8_t*)buffer)[4]; tmp = tmp << 8; - tmp += ((u_int8_t*)buffer)[5]; tmp = tmp << 8; - tmp += ((u_int8_t*)buffer)[6]; tmp = tmp << 8; - tmp += ((u_int8_t*)buffer)[7]; - tmp = 0 - tmp; - *value = 0 - (int64_t)tmp; - } - else - { /* positive number */ - *value = ((u_int8_t*)buffer)[0]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[1]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[2]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[3]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[4]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[5]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[6]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[7]; - } - - /* Done. */ - - return 8; - } - -int xdr_decode_uint64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args) - { - u_int64_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, u_int64_t*); - assert(value != NULL); - - *value = ((u_int8_t*)buffer)[0]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[1]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[2]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[3]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[4]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[5]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[6]; *value = *value << 8; - *value += ((u_int8_t*)buffer)[7]; - - /* Done. */ - - return 8; - } Index: ossp-pkg/xds/xdr-decode-int32.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-int32.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-int32.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-decode-int32.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-int32.c +++ - 2024-05-10 16:08:29.341669441 +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 "internal.h" + +int xdr_decode_int32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args) + { + int32_t* value; + u_int32_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, int32_t*); + assert(value != NULL); + + if (((u_int8_t*)buffer)[0] & 0x80) + { /* negative number */ + tmp = ((u_int8_t*)buffer)[0]; tmp = tmp << 8; + tmp += ((u_int8_t*)buffer)[1]; tmp = tmp << 8; + tmp += ((u_int8_t*)buffer)[2]; tmp = tmp << 8; + tmp += ((u_int8_t*)buffer)[3]; + tmp = 0 - tmp; + *value = 0 - (int32_t)tmp; + } + else + { /* positive number */ + *value = ((u_int8_t*)buffer)[0]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[1]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[2]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[3]; + } + + /* Done. */ + + return 4; + } Index: ossp-pkg/xds/xdr-decode-int64.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-int64.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-int64.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-decode-int64.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-int64.c +++ - 2024-05-10 16:08:29.344286831 +0200 @@ -0,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 +#include +#include "internal.h" + +int xdr_decode_int64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args) + { + int64_t* value; + u_int64_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, int64_t*); + assert(value != NULL); + + if (((u_int8_t*)buffer)[0] & 0x80) + { /* negative number */ + tmp = ((u_int8_t*)buffer)[0]; tmp = tmp << 8; + tmp += ((u_int8_t*)buffer)[1]; tmp = tmp << 8; + tmp += ((u_int8_t*)buffer)[2]; tmp = tmp << 8; + tmp += ((u_int8_t*)buffer)[3]; tmp = tmp << 8; + tmp += ((u_int8_t*)buffer)[4]; tmp = tmp << 8; + tmp += ((u_int8_t*)buffer)[5]; tmp = tmp << 8; + tmp += ((u_int8_t*)buffer)[6]; tmp = tmp << 8; + tmp += ((u_int8_t*)buffer)[7]; + tmp = 0 - tmp; + *value = 0 - (int64_t)tmp; + } + else + { /* positive number */ + *value = ((u_int8_t*)buffer)[0]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[1]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[2]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[3]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[4]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[5]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[6]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[7]; + } + + /* Done. */ + + return 8; + } Index: ossp-pkg/xds/xdr-decode-uint32.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-uint32.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-uint32.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-decode-uint32.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-uint32.c +++ - 2024-05-10 16:08:29.346878479 +0200 @@ -0,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 +#include +#include "internal.h" + +int xdr_decode_uint32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args) + { + u_int32_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, u_int32_t*); + assert(value != NULL); + + *value = ((u_int8_t*)buffer)[0]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[1]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[2]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[3]; + + /* Done. */ + + return 4; + } Index: ossp-pkg/xds/xdr-decode-uint64.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-uint64.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-uint64.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-decode-uint64.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-uint64.c +++ - 2024-05-10 16:08:29.349475291 +0200 @@ -0,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 +#include +#include "internal.h" + +int xdr_decode_uint64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args) + { + u_int64_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, u_int64_t*); + assert(value != NULL); + + *value = ((u_int8_t*)buffer)[0]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[1]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[2]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[3]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[4]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[5]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[6]; *value = *value << 8; + *value += ((u_int8_t*)buffer)[7]; + + /* Done. */ + + return 8; + } Index: ossp-pkg/xds/xdr-encode-int.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-int.c,v co -q -kk -p'1.3' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-int.c,v' | diff -u - /dev/null -L'ossp-pkg/xds/xdr-encode-int.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-int.c +++ /dev/null 2024-05-10 16:08:11.000000000 +0200 @@ -1,162 +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 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) - { - u_int32_t tmp; - int32_t value = va_arg(*args, u_int32_t); - if (value < 0) - { - value = 0 - value; - tmp = 0 - (u_int32_t)value; - } - else - tmp = (u_int32_t)value; - ((u_int8_t*)buffer)[0] = (tmp >> 24) & 0x000000ff; - ((u_int8_t*)buffer)[1] = (tmp >> 16) & 0x000000ff; - ((u_int8_t*)buffer)[2] = (tmp >> 8) & 0x000000ff; - ((u_int8_t*)buffer)[3] = (tmp >> 0) & 0x000000ff; - } - - /* Done. */ - - return 4; - } - -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) - { - u_int32_t value = va_arg(*args, u_int32_t); - ((u_int8_t*)buffer)[0] = (value >> 24) & 0x000000ff; - ((u_int8_t*)buffer)[1] = (value >> 16) & 0x000000ff; - ((u_int8_t*)buffer)[2] = (value >> 8) & 0x000000ff; - ((u_int8_t*)buffer)[3] = (value >> 0) & 0x000000ff; - } - - /* Done. */ - - return 4; - } - -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) - { - u_int64_t tmp; - int64_t value = va_arg(*args, u_int64_t); - if (value < 0) - { - value = 0 - value; - tmp = 0 - (u_int64_t)value; - } - else - tmp = (u_int64_t)value; - ((u_int8_t*)buffer)[0] = (tmp >> 56) & 0x000000ff; - ((u_int8_t*)buffer)[1] = (tmp >> 48) & 0x000000ff; - ((u_int8_t*)buffer)[2] = (tmp >> 40) & 0x000000ff; - ((u_int8_t*)buffer)[3] = (tmp >> 32) & 0x000000ff; - ((u_int8_t*)buffer)[4] = (tmp >> 24) & 0x000000ff; - ((u_int8_t*)buffer)[5] = (tmp >> 16) & 0x000000ff; - ((u_int8_t*)buffer)[6] = (tmp >> 8) & 0x000000ff; - ((u_int8_t*)buffer)[7] = (tmp >> 0) & 0x000000ff; - } - - /* Done. */ - - return 8; - } - -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) - { - u_int64_t value = va_arg(*args, u_int64_t); - ((u_int8_t*)buffer)[0] = (value >> 56) & 0x000000ff; - ((u_int8_t*)buffer)[1] = (value >> 48) & 0x000000ff; - ((u_int8_t*)buffer)[2] = (value >> 40) & 0x000000ff; - ((u_int8_t*)buffer)[3] = (value >> 32) & 0x000000ff; - ((u_int8_t*)buffer)[4] = (value >> 24) & 0x000000ff; - ((u_int8_t*)buffer)[5] = (value >> 16) & 0x000000ff; - ((u_int8_t*)buffer)[6] = (value >> 8) & 0x000000ff; - ((u_int8_t*)buffer)[7] = (value >> 0) & 0x000000ff; - } - - /* Done. */ - - return 8; - } Index: ossp-pkg/xds/xdr-encode-int32.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-int32.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-int32.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-encode-int32.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-int32.c +++ - 2024-05-10 16:08:29.354860560 +0200 @@ -0,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 +#include +#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) + { + u_int32_t tmp; + int32_t value = va_arg(*args, u_int32_t); + if (value < 0) + { + value = 0 - value; + tmp = 0 - (u_int32_t)value; + } + else + tmp = (u_int32_t)value; + ((u_int8_t*)buffer)[0] = (tmp >> 24) & 0x000000ff; + ((u_int8_t*)buffer)[1] = (tmp >> 16) & 0x000000ff; + ((u_int8_t*)buffer)[2] = (tmp >> 8) & 0x000000ff; + ((u_int8_t*)buffer)[3] = (tmp >> 0) & 0x000000ff; + } + + /* Done. */ + + return 4; + } Index: ossp-pkg/xds/xdr-encode-int64.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-int64.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-int64.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-encode-int64.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-int64.c +++ - 2024-05-10 16:08:29.357475516 +0200 @@ -0,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 +#include +#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) + { + u_int64_t tmp; + int64_t value = va_arg(*args, u_int64_t); + if (value < 0) + { + value = 0 - value; + tmp = 0 - (u_int64_t)value; + } + else + tmp = (u_int64_t)value; + ((u_int8_t*)buffer)[0] = (tmp >> 56) & 0x000000ff; + ((u_int8_t*)buffer)[1] = (tmp >> 48) & 0x000000ff; + ((u_int8_t*)buffer)[2] = (tmp >> 40) & 0x000000ff; + ((u_int8_t*)buffer)[3] = (tmp >> 32) & 0x000000ff; + ((u_int8_t*)buffer)[4] = (tmp >> 24) & 0x000000ff; + ((u_int8_t*)buffer)[5] = (tmp >> 16) & 0x000000ff; + ((u_int8_t*)buffer)[6] = (tmp >> 8) & 0x000000ff; + ((u_int8_t*)buffer)[7] = (tmp >> 0) & 0x000000ff; + } + + /* Done. */ + + return 8; + } Index: ossp-pkg/xds/xdr-encode-uint32.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-uint32.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-uint32.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-encode-uint32.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-uint32.c +++ - 2024-05-10 16:08:29.360052272 +0200 @@ -0,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 +#include +#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) + { + u_int32_t value = va_arg(*args, u_int32_t); + ((u_int8_t*)buffer)[0] = (value >> 24) & 0x000000ff; + ((u_int8_t*)buffer)[1] = (value >> 16) & 0x000000ff; + ((u_int8_t*)buffer)[2] = (value >> 8) & 0x000000ff; + ((u_int8_t*)buffer)[3] = (value >> 0) & 0x000000ff; + } + + /* Done. */ + + return 4; + } Index: ossp-pkg/xds/xdr-encode-uint64.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-uint64.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-uint64.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-encode-uint64.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-uint64.c +++ - 2024-05-10 16:08:29.362642452 +0200 @@ -0,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 +#include +#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) + { + u_int64_t value = va_arg(*args, u_int64_t); + ((u_int8_t*)buffer)[0] = (value >> 56) & 0x000000ff; + ((u_int8_t*)buffer)[1] = (value >> 48) & 0x000000ff; + ((u_int8_t*)buffer)[2] = (value >> 40) & 0x000000ff; + ((u_int8_t*)buffer)[3] = (value >> 32) & 0x000000ff; + ((u_int8_t*)buffer)[4] = (value >> 24) & 0x000000ff; + ((u_int8_t*)buffer)[5] = (value >> 16) & 0x000000ff; + ((u_int8_t*)buffer)[6] = (value >> 8) & 0x000000ff; + ((u_int8_t*)buffer)[7] = (value >> 0) & 0x000000ff; + } + + /* Done. */ + + return 8; + }