xref: /netbsd-src/external/mpl/bind/dist/lib/isc/include/isc/types.h (revision c2d18a95984d618d94f261361000142d37ac53d9)
1 /*	$NetBSD: types.h,v 1.14 2025/01/27 02:16:05 christos Exp $	*/
2 
3 /*
4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5  *
6  * SPDX-License-Identifier: MPL-2.0
7  *
8  * This Source Code Form is subject to the terms of the Mozilla Public
9  * License, v. 2.0. If a copy of the MPL was not distributed with this
10  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
11  *
12  * See the COPYRIGHT file distributed with this work for additional
13  * information regarding copyright ownership.
14  */
15 
16 #pragma once
17 
18 #include <isc/atomic.h>
19 #include <isc/result.h>
20 
21 /*! \file isc/types.h
22  * \brief
23  * OS-specific types, from the OS-specific include directories.
24  */
25 #include <limits.h>
26 #include <stdbool.h>
27 #include <stddef.h>
28 #include <stdint.h>
29 
30 /*
31  * XXXDCL This is just for ISC_LIST and ISC_LINK, but gets all of the other
32  * list macros too.
33  */
34 #include <isc/list.h>
35 
36 /* Core Types.  Alphabetized by defined type. */
37 
38 typedef struct isc_buffer isc_buffer_t;			  /*%< Buffer */
39 typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t;	  /*%< Buffer List */
40 typedef struct isc_constregion	   isc_constregion_t;	  /*%< Const region */
41 typedef struct isc_consttextregion isc_consttextregion_t; /*%< Const Text Region
42 							   */
43 typedef struct isc_counter isc_counter_t;		  /*%< Counter */
44 typedef struct isc_hash	   isc_hash_t;			  /*%< Hash */
45 typedef struct isc_httpd   isc_httpd_t;			  /*%< HTTP client */
46 typedef void(isc_httpdfree_t)(isc_buffer_t *, void *); /*%< HTTP free function
47 							*/
48 typedef struct isc_httpdmgr isc_httpdmgr_t;	       /*%< HTTP manager */
49 typedef struct isc_httpdurl isc_httpdurl_t;	       /*%< HTTP URL */
50 typedef void(isc_httpdondestroy_t)(void *); /*%< Callback on destroying httpd */
51 typedef struct isc_interface	 isc_interface_t;     /*%< Interface */
52 typedef struct isc_interfaceiter isc_interfaceiter_t; /*%< Interface Iterator */
53 typedef struct isc_lex		 isc_lex_t;	      /*%< Lex */
54 typedef struct isc_log		 isc_log_t;	      /*%< Log */
55 typedef struct isc_logcategory	 isc_logcategory_t;   /*%< Log Category */
56 typedef struct isc_logconfig	 isc_logconfig_t;     /*%< Log Configuration */
57 typedef struct isc_logmodule	 isc_logmodule_t;     /*%< Log Module */
58 typedef struct isc_loop		 isc_loop_t;	      /*%< Event loop */
59 typedef struct isc_loopmgr	 isc_loopmgr_t;	      /*%< Event loop manager */
60 typedef struct isc_mem		 isc_mem_t;	      /*%< Memory */
61 typedef struct isc_mempool	 isc_mempool_t;	      /*%< Memory Pool */
62 typedef struct isc_netaddr	 isc_netaddr_t;	      /*%< Net Address */
63 typedef struct isc_netprefix	 isc_netprefix_t;     /*%< Net Prefix */
64 typedef struct isc_nm		 isc_nm_t;	      /*%< Network manager */
65 typedef struct isc_nmsocket	 isc_nmsocket_t; /*%< Network manager socket */
66 typedef struct isc_nmhandle	 isc_nmhandle_t; /*%< Network manager handle */
67 typedef struct isc_portset	 isc_portset_t;	 /*%< Port Set */
68 typedef struct isc_quota	 isc_quota_t;	 /*%< Quota */
69 typedef struct isc_ratelimiter	 isc_ratelimiter_t;  /*%< Rate Limiter */
70 typedef struct isc_region	 isc_region_t;	     /*%< Region */
71 typedef struct isc_rlevent	 isc_rlevent_t;	     /*%< Rate Limiter Event */
72 typedef struct isc_signal	 isc_signal_t;	     /*%< Signal handler */
73 typedef struct isc_sockaddr	 isc_sockaddr_t;     /*%< Socket Address */
74 typedef ISC_LIST(isc_sockaddr_t) isc_sockaddrlist_t; /*%< Socket Address List
75 						      * */
76 typedef struct isc_stats      isc_stats_t;	     /*%< Statistics */
77 #ifdef _LP64
78 typedef int_fast64_t	      isc_statscounter_t;
79 typedef atomic_int_fast64_t   isc_atomic_statscounter_t;
80 #else
81 typedef int_fast32_t	      isc_statscounter_t;
82 typedef atomic_int_fast32_t   isc_atomic_statscounter_t;
83 #endif
84 typedef struct isc_symtab     isc_symtab_t;	/*%< Symbol Table */
85 typedef struct isc_textregion isc_textregion_t; /*%< Text Region */
86 typedef struct isc_time	      isc_time_t;	/*%< Time */
87 typedef struct isc_timer      isc_timer_t;	/*%< Timer */
88 typedef struct isc_work	      isc_work_t;	/*%< Work offloaded to an
89 						 *   external thread */
90 
91 #if HAVE_LIBNGHTTP2
92 typedef struct isc_nm_http_endpoints isc_nm_http_endpoints_t;
93 /*%< HTTP endpoints set */
94 #endif /* HAVE_LIBNGHTTP2 */
95 
96 /*% Statistics formats (text file or XML) */
97 typedef enum {
98 	isc_statsformat_file,
99 	isc_statsformat_xml,
100 	isc_statsformat_json
101 } isc_statsformat_t;
102 
103 typedef enum isc_nmsocket_type {
104 	isc_nm_nonesocket = 0,
105 	isc_nm_udpsocket = 1 << 1,
106 	isc_nm_tcpsocket = 1 << 2,
107 	isc_nm_tlssocket = 1 << 3,
108 	isc_nm_httpsocket = 1 << 4,
109 	isc_nm_streamdnssocket = 1 << 5,
110 	isc_nm_proxystreamsocket = 1 << 6,
111 	isc_nm_proxyudpsocket = 1 << 7,
112 	isc_nm_maxsocket,
113 
114 	isc_nm_udplistener, /* Aggregate of nm_udpsocks */
115 	isc_nm_tcplistener,
116 	isc_nm_tlslistener,
117 	isc_nm_httplistener,
118 	isc_nm_streamdnslistener,
119 	isc_nm_proxystreamlistener,
120 	isc_nm_proxyudplistener
121 } isc_nmsocket_type;
122 
123 typedef isc_nmsocket_type isc_nmsocket_type_t;
124