xref: /freebsd/contrib/unbound/smallapp/worker_cb.c (revision 7a789145f88a6aceacc59029a0cafe7de7aeefea)
1 /*
2  * smallapp/worker_cb.c - fake callback routines to make fptr_wlist work
3  *
4  * Copyright (c) 2007, NLnet Labs. All rights reserved.
5  *
6  * This software is open source.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * Neither the name of the NLNET LABS nor the names of its contributors may
20  * be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 /**
37  * \file
38  *
39  * This file contains fake callback functions, so that the symbols exist
40  * and the fptr_wlist continues to work even if the daemon/worker is not
41  * linked into the resulting program.
42  */
43 #include "config.h"
44 #include "libunbound/context.h"
45 #include "libunbound/worker.h"
46 #include "libunbound/remote.h"
47 #include "util/fptr_wlist.h"
48 #include "util/log.h"
49 #include "services/mesh.h"
50 #ifdef USE_DNSTAP
51 #include "dnstap/dtstream.h"
52 #endif
53 
worker_handle_control_cmd(struct tube * ATTR_UNUSED (tube),uint8_t * ATTR_UNUSED (buffer),size_t ATTR_UNUSED (len),int ATTR_UNUSED (error),void * ATTR_UNUSED (arg))54 void worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
55 	uint8_t* ATTR_UNUSED(buffer), size_t ATTR_UNUSED(len),
56 	int ATTR_UNUSED(error), void* ATTR_UNUSED(arg))
57 {
58 	log_assert(0);
59 }
60 
worker_handle_request(struct comm_point * ATTR_UNUSED (c),void * ATTR_UNUSED (arg),int ATTR_UNUSED (error),struct comm_reply * ATTR_UNUSED (repinfo))61 int worker_handle_request(struct comm_point* ATTR_UNUSED(c),
62 	void* ATTR_UNUSED(arg), int ATTR_UNUSED(error),
63         struct comm_reply* ATTR_UNUSED(repinfo))
64 {
65 	log_assert(0);
66 	return 0;
67 }
68 
worker_handle_service_reply(struct comm_point * ATTR_UNUSED (c),void * ATTR_UNUSED (arg),int ATTR_UNUSED (error),struct comm_reply * ATTR_UNUSED (reply_info))69 int worker_handle_service_reply(struct comm_point* ATTR_UNUSED(c),
70 	void* ATTR_UNUSED(arg), int ATTR_UNUSED(error),
71         struct comm_reply* ATTR_UNUSED(reply_info))
72 {
73 	log_assert(0);
74 	return 0;
75 }
76 
remote_accept_callback(struct comm_point * ATTR_UNUSED (c),void * ATTR_UNUSED (arg),int ATTR_UNUSED (error),struct comm_reply * ATTR_UNUSED (repinfo))77 int remote_accept_callback(struct comm_point* ATTR_UNUSED(c),
78 	void* ATTR_UNUSED(arg), int ATTR_UNUSED(error),
79         struct comm_reply* ATTR_UNUSED(repinfo))
80 {
81 	log_assert(0);
82 	return 0;
83 }
84 
remote_control_callback(struct comm_point * ATTR_UNUSED (c),void * ATTR_UNUSED (arg),int ATTR_UNUSED (error),struct comm_reply * ATTR_UNUSED (repinfo))85 int remote_control_callback(struct comm_point* ATTR_UNUSED(c),
86 	void* ATTR_UNUSED(arg), int ATTR_UNUSED(error),
87         struct comm_reply* ATTR_UNUSED(repinfo))
88 {
89 	log_assert(0);
90 	return 0;
91 }
92 
worker_sighandler(int ATTR_UNUSED (sig),void * ATTR_UNUSED (arg))93 void worker_sighandler(int ATTR_UNUSED(sig), void* ATTR_UNUSED(arg))
94 {
95 	log_assert(0);
96 }
97 
worker_send_query(struct query_info * ATTR_UNUSED (qinfo),uint16_t ATTR_UNUSED (flags),int ATTR_UNUSED (dnssec),int ATTR_UNUSED (want_dnssec),int ATTR_UNUSED (nocaps),int ATTR_UNUSED (check_ratelimit),struct sockaddr_storage * ATTR_UNUSED (addr),socklen_t ATTR_UNUSED (addrlen),uint8_t * ATTR_UNUSED (zone),size_t ATTR_UNUSED (zonelen),int ATTR_UNUSED (tcp_upstream),int ATTR_UNUSED (ssl_upstream),char * ATTR_UNUSED (tls_auth_name),struct module_qstate * ATTR_UNUSED (q),int * ATTR_UNUSED (was_ratelimited),int * ATTR_UNUSED (ratelimit_incremented))98 struct outbound_entry* worker_send_query(
99 	struct query_info* ATTR_UNUSED(qinfo), uint16_t ATTR_UNUSED(flags),
100 	int ATTR_UNUSED(dnssec), int ATTR_UNUSED(want_dnssec),
101 	int ATTR_UNUSED(nocaps), int ATTR_UNUSED(check_ratelimit),
102 	struct sockaddr_storage* ATTR_UNUSED(addr),
103 	socklen_t ATTR_UNUSED(addrlen), uint8_t* ATTR_UNUSED(zone),
104 	size_t ATTR_UNUSED(zonelen), int ATTR_UNUSED(tcp_upstream), int ATTR_UNUSED(ssl_upstream),
105 	char* ATTR_UNUSED(tls_auth_name), struct module_qstate* ATTR_UNUSED(q),
106 	int* ATTR_UNUSED(was_ratelimited), int* ATTR_UNUSED(ratelimit_incremented))
107 {
108 	log_assert(0);
109 	return 0;
110 }
111 
112 #ifdef UB_ON_WINDOWS
113 void
worker_win_stop_cb(int ATTR_UNUSED (fd),short ATTR_UNUSED (ev),void * ATTR_UNUSED (arg))114 worker_win_stop_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev), void*
115 	ATTR_UNUSED(arg)) {
116 	log_assert(0);
117 }
118 
119 void
wsvc_cron_cb(void * ATTR_UNUSED (arg))120 wsvc_cron_cb(void* ATTR_UNUSED(arg))
121 {
122 	log_assert(0);
123 }
124 #endif /* UB_ON_WINDOWS */
125 
126 void
worker_alloc_cleanup(void * ATTR_UNUSED (arg))127 worker_alloc_cleanup(void* ATTR_UNUSED(arg))
128 {
129 	log_assert(0);
130 }
131 
132 void
libworker_alloc_cleanup(void * ATTR_UNUSED (arg))133 libworker_alloc_cleanup(void* ATTR_UNUSED(arg))
134 {
135 	log_assert(0);
136 }
137 
libworker_send_query(struct query_info * ATTR_UNUSED (qinfo),uint16_t ATTR_UNUSED (flags),int ATTR_UNUSED (dnssec),int ATTR_UNUSED (want_dnssec),int ATTR_UNUSED (nocaps),int ATTR_UNUSED (check_ratelimit),struct sockaddr_storage * ATTR_UNUSED (addr),socklen_t ATTR_UNUSED (addrlen),uint8_t * ATTR_UNUSED (zone),size_t ATTR_UNUSED (zonelen),int ATTR_UNUSED (tcp_upstream),int ATTR_UNUSED (ssl_upstream),char * ATTR_UNUSED (tls_auth_name),struct module_qstate * ATTR_UNUSED (q),int * ATTR_UNUSED (was_ratelimited),int * ATTR_UNUSED (ratelimit_incremented))138 struct outbound_entry* libworker_send_query(
139 	struct query_info* ATTR_UNUSED(qinfo), uint16_t ATTR_UNUSED(flags),
140 	int ATTR_UNUSED(dnssec), int ATTR_UNUSED(want_dnssec),
141 	int ATTR_UNUSED(nocaps), int ATTR_UNUSED(check_ratelimit),
142 	struct sockaddr_storage* ATTR_UNUSED(addr),
143 	socklen_t ATTR_UNUSED(addrlen), uint8_t* ATTR_UNUSED(zone),
144 	size_t ATTR_UNUSED(zonelen), int ATTR_UNUSED(tcp_upstream), int ATTR_UNUSED(ssl_upstream),
145 	char* ATTR_UNUSED(tls_auth_name), struct module_qstate* ATTR_UNUSED(q),
146 	int* ATTR_UNUSED(was_ratelimited), int* ATTR_UNUSED(ratelimit_incremented))
147 {
148 	log_assert(0);
149 	return 0;
150 }
151 
libworker_handle_service_reply(struct comm_point * ATTR_UNUSED (c),void * ATTR_UNUSED (arg),int ATTR_UNUSED (error),struct comm_reply * ATTR_UNUSED (reply_info))152 int libworker_handle_service_reply(struct comm_point* ATTR_UNUSED(c),
153 	void* ATTR_UNUSED(arg), int ATTR_UNUSED(error),
154         struct comm_reply* ATTR_UNUSED(reply_info))
155 {
156 	log_assert(0);
157 	return 0;
158 }
159 
libworker_handle_control_cmd(struct tube * ATTR_UNUSED (tube),uint8_t * ATTR_UNUSED (buffer),size_t ATTR_UNUSED (len),int ATTR_UNUSED (error),void * ATTR_UNUSED (arg))160 void libworker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
161         uint8_t* ATTR_UNUSED(buffer), size_t ATTR_UNUSED(len),
162         int ATTR_UNUSED(error), void* ATTR_UNUSED(arg))
163 {
164         log_assert(0);
165 }
166 
libworker_fg_done_cb(void * ATTR_UNUSED (arg),int ATTR_UNUSED (rcode),struct sldns_buffer * ATTR_UNUSED (buf),enum sec_status ATTR_UNUSED (s),char * ATTR_UNUSED (why_bogus),int ATTR_UNUSED (was_ratelimited))167 void libworker_fg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode),
168 	struct sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s),
169 	char* ATTR_UNUSED(why_bogus), int ATTR_UNUSED(was_ratelimited))
170 {
171 	log_assert(0);
172 }
173 
libworker_bg_done_cb(void * ATTR_UNUSED (arg),int ATTR_UNUSED (rcode),struct sldns_buffer * ATTR_UNUSED (buf),enum sec_status ATTR_UNUSED (s),char * ATTR_UNUSED (why_bogus),int ATTR_UNUSED (was_ratelimited))174 void libworker_bg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode),
175 	struct sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s),
176 	char* ATTR_UNUSED(why_bogus), int ATTR_UNUSED(was_ratelimited))
177 {
178 	log_assert(0);
179 }
180 
libworker_event_done_cb(void * ATTR_UNUSED (arg),int ATTR_UNUSED (rcode),struct sldns_buffer * ATTR_UNUSED (buf),enum sec_status ATTR_UNUSED (s),char * ATTR_UNUSED (why_bogus),int ATTR_UNUSED (was_ratelimited))181 void libworker_event_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode),
182 	struct sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s),
183 	char* ATTR_UNUSED(why_bogus), int ATTR_UNUSED(was_ratelimited))
184 {
185 	log_assert(0);
186 }
187 
context_query_cmp(const void * ATTR_UNUSED (a),const void * ATTR_UNUSED (b))188 int context_query_cmp(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
189 {
190 	log_assert(0);
191 	return 0;
192 }
193 
worker_stat_timer_cb(void * ATTR_UNUSED (arg))194 void worker_stat_timer_cb(void* ATTR_UNUSED(arg))
195 {
196 	log_assert(0);
197 }
198 
worker_probe_timer_cb(void * ATTR_UNUSED (arg))199 void worker_probe_timer_cb(void* ATTR_UNUSED(arg))
200 {
201 	log_assert(0);
202 }
203 
worker_start_accept(void * ATTR_UNUSED (arg))204 void worker_start_accept(void* ATTR_UNUSED(arg))
205 {
206 	log_assert(0);
207 }
208 
worker_stop_accept(void * ATTR_UNUSED (arg))209 void worker_stop_accept(void* ATTR_UNUSED(arg))
210 {
211 	log_assert(0);
212 }
213 
214 /** keep track of lock id in lock-verify application */
215 struct order_id {
216         /** the thread id that created it */
217         int thr;
218         /** the instance number of creation */
219         int instance;
220 };
221 
order_lock_cmp(const void * e1,const void * e2)222 int order_lock_cmp(const void* e1, const void* e2)
223 {
224         const struct order_id* o1 = e1;
225         const struct order_id* o2 = e2;
226         if(o1->thr < o2->thr) return -1;
227         if(o1->thr > o2->thr) return 1;
228         if(o1->instance < o2->instance) return -1;
229         if(o1->instance > o2->instance) return 1;
230         return 0;
231 }
232 
233 int
codeline_cmp(const void * a,const void * b)234 codeline_cmp(const void* a, const void* b)
235 {
236         return strcmp(a, b);
237 }
238 
replay_var_compare(const void * ATTR_UNUSED (a),const void * ATTR_UNUSED (b))239 int replay_var_compare(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
240 {
241         log_assert(0);
242         return 0;
243 }
244 
remote_get_opt_ssl(char * ATTR_UNUSED (str),void * ATTR_UNUSED (arg))245 void remote_get_opt_ssl(char* ATTR_UNUSED(str), void* ATTR_UNUSED(arg))
246 {
247         log_assert(0);
248 }
249 
250 #ifdef USE_DNSTAP
dtio_tap_callback(int ATTR_UNUSED (fd),short ATTR_UNUSED (ev),void * ATTR_UNUSED (arg))251 void dtio_tap_callback(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
252 	void* ATTR_UNUSED(arg))
253 {
254 	log_assert(0);
255 }
256 #endif
257 
258 #ifdef USE_DNSTAP
dtio_mainfdcallback(int ATTR_UNUSED (fd),short ATTR_UNUSED (ev),void * ATTR_UNUSED (arg))259 void dtio_mainfdcallback(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
260 	void* ATTR_UNUSED(arg))
261 {
262 	log_assert(0);
263 }
264 #endif
265 
fast_reload_service_cb(int ATTR_UNUSED (fd),short ATTR_UNUSED (ev),void * ATTR_UNUSED (arg))266 void fast_reload_service_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
267 	void* ATTR_UNUSED(arg))
268 {
269 	log_assert(0);
270 }
271 
fast_reload_client_callback(struct comm_point * ATTR_UNUSED (c),void * ATTR_UNUSED (arg),int ATTR_UNUSED (error),struct comm_reply * ATTR_UNUSED (repinfo))272 int fast_reload_client_callback(struct comm_point* ATTR_UNUSED(c),
273 	void* ATTR_UNUSED(arg), int ATTR_UNUSED(error),
274         struct comm_reply* ATTR_UNUSED(repinfo))
275 {
276 	log_assert(0);
277 	return 0;
278 }
279 
280 #ifdef HAVE_NGTCP2
doq_client_event_cb(int ATTR_UNUSED (fd),short ATTR_UNUSED (ev),void * ATTR_UNUSED (arg))281 void doq_client_event_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
282 	void* ATTR_UNUSED(arg))
283 {
284 	log_assert(0);
285 }
286 #endif
287 
288 #ifdef HAVE_NGTCP2
doq_client_timer_cb(int ATTR_UNUSED (fd),short ATTR_UNUSED (ev),void * ATTR_UNUSED (arg))289 void doq_client_timer_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
290 	void* ATTR_UNUSED(arg))
291 {
292 	log_assert(0);
293 }
294 #endif
295