C++ compatibility

This commit is contained in:
Bob Halley 1999-03-04 02:38:48 +00:00
parent cc884bc809
commit 7aacbd685b
26 changed files with 156 additions and 20 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1997, 1998 Internet Software Consortium.
* Copyright (C) 1997, 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
@ -16,12 +16,16 @@
*/
/*
* $Id: assertions.h,v 1.3 1998/12/13 23:45:03 halley Exp $
* $Id: assertions.h,v 1.4 1999/03/04 02:38:47 halley Exp $
*/
#ifndef ISC_ASSERTIONS_H
#define ISC_ASSERTIONS_H 1
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
typedef enum {
isc_assertiontype_require,
isc_assertiontype_ensure,
@ -107,4 +111,6 @@ char *isc_assertion_typetotext(isc_assertiontype_t type);
#define INVARIANT(cond) ((void) 0)
#endif /* CHECK_INVARIANT */
ISC_LANG_ENDDECLS
#endif /* ISC_ASSERTIONS_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1998 Internet Software Consortium.
* 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
@ -18,9 +18,15 @@
#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 */

View file

@ -82,9 +82,12 @@
*** Imports
***/
#include <isc/lang.h>
#include <isc/region.h>
#include <isc/int.h>
ISC_LANG_BEGINDECLS
/***
*** Types
***/
@ -417,4 +420,6 @@ isc_buffer_putuint32(isc_buffer_t *b, isc_uint32_t val);
* The used pointer in 'b' is advanced by 4.
*/
ISC_LANG_ENDDECLS
#endif /* ISC_BUFFER_H */

View file

@ -20,6 +20,10 @@
#include <stdarg.h>
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
typedef void (*isc_errorcallback_t)(char *, int, char *, va_list);
void isc_error_setunexpected(isc_errorcallback_t);
@ -34,4 +38,6 @@ void isc_error_runtimecheck(char *, int, char *);
((void) ((cond) || \
((isc_error_runtimecheck)(__FILE__, __LINE__, #cond), 0)))
ISC_LANG_ENDDECLS
#endif /* ISC_ERROR_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1998 Internet Software Consortium.
* 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
@ -18,6 +18,10 @@
#ifndef ISC_EVENT_H
#define ISC_EVENT_H 1
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
/***
*** Registry of Predefined Event Type Classes
***/
@ -30,7 +34,7 @@
* Event number zero is always reserved in each class.
*/
#define ISC_EVENTCLASS(class) ((class) << 16)
#define ISC_EVENTCLASS(eclass) ((eclass) << 16)
#define ISC_EVENTCLASS_TASK ISC_EVENTCLASS(0)
#define ISC_EVENTCLASS_TIMER ISC_EVENTCLASS(1)
@ -41,4 +45,6 @@
* Event classes >= 1024 and <= 32767 are reserved for application use.
*/
ISC_LANG_ENDDECLS
#endif /* ISC_EVENT_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1997, 1998 Internet Software Consortium.
* Copyright (C) 1997, 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
@ -15,10 +15,16 @@
* SOFTWARE.
*/
#ifndef ISC_HEAP_H
#define ISC_HEAP_H 1
#include <isc/lang.h>
#include <isc/result.h>
#include <isc/boolean.h>
#include <isc/mem.h>
ISC_LANG_BEGINDECLS
/*
* The comparision function returns ISC_TRUE if the first argument has
* higher priority than the second argument, and ISC_FALSE otherwise.
@ -39,3 +45,7 @@ void isc_heap_increased(isc_heap_t *, unsigned int);
void isc_heap_decreased(isc_heap_t *, unsigned int);
void * isc_heap_element(isc_heap_t *, unsigned int);
void isc_heap_foreach(isc_heap_t *, isc_heapaction_t, void *);
ISC_LANG_ENDDECLS
#endif /* ISC_HEAP_H */

View file

@ -18,6 +18,10 @@
#ifndef ISC_INET_H
#define ISC_INET_H 1
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
/*
* Provide missing functionality that functions internal to the isc/dns
* library will need.
@ -49,4 +53,6 @@ int isc_inet_aton(const char *cp, struct in_addr *addr);
#define isc_inet_aton inet_aton
#endif
ISC_LANG_ENDDECLS
#endif /* ISC_INET_H */

View file

@ -18,6 +18,10 @@
#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;
@ -27,4 +31,6 @@ 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 */

View file

@ -54,10 +54,12 @@
#include <stdio.h>
#include <stddef.h>
#include <isc/lang.h>
#include <isc/buffer.h>
#include <isc/result.h>
#include <isc/mem.h>
ISC_LANG_BEGINDECLS
/***
*** Options
@ -337,4 +339,6 @@ isc_lex_getsourceline(isc_lex_t *lex);
* Current line number or 0 if no current source.
*/
ISC_LANG_ENDDECLS
#endif /* ISC_LEX_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1997, 1998 Internet Software Consortium.
* Copyright (C) 1997, 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
@ -22,8 +22,11 @@
#include <stddef.h>
#include <isc/boolean.h>
#include <isc/lang.h>
#include <isc/result.h>
ISC_LANG_BEGINDECLS
typedef struct isc_mem isc_mem_t;
#ifdef ISC_MEM_DEBUG
@ -78,4 +81,6 @@ void memstats(FILE *);
#endif /* ISC_MEMCLUSTER_LEGACY */
ISC_LANG_ENDDECLS
#endif /* MEM_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1998 Internet Software Consortium.
* 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

View file

@ -18,6 +18,10 @@
#ifndef ISC_REGION_H
#define ISC_REGION_H 1
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
typedef struct isc_region {
unsigned char * base;
unsigned int length;
@ -51,4 +55,6 @@ typedef struct isc_textregion {
__r->length -= __l; \
} while (0)
ISC_LANG_ENDDECLS
#endif /* ISC_REGION_H */

View file

@ -18,6 +18,10 @@
#ifndef ISC_RESULT_H
#define ISC_RESULT_H 1
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
typedef unsigned int isc_result_t;
#define ISC_R_SUCCESS 0
@ -57,4 +61,6 @@ typedef unsigned int isc_result_t;
char * isc_result_totext(isc_result_t);
ISC_LANG_ENDDECLS
#endif /* ISC_RESULT_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1998 Internet Software Consortium.
* 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
@ -18,10 +18,13 @@
#ifndef ISC_RWLOCK_H
#define ISC_RWLOCK_H 1
#include <isc/lang.h>
#include <isc/result.h>
#include <isc/mutex.h>
#include <isc/condition.h>
ISC_LANG_BEGINDECLS
typedef enum {
isc_rwlocktype_read = 0,
isc_rwlocktype_write
@ -56,4 +59,6 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type);
void
isc_rwlock_destroy(isc_rwlock_t *rwl);
ISC_LANG_ENDDECLS
#endif /* ISC_RWLOCK_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1998 Internet Software Consortium.
* 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
@ -20,6 +20,10 @@
#include <netinet/in.h>
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
typedef struct isc_sockaddr {
/*
* XXX Must be big enough for all sockaddr types we care about.
@ -29,4 +33,6 @@ typedef struct isc_sockaddr {
} type;
} isc_sockaddr_t;
ISC_LANG_ENDDECLS
#endif /* ISC_SOCKADDR_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1998 Internet Software Consortium.
* 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
@ -59,15 +59,17 @@
*** Imports
***/
#include <isc/lang.h>
#include <isc/boolean.h>
#include <isc/result.h>
#include <isc/event.h>
#include <isc/task.h>
#include <isc/region.h>
#include <isc/mem.h>
#include <isc/sockaddr.h>
ISC_LANG_BEGINDECLS
/***
*** Types
***/
@ -588,4 +590,6 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp);
* All resources used by the manager have been freed.
*/
ISC_LANG_ENDDECLS
#endif /* ISC_SOCKET_H */

View file

@ -15,14 +15,17 @@
* SOFTWARE.
*/
/* $Id: str.h,v 1.1 1999/02/05 04:57:20 marka Exp $ */
/* $Id: str.h,v 1.2 1999/03/04 02:38:48 halley Exp $ */
#ifndef ISC_STR_H
#define ISC_STR_H 1
#include <isc/lang.h>
#include <isc/types.h>
isc_uint64_t isc_strtouq(char *source, char **endp, int base);
ISC_LANG_BEGINDECLS
isc_uint64_t isc_strtouq(char *source, char **endp, int base);
/*
* Convert the string pointed to by 'source' to isc_uint64_t.
*
@ -36,4 +39,6 @@ isc_uint64_t isc_strtouq(char *source, char **endp, int base);
* On error 'endp' points to 'source'.
*/
ISC_LANG_ENDDECLS
#endif /* ISC_INT_H */

View file

@ -79,6 +79,9 @@
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
/***
*** Symbol Tables.
@ -121,4 +124,6 @@ isc_symtab_define(isc_symtab_t *symtab, char *key, unsigned int type,
isc_result_t
isc_symtab_undefine(isc_symtab_t *symtab, char *key, unsigned int type);
ISC_LANG_ENDDECLS
#endif /* ISC_SYMBOL_H */

View file

@ -20,11 +20,12 @@
#include <stddef.h>
#include <isc/lang.h>
#include <isc/list.h>
#include <isc/mem.h>
#include <isc/result.h>
ISC_LANG_BEGINDECLS
/***
*** Core Types.
@ -112,4 +113,6 @@ isc_result_t isc_taskmgr_create(isc_mem_t *,
isc_taskmgr_t **);
void isc_taskmgr_destroy(isc_taskmgr_t **);
ISC_LANG_ENDDECLS
#endif /* ISC_TASK_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1998 Internet Software Consortium.
* 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
@ -74,7 +74,9 @@
#include <isc/time.h>
#include <isc/task.h>
#include <isc/event.h>
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
/***
*** Types
@ -299,4 +301,6 @@ isc_timermgr_destroy(isc_timermgr_t **managerp);
* All resources used by the manager have been freed.
*/
ISC_LANG_ENDDECLS
#endif /* ISC_TIMER_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1998 Internet Software Consortium.
* 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
@ -24,6 +24,9 @@
#include <isc/result.h>
#include <isc/mutex.h>
#include <isc/time.h>
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
typedef pthread_cond_t isc_condition_t;
@ -50,4 +53,6 @@ typedef pthread_cond_t isc_condition_t;
isc_result_t isc_condition_waituntil(isc_condition_t *, isc_mutex_t *,
isc_time_t *);
ISC_LANG_ENDDECLS
#endif /* ISC_CONDITION_H */

View file

@ -20,8 +20,11 @@
#include <pthread.h>
#include <isc/lang.h>
#include <isc/result.h>
ISC_LANG_BEGINDECLS
typedef pthread_mutex_t isc_mutex_t;
/* XXX We could do fancier error handling... */
@ -45,4 +48,6 @@ typedef pthread_mutex_t isc_mutex_t;
((pthread_mutex_destroy((mp)) == 0) ? \
ISC_R_SUCCESS : ISC_R_UNEXPECTED)
ISC_LANG_ENDDECLS
#endif /* ISC_MUTEX_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1998 Internet Software Consortium.
* 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
@ -20,8 +20,11 @@
#include <pthread.h>
#include <isc/lang.h>
#include <isc/result.h>
ISC_LANG_BEGINDECLS
typedef pthread_t isc_thread_t;
typedef void * isc_threadresult_t;
typedef void * isc_threadarg_t;
@ -40,4 +43,6 @@ typedef isc_threadresult_t (*isc_threadfunc_t)(isc_threadarg_t);
#define isc_thread_self \
(unsigned long)pthread_self
ISC_LANG_ENDDECLS
#endif /* ISC_THREAD_H */

View file

@ -18,6 +18,10 @@
#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;
@ -27,4 +31,6 @@ 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 */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1998 Internet Software Consortium.
* 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
@ -20,6 +20,10 @@
#include <netinet/in.h>
#include <isc/lang.h>
ISC_LANG_BEGINDECLS
typedef struct isc_sockaddr {
/*
* XXX Must be big enough for all sockaddr types we care about.
@ -29,4 +33,6 @@ typedef struct isc_sockaddr {
} type;
} isc_sockaddr_t;
ISC_LANG_ENDDECLS
#endif /* ISC_SOCKADDR_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 1998 Internet Software Consortium.
* 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
@ -20,9 +20,12 @@
#include <time.h>
#include <isc/lang.h>
#include <isc/result.h>
#include <isc/boolean.h>
ISC_LANG_BEGINDECLS
/***
*** Intervals
***/
@ -155,4 +158,6 @@ isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result);
* t >= epoch + i (comparing times, not pointers)
*/
ISC_LANG_ENDDECLS
#endif /* ISC_TIME_H */