1 /*	$NetBSD: isclib.h,v 1.1.1.2 2014/07/12 11:57:57 spz Exp $	*/
2 /* isclib.h
3 
4    connections to the isc and dns libraries */
5 
6 /*
7  * Copyright (c) 2009,2013 by Internet Systems Consortium, Inc. ("ISC")
8  *
9  * Permission to use, copy, modify, and distribute this software for any
10  * purpose with or without fee is hereby granted, provided that the above
11  * copyright notice and this permission notice appear in all copies.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
16  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  *
21  *   Internet Systems Consortium, Inc.
22  *   950 Charter Street
23  *   Redwood City, CA 94063
24  *   <info@isc.org>
25  *   http://www.isc.org/
26  *
27  */
28 
29 #ifndef ISCLIB_H
30 #define ISCLIB_H
31 
32 #include "config.h"
33 
34 #include <syslog.h>
35 
36 #define MAXWIRE 256
37 
38 #include <sys/types.h>
39 #include <sys/socket.h>
40 
41 #include <netinet/in.h>
42 
43 #include <arpa/inet.h>
44 
45 #include <unistd.h>
46 #include <ctype.h>
47 #include <stdio.h>
48 #include <stdlib.h>
49 #include <string.h>
50 #include <netdb.h>
51 
52 #include <isc/buffer.h>
53 #include <isc/lex.h>
54 #include <isc/lib.h>
55 #include <isc/app.h>
56 #include <isc/mem.h>
57 #include <isc/parseint.h>
58 #include <isc/socket.h>
59 #include <isc/sockaddr.h>
60 #include <isc/task.h>
61 #include <isc/timer.h>
62 #include <isc/heap.h>
63 #include <isc/random.h>
64 
65 #include <irs/resconf.h>
66 
67 #include <dns/client.h>
68 #include <dns/fixedname.h>
69 #include <dns/keyvalues.h>
70 #include <dns/lib.h>
71 #include <dns/name.h>
72 #include <dns/rdata.h>
73 #include <dns/rdataclass.h>
74 #include <dns/rdatalist.h>
75 #include <dns/rdataset.h>
76 #include <dns/rdatastruct.h>
77 #include <dns/rdatatype.h>
78 #include <dns/result.h>
79 #include <dns/secalg.h>
80 #include <dns/tsec.h>
81 
82 #include <dst/dst.h>
83 
84 #include "result.h"
85 
86 
87 /*
88  * DHCP context structure
89  * This holds the libisc information for a dhcp entity
90  */
91 
92 typedef struct dhcp_context {
93 	isc_mem_t	*mctx;
94 	isc_appctx_t	*actx;
95 	int              actx_started;
96 	isc_taskmgr_t	*taskmgr;
97 	isc_task_t	*task;
98 	isc_socketmgr_t *socketmgr;
99 	isc_timermgr_t	*timermgr;
100 #if defined (NSUPDATE)
101   	dns_client_t    *dnsclient;
102 #endif
103 } dhcp_context_t;
104 
105 extern dhcp_context_t dhcp_gbl_ctx;
106 
107 #define DHCP_MAXDNS_WIRE 256
108 #define DHCP_MAXNS         3
109 #define DHCP_HMAC_MD5_NAME "HMAC-MD5.SIG-ALG.REG.INT."
110 
111 isc_result_t dhcp_isc_name(unsigned char    *namestr,
112 			   dns_fixedname_t  *namefix,
113 			   dns_name_t      **name);
114 
115 isc_result_t
116 isclib_make_dst_key(char          *inname,
117 		    char          *algorithm,
118 		    unsigned char *secret,
119 		    int            length,
120 		    dst_key_t    **dstkey);
121 
122 #define DHCP_CONTEXT_PRE_DB  1
123 #define DHCP_CONTEXT_POST_DB 2
124 isc_result_t dhcp_context_create(int              flags,
125 				 struct in_addr  *local4,
126 				 struct in6_addr *local6);
127 void isclib_cleanup(void);
128 
129 void dhcp_signal_handler(int signal);
130 extern int shutdown_signal;
131 
132 #endif /* ISCLIB_H */
133