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