mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-30 22:05:23 +00:00
libisc include files (stolen, pro tem)
This commit is contained in:
32
includes/isc/boolean.h
Normal file
32
includes/isc/boolean.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 1998, 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_BOOLEAN_H
|
||||
#define ISC_BOOLEAN_H 1
|
||||
|
||||
#include <isc/lang.h>
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
typedef enum { isc_boolean_false = 0, isc_boolean_true = 1 } isc_boolean_t;
|
||||
|
||||
#define ISC_FALSE isc_boolean_false
|
||||
#define ISC_TRUE isc_boolean_true
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif /* ISC_BOOLEAN_H */
|
36
includes/isc/int.h
Normal file
36
includes/isc/int.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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_INT_H
|
||||
#define ISC_INT_H 1
|
||||
|
||||
#include <isc/lang.h>
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
typedef char isc_int8_t;
|
||||
typedef unsigned char isc_uint8_t;
|
||||
typedef short isc_int16_t;
|
||||
typedef unsigned short isc_uint16_t;
|
||||
typedef int isc_int32_t;
|
||||
typedef unsigned int isc_uint32_t;
|
||||
typedef long long isc_int64_t;
|
||||
typedef unsigned long long isc_uint64_t;
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif /* ISC_INT_H */
|
29
includes/isc/lang.h
Normal file
29
includes/isc/lang.h
Normal file
@@ -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_LANG_H
|
||||
#define ISC_LANG_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define ISC_LANG_BEGINDECLS extern "C" {
|
||||
#define ISC_LANG_ENDDECLS }
|
||||
#else
|
||||
#define ISC_LANG_BEGINDECLS
|
||||
#define ISC_LANG_ENDDECLS
|
||||
#endif
|
||||
|
||||
#endif /* ISC_LANG_H */
|
116
includes/isc/list.h
Normal file
116
includes/isc/list.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (C) 1997, 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_LIST_H
|
||||
#define ISC_LIST_H 1
|
||||
|
||||
#define ISC_LIST(type) struct { type *head, *tail; }
|
||||
#define ISC_LIST_INIT(list) \
|
||||
do { (list).head = NULL; (list).tail = NULL; } while (0)
|
||||
|
||||
#define ISC_LINK(type) struct { type *prev, *next; }
|
||||
#define ISC_LINK_INIT(elt, link) \
|
||||
do { \
|
||||
(elt)->link.prev = (void *)(-1); \
|
||||
(elt)->link.next = (void *)(-1); \
|
||||
} while (0)
|
||||
#define ISC_LINK_LINKED(elt, link) ((elt)->link.prev != (void *)(-1))
|
||||
|
||||
#define ISC_LIST_HEAD(list) ((list).head)
|
||||
#define ISC_LIST_TAIL(list) ((list).tail)
|
||||
#define ISC_LIST_EMPTY(list) ((list).head == NULL)
|
||||
|
||||
#define ISC_LIST_PREPEND(list, elt, link) \
|
||||
do { \
|
||||
if ((list).head != NULL) \
|
||||
(list).head->link.prev = (elt); \
|
||||
else \
|
||||
(list).tail = (elt); \
|
||||
(elt)->link.prev = NULL; \
|
||||
(elt)->link.next = (list).head; \
|
||||
(list).head = (elt); \
|
||||
} while (0)
|
||||
|
||||
#define ISC_LIST_APPEND(list, elt, link) \
|
||||
do { \
|
||||
if ((list).tail != NULL) \
|
||||
(list).tail->link.next = (elt); \
|
||||
else \
|
||||
(list).head = (elt); \
|
||||
(elt)->link.prev = (list).tail; \
|
||||
(elt)->link.next = NULL; \
|
||||
(list).tail = (elt); \
|
||||
} while (0)
|
||||
|
||||
#define ISC_LIST_UNLINK(list, elt, link) \
|
||||
do { \
|
||||
if ((elt)->link.next != NULL) \
|
||||
(elt)->link.next->link.prev = (elt)->link.prev; \
|
||||
else \
|
||||
(list).tail = (elt)->link.prev; \
|
||||
if ((elt)->link.prev != NULL) \
|
||||
(elt)->link.prev->link.next = (elt)->link.next; \
|
||||
else \
|
||||
(list).head = (elt)->link.next; \
|
||||
(elt)->link.prev = (void *)(-1); \
|
||||
(elt)->link.next = (void *)(-1); \
|
||||
} while (0)
|
||||
|
||||
#define ISC_LIST_PREV(elt, link) ((elt)->link.prev)
|
||||
#define ISC_LIST_NEXT(elt, link) ((elt)->link.next)
|
||||
|
||||
#define ISC_LIST_INSERTBEFORE(list, before, elt, link) \
|
||||
do { \
|
||||
if ((before)->link.prev == NULL) \
|
||||
ISC_LIST_PREPEND(list, elt, link); \
|
||||
else { \
|
||||
(elt)->link.prev = (before)->link.prev; \
|
||||
(before)->link.prev = (elt); \
|
||||
(elt)->link.prev->link.next = (elt); \
|
||||
(elt)->link.next = (before); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ISC_LIST_INSERTAFTER(list, after, elt, link) \
|
||||
do { \
|
||||
if ((after)->link.next == NULL) \
|
||||
ISC_LIST_APPEND(list, elt, link); \
|
||||
else { \
|
||||
(elt)->link.next = (after)->link.next; \
|
||||
(after)->link.next = (elt); \
|
||||
(elt)->link.next->link.prev = (elt); \
|
||||
(elt)->link.prev = (after); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ISC_LIST_APPENDLIST(list1, list2, link) \
|
||||
do { \
|
||||
if (ISC_LIST_EMPTY(list1)) \
|
||||
(list1) = (list2); \
|
||||
else if (!ISC_LIST_EMPTY(list2)) { \
|
||||
(list1).tail->link.next = (list2).head; \
|
||||
(list2).head->link.prev = (list1).tail; \
|
||||
(list1).tail = (list2).tail; \
|
||||
(list2).head = NULL; \
|
||||
(list2).tail = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ISC_LIST_ENQUEUE(list, elt, link) ISC_LIST_APPEND(list, elt, link)
|
||||
#define ISC_LIST_DEQUEUE(list, elt, link) ISC_LIST_UNLINK(list, elt, link)
|
||||
|
||||
#endif /* ISC_LIST_H */
|
82
includes/isc/result.h
Normal file
82
includes/isc/result.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (C) 1998, 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_RESULT_H
|
||||
#define ISC_RESULT_H 1
|
||||
|
||||
#include <isc/boolean.h>
|
||||
#include <isc/lang.h>
|
||||
#include <isc/list.h>
|
||||
#include <isc/types.h>
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
#define ISC_R_SUCCESS 0
|
||||
#define ISC_R_NOMEMORY 1
|
||||
#define ISC_R_TIMEDOUT 2
|
||||
#define ISC_R_NOTHREADS 3
|
||||
#define ISC_R_ADDRNOTAVAIL 4
|
||||
#define ISC_R_ADDRINUSE 5
|
||||
#define ISC_R_NOPERM 6
|
||||
#define ISC_R_NOCONN 7
|
||||
#define ISC_R_NETUNREACH 8
|
||||
#define ISC_R_HOSTUNREACH 9
|
||||
#define ISC_R_NETDOWN 10
|
||||
#define ISC_R_HOSTDOWN 11
|
||||
#define ISC_R_CONNREFUSED 12
|
||||
#define ISC_R_NORESOURCES 13 /* not enough resources */
|
||||
#define ISC_R_EOF 14 /* end of file */
|
||||
#define ISC_R_BOUND 15 /* already bound */
|
||||
#define ISC_R_TASKDONE 16 /* task is done */
|
||||
#define ISC_R_LOCKBUSY 17
|
||||
#define ISC_R_EXISTS 18
|
||||
#define ISC_R_NOSPACE 19 /* ran out of space */
|
||||
#define ISC_R_CANCELED 20
|
||||
#define ISC_R_TASKNOSEND 21
|
||||
#define ISC_R_SHUTTINGDOWN 22 /* shutting down */
|
||||
#define ISC_R_NOTFOUND 23
|
||||
#define ISC_R_UNEXPECTEDEND 24 /* unexpected end of input */
|
||||
#define ISC_R_FAILURE 25 /* generic failure */
|
||||
#define ISC_R_IOERROR 26
|
||||
#define ISC_R_NOTIMPLEMENTED 27
|
||||
#define ISC_R_UNBALANCED 28
|
||||
#define ISC_R_NOMORE 29
|
||||
#define ISC_R_INVALIDFILE 30
|
||||
#define ISC_R_BADBASE64 31
|
||||
#define ISC_R_UNEXPECTEDTOKEN 32
|
||||
#define ISC_R_QUOTA 33
|
||||
#define ISC_R_UNEXPECTED 34
|
||||
#define ISC_R_ALREADYRUNNING 35
|
||||
#define ISC_R_HOSTUNKNOWN 36
|
||||
#define ISC_R_VERSIONMISMATCH 37
|
||||
#define ISC_R_PROTOCOLERROR 38
|
||||
#define ISC_R_INVALIDARG 39
|
||||
#define ISC_R_NOTCONNECTED 40
|
||||
#define ISC_R_NOTYET 41
|
||||
|
||||
#define ISC_R_NRESULTS 42 /* Number of results */
|
||||
|
||||
char * isc_result_totext(isc_result_t);
|
||||
isc_result_t isc_result_register(unsigned int base,
|
||||
unsigned int nresults,
|
||||
char **text,
|
||||
isc_msgcat_t *msgcat,
|
||||
int set);
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif /* ISC_RESULT_H */
|
42
includes/isc/types.h
Normal file
42
includes/isc/types.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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_TYPES_H
|
||||
#define ISC_TYPES_H 1
|
||||
|
||||
#include <isc/int.h>
|
||||
#include <isc/boolean.h>
|
||||
#include <isc/list.h>
|
||||
|
||||
/***
|
||||
*** Core Types.
|
||||
***/
|
||||
|
||||
typedef unsigned int isc_result_t;
|
||||
typedef struct isc_mem isc_mem_t;
|
||||
typedef struct isc_mempool isc_mempool_t;
|
||||
typedef struct isc_msgcat isc_msgcat_t;
|
||||
typedef unsigned int isc_eventtype_t;
|
||||
typedef struct isc_event isc_event_t;
|
||||
typedef ISC_LIST(struct isc_event) isc_eventlist_t;
|
||||
typedef struct isc_task isc_task_t;
|
||||
typedef struct isc_taskmgr isc_taskmgr_t;
|
||||
typedef struct isc_rwlock isc_rwlock_t;
|
||||
|
||||
typedef void (*isc_taskaction_t)(isc_task_t *, isc_event_t *);
|
||||
|
||||
#endif /* ISC_TYPES_H */
|
Reference in New Issue
Block a user