From 86ecd3fa0b83c81cfe3d3195f5291e84836850bf Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 31 Aug 2004 01:04:15 +0000 Subject: [PATCH] Get rid of backdoor. --- src/Makefile.inc | 1 - src/lib/backdoor.c | 97 ---------------------------------------------- src/lib/backdoor.h | 34 ---------------- 3 files changed, 132 deletions(-) delete mode 100644 src/lib/backdoor.c delete mode 100644 src/lib/backdoor.h diff --git a/src/Makefile.inc b/src/Makefile.inc index 9153128..d1bb0c9 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -40,7 +40,6 @@ LIB_SRC += lib.c # Standard C library. LIB_SRC += random.c # Pseudo-random numbers. LIB_SRC += list.c # Doubly-linked lists. LIB_SRC += bitmap.c # Bitmaps. -LIB_SRC += backdoor.c # Backdoor IPC. # Filesystem code. FILESYS_SRC = filesys.c # Filesystem core. diff --git a/src/lib/backdoor.c b/src/lib/backdoor.c deleted file mode 100644 index efb1b4c..0000000 --- a/src/lib/backdoor.c +++ /dev/null @@ -1,97 +0,0 @@ -#include "backdoor.h" -#include -#include -#include - -void -backdoor_put_int32 (int32_t value, - void (*out) (uint8_t, void *aux), void *aux) -{ - out ((value >> 24) & 0xff, aux); - out ((value >> 16) & 0xff, aux); - out ((value >> 8) & 0xff, aux); - out (value & 0xff, aux); -} - -void -backdoor_put_uint32 (uint32_t value, - void (*out) (uint8_t, void *aux), void *aux) -{ - out ((value >> 24) & 0xff, aux); - out ((value >> 16) & 0xff, aux); - out ((value >> 8) & 0xff, aux); - out (value & 0xff, aux); -} - -void -backdoor_put_bytes (const void *buffer, size_t cnt, - void (*out) (uint8_t, void *aux), void *aux) -{ - const uint8_t *p = buffer; - size_t i; - - for (i = 0; i < cnt; i++) - out (p[i], aux); -} - -void -backdoor_put_string (const char *string, - void (*out) (uint8_t, void *aux), void *aux) -{ - size_t length = strlen (string); - - backdoor_put_uint32 (length, out, aux); - backdoor_put_bytes (string, length, out, aux); -} - -void -backdoor_put_bool (bool b, - void (*out) (uint8_t, void *aux), void *aux) -{ - backdoor_put_uint32 (b, out, aux); -} - -int32_t -backdoor_get_int32 (uint8_t (*in) (void *aux), void *aux) -{ - int32_t value; - int i; - - value = 0; - for (i = 0; i < 4; i++) - value = (value << 8) | in (aux); - return value; -} - -uint32_t -backdoor_get_uint32 (uint8_t (*in) (void *aux), void *aux) -{ - return backdoor_get_int32 (in, aux); -} - -char * -backdoor_get_string (uint8_t (*in) (void *aux), void *aux) -{ - size_t length = backdoor_get_uint32 (in, aux); - char *string = malloc (length + 1); - backdoor_get_bytes (string, length, in, aux); - string[length] = '\0'; - return string; -} - -void -backdoor_get_bytes (void *buffer, size_t cnt, - uint8_t (*in) (void *aux), void *aux) -{ - uint8_t *p = buffer; - size_t i; - - for (i = 0; i < cnt; i++) - p[i] = in (aux); -} - -bool -backdoor_get_bool (uint8_t (*in) (void *aux), void *aux) -{ - return backdoor_get_uint32 (in, aux) != 0; -} diff --git a/src/lib/backdoor.h b/src/lib/backdoor.h deleted file mode 100644 index e999679..0000000 --- a/src/lib/backdoor.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef HEADER_BACKDOOR_H -#define HEADER_BACKDOOR_H 1 - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void backdoor_put_int32 (int32_t value, - void (*out) (uint8_t, void *aux), void *aux); -void backdoor_put_uint32 (uint32_t value, - void (*out) (uint8_t, void *aux), void *aux); -void backdoor_put_bytes (const void *buffer, size_t cnt, - void (*out) (uint8_t, void *aux), void *aux); -void backdoor_put_string (const char *string, - void (*out) (uint8_t, void *aux), void *aux); -void backdoor_put_bool (bool b, - void (*out) (uint8_t, void *aux), void *aux); -int32_t backdoor_get_int32 (uint8_t (*in) (void *aux), void *aux); -uint32_t backdoor_get_uint32 (uint8_t (*in) (void *aux), void *aux); -char *backdoor_get_string (uint8_t (*in) (void *aux), void *aux); -void backdoor_get_bytes (void *buffer, size_t cnt, - uint8_t (*in) (void *aux), void *aux); -bool backdoor_get_bool (uint8_t (*in) (void *aux), void *aux); - -#ifdef __cplusplus -}; -#endif - -#endif /* backdoor.h */ -- 2.30.2