From 5d9d8d114ff70061c46735b5718da8d3eca2cd22 Mon Sep 17 00:00:00 2001 From: Michael Graff Date: Sat, 25 Sep 1999 01:23:39 +0000 Subject: [PATCH] Add magic.h, which should eventually contain all isc magic numbers, perhaps macros to validate structures using them, and perhaps a do-all function which can be used by debugging code to identify a structure and print the contents by calling the correct dump function. --- lib/isc/include/isc/Makefile.in | 4 ++-- lib/isc/include/isc/magic.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 lib/isc/include/isc/magic.h diff --git a/lib/isc/include/isc/Makefile.in b/lib/isc/include/isc/Makefile.in index 4008deadf5..ac1aa06e54 100644 --- a/lib/isc/include/isc/Makefile.in +++ b/lib/isc/include/isc/Makefile.in @@ -22,8 +22,8 @@ top_srcdir = @top_srcdir@ HEADERS = assertions.h base64.h boolean.h buffer.h bufferlist.h \ error.h event.h \ eventclass.h heap.h int.h interfaceiter.h lang.h lex.h lib.h \ - list.h mem.h msgcat.h mutexblock.h netaddr.h rbtgen.h \ - region.h result.h \ + list.h magic.h mem.h msgcat.h mutexblock.h netaddr.h \ + rbtgen.h region.h result.h \ resultclass.h rwlock.h serial.h sockaddr.h socket.h str.h \ symtab.h task.h timer.h types.h diff --git a/lib/isc/include/isc/magic.h b/lib/isc/include/isc/magic.h new file mode 100644 index 0000000000..b491a5c9d0 --- /dev/null +++ b/lib/isc/include/isc/magic.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 1999 Internet Software Consortium. + * + * 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. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#ifndef ISC_MAGIC_H +#define ISC_MAGIC_H + +#include + +ISC_LANG_BEGINDECLS + +#define ISC_MAGIC_VALID(a,b) (((a) != NULL) && ((a)->magic == (b))) + +ISC_LANG_ENDDECLS + +#endif /* ISC_MAGIC_H */