Merge branch 'vendor/LESS' into less_update
[dragonfly.git] / contrib / bind-9.5.2 / lib / isccc / include / isccc / cc.h
1 /*
2  * Portions Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
3  * Portions Copyright (C) 2001  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY
12  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  *
17  * Portions Copyright (C) 2001  Nominum, Inc.
18  *
19  * Permission to use, copy, modify, and/or distribute this software for any
20  * purpose with or without fee is hereby granted, provided that the above
21  * copyright notice and this permission notice appear in all copies.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
24  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
25  * OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY
26  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
27  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
28  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
29  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
30  */
31
32 /* $Id: cc.h,v 1.11 2007/08/28 07:20:43 tbox Exp $ */
33
34 #ifndef ISCCC_CC_H
35 #define ISCCC_CC_H 1
36
37 /*! \file isccc/cc.h */
38
39 #include <isc/lang.h>
40 #include <isccc/types.h>
41
42 ISC_LANG_BEGINDECLS
43
44 /*% Maximum Datagram Package */
45 #define ISCCC_CC_MAXDGRAMPACKET         4096
46
47 /*% Message Type String */
48 #define ISCCC_CCMSGTYPE_STRING          0x00
49 /*% Message Type Binary Data */
50 #define ISCCC_CCMSGTYPE_BINARYDATA      0x01
51 /*% Message Type Table */
52 #define ISCCC_CCMSGTYPE_TABLE           0x02
53 /*% Message Type List */
54 #define ISCCC_CCMSGTYPE_LIST            0x03
55
56 /*% Send to Wire */
57 isc_result_t
58 isccc_cc_towire(isccc_sexpr_t *alist, isccc_region_t *target,
59               isccc_region_t *secret);
60
61 /*% Get From Wire */
62 isc_result_t
63 isccc_cc_fromwire(isccc_region_t *source, isccc_sexpr_t **alistp,
64                 isccc_region_t *secret);
65
66 /*% Create Message */
67 isc_result_t
68 isccc_cc_createmessage(isc_uint32_t version, const char *from, const char *to,
69                      isc_uint32_t serial, isccc_time_t now,
70                      isccc_time_t expires, isccc_sexpr_t **alistp);
71
72 /*% Create Acknowledgment */
73 isc_result_t
74 isccc_cc_createack(isccc_sexpr_t *message, isc_boolean_t ok,
75                  isccc_sexpr_t **ackp);
76
77 /*% Is Ack? */
78 isc_boolean_t
79 isccc_cc_isack(isccc_sexpr_t *message);
80
81 /*% Is Reply? */
82 isc_boolean_t
83 isccc_cc_isreply(isccc_sexpr_t *message);
84
85 /*% Create Response */
86 isc_result_t
87 isccc_cc_createresponse(isccc_sexpr_t *message, isccc_time_t now,
88                       isccc_time_t expires, isccc_sexpr_t **alistp);
89
90 /*% Define String */
91 isccc_sexpr_t *
92 isccc_cc_definestring(isccc_sexpr_t *alist, const char *key, const char *str);
93
94 /*% Define uint 32 */
95 isccc_sexpr_t *
96 isccc_cc_defineuint32(isccc_sexpr_t *alist, const char *key, isc_uint32_t i);
97
98 /*% Lookup String */
99 isc_result_t
100 isccc_cc_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp);
101
102 /*% Lookup uint 32 */
103 isc_result_t
104 isccc_cc_lookupuint32(isccc_sexpr_t *alist, const char *key,
105                     isc_uint32_t *uintp);
106
107 /*% Create Symbol Table */
108 isc_result_t
109 isccc_cc_createsymtab(isccc_symtab_t **symtabp);
110
111 /*% Clean up Symbol Table */
112 void
113 isccc_cc_cleansymtab(isccc_symtab_t *symtab, isccc_time_t now);
114
115 /*% Check for Duplicates */
116 isc_result_t
117 isccc_cc_checkdup(isccc_symtab_t *symtab, isccc_sexpr_t *message,
118                    isccc_time_t now);
119
120 ISC_LANG_ENDDECLS
121
122 #endif /* ISCCC_CC_H */