1 /*
2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
7  *
8  * See the COPYRIGHT file distributed with this work for additional
9  * information regarding copyright ownership.
10  */
11 
12 #ifndef ISC_TYPES_H
13 #define ISC_TYPES_H 1
14 
15 #include <isc/bind9.h>
16 #include <isc/result.h>
17 
18 /*! \file isc/types.h
19  * \brief
20  * OS-specific types, from the OS-specific include directories.
21  */
22 #include <inttypes.h>
23 #include <stdbool.h>
24 
25 #include <isc/offset.h>
26 
27 /*
28  * XXXDCL This is just for ISC_LIST and ISC_LINK, but gets all of the other
29  * list macros too.
30  */
31 #include <isc/list.h>
32 
33 /* Core Types.  Alphabetized by defined type. */
34 
35 typedef struct isc_astack isc_astack_t;		 /*%< Array-based fast stack */
36 typedef struct isc_appctx isc_appctx_t;		 /*%< Application context */
37 typedef struct isc_buffer isc_buffer_t;		 /*%< Buffer */
38 typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t; /*%< Buffer List */
39 typedef struct isc_constregion	   isc_constregion_t;	  /*%< Const region */
40 typedef struct isc_consttextregion isc_consttextregion_t; /*%< Const Text Region
41 							   */
42 typedef struct isc_counter isc_counter_t;		  /*%< Counter */
43 typedef int16_t		   isc_dscp_t;	       /*%< Diffserv code point */
44 typedef struct isc_event   isc_event_t;	       /*%< Event */
45 typedef ISC_LIST(isc_event_t) isc_eventlist_t; /*%< Event List */
46 typedef unsigned int	isc_eventtype_t;       /*%< Event Type */
47 typedef uint32_t	isc_fsaccess_t;	       /*%< FS Access */
48 typedef struct isc_hash isc_hash_t;	       /*%< Hash */
49 typedef struct isc_hp	isc_hp_t;	       /*%< Hazard
50 						*   pointer */
51 typedef struct isc_httpd isc_httpd_t;	       /*%< HTTP client */
52 typedef void(isc_httpdfree_t)(isc_buffer_t *, void *); /*%< HTTP free function
53 							*/
54 typedef struct isc_httpdmgr isc_httpdmgr_t;	       /*%< HTTP manager */
55 typedef struct isc_httpdurl isc_httpdurl_t;	       /*%< HTTP URL */
56 typedef void(isc_httpdondestroy_t)(void *); /*%< Callback on destroying httpd */
57 typedef struct isc_interface	 isc_interface_t;     /*%< Interface */
58 typedef struct isc_interfaceiter isc_interfaceiter_t; /*%< Interface Iterator */
59 typedef struct isc_interval	 isc_interval_t;      /*%< Interval */
60 typedef struct isc_lex		 isc_lex_t;	      /*%< Lex */
61 typedef struct isc_log		 isc_log_t;	      /*%< Log */
62 typedef struct isc_logcategory	 isc_logcategory_t;   /*%< Log Category */
63 typedef struct isc_logconfig	 isc_logconfig_t;     /*%< Log Configuration */
64 typedef struct isc_logmodule	 isc_logmodule_t;     /*%< Log Module */
65 typedef struct isc_mem		 isc_mem_t;	      /*%< Memory */
66 typedef struct isc_mempool	 isc_mempool_t;	      /*%< Memory Pool */
67 typedef struct isc_netaddr	 isc_netaddr_t;	      /*%< Net Address */
68 typedef struct isc_netprefix	 isc_netprefix_t;     /*%< Net Prefix */
69 typedef struct isc_nm		 isc_nm_t;	      /*%< Network manager */
70 typedef struct isc_nmsocket	 isc_nmsocket_t; /*%< Network manager socket */
71 typedef struct isc_nmhandle	 isc_nmhandle_t; /*%< Network manager handle */
72 typedef struct isc_portset	 isc_portset_t;	 /*%< Port Set */
73 typedef struct isc_quota	 isc_quota_t;	 /*%< Quota */
74 typedef struct isc_ratelimiter	 isc_ratelimiter_t;   /*%< Rate Limiter */
75 typedef struct isc_region	 isc_region_t;	      /*%< Region */
76 typedef uint64_t		 isc_resourcevalue_t; /*%< Resource Value */
77 typedef struct isc_rwlock	 isc_rwlock_t;	      /*%< Read Write Lock */
78 typedef struct isc_sockaddr	 isc_sockaddr_t;      /*%< Socket Address */
79 typedef ISC_LIST(isc_sockaddr_t) isc_sockaddrlist_t;  /*%< Socket Address List
80 						       * */
81 typedef struct isc_socket      isc_socket_t;	      /*%< Socket */
82 typedef struct isc_socketevent isc_socketevent_t;     /*%< Socket Event */
83 typedef struct isc_socketmgr   isc_socketmgr_t;	      /*%< Socket Manager */
84 typedef struct isc_stats       isc_stats_t;	      /*%< Statistics */
85 typedef int_fast64_t	       isc_statscounter_t;
86 typedef struct isc_symtab      isc_symtab_t;	/*%< Symbol Table */
87 typedef struct isc_task	       isc_task_t;	/*%< Task */
88 typedef ISC_LIST(isc_task_t) isc_tasklist_t;	/*%< Task List */
89 typedef struct isc_taskmgr    isc_taskmgr_t;	/*%< Task Manager */
90 typedef struct isc_textregion isc_textregion_t; /*%< Text Region */
91 typedef struct isc_time	      isc_time_t;	/*%< Time */
92 typedef struct isc_timer      isc_timer_t;	/*%< Timer */
93 typedef struct isc_timermgr   isc_timermgr_t;	/*%< Timer Manager */
94 
95 #if HAVE_LIBNGHTTP2
96 typedef struct isc_nm_http_endpoints isc_nm_http_endpoints_t;
97 /*%< HTTP endpoints set */
98 #endif /* HAVE_LIBNGHTTP2 */
99 
100 typedef void (*isc_taskaction_t)(isc_task_t *, isc_event_t *);
101 
102 /* The following cannot be listed alphabetically due to forward reference */
103 typedef isc_result_t(isc_httpdaction_t)(
104 	const char *url, isc_httpdurl_t *urlinfo, const char *querystring,
105 	const char *headers, void *arg, unsigned int *retcode,
106 	const char **retmsg, const char **mimetype, isc_buffer_t *body,
107 	isc_httpdfree_t **freecb, void **freecb_args);
108 typedef bool(isc_httpdclientok_t)(const isc_sockaddr_t *, void *);
109 
110 /*% Resource */
111 typedef enum {
112 	isc_resource_coresize = 1,
113 	isc_resource_cputime,
114 	isc_resource_datasize,
115 	isc_resource_filesize,
116 	isc_resource_lockedmemory,
117 	isc_resource_openfiles,
118 	isc_resource_processes,
119 	isc_resource_residentsize,
120 	isc_resource_stacksize
121 } isc_resource_t;
122 
123 /*% Statistics formats (text file or XML) */
124 typedef enum {
125 	isc_statsformat_file,
126 	isc_statsformat_xml,
127 	isc_statsformat_json
128 } isc_statsformat_t;
129 
130 #endif /* ISC_TYPES_H */
131