00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef SOFIA_RESOLV_SRES_RECORD_H
00026
00027 #define SOFIA_RESOLV_SRES_RECORD_H
00028
00043 #include "sofia-resolv/sres_config.h"
00044
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048
00050 typedef struct sres_common
00051 {
00052 int r_refcount;
00053 char *r_name;
00054 uint16_t r_status;
00055 uint16_t r_size;
00056 uint16_t r_type;
00057 uint16_t r_class;
00058 uint32_t r_ttl;
00059 uint16_t r_rdlen;
00060 uint16_t r_parsed;
00061 } sres_common_t;
00062
00064 enum sres_status {
00065 SRES_OK = 0,
00066 SRES_FORMAT_ERR = 1,
00067 SRES_SERVER_ERR = 2,
00068 SRES_NAME_ERR = 3,
00069 SRES_UNIMPL_ERR = 4,
00070 SRES_AUTH_ERR = 5,
00072
00073 SRES_TIMEOUT_ERR = 32,
00074 SRES_RECORD_ERR = 33,
00075 SRES_INTERNAL_ERR = 34,
00076 SRES_NETWORK_ERR = 35,
00078 _SRES_LAST_ERR
00079 };
00080
00082 typedef struct sres_soa_record
00083 {
00084 sres_common_t soa_record[1];
00085 char *soa_mname;
00086 char *soa_rname;
00087 uint32_t soa_serial;
00088 uint32_t soa_refresh;
00089 uint32_t soa_retry;
00090 uint32_t soa_expire;
00091 uint32_t soa_minimum;
00092 } sres_soa_record_t;
00093
00095 typedef struct sres_generic
00096 {
00097 sres_common_t g_record[1];
00098 uint8_t g_data[128];
00099 } sres_generic_t;
00100
00102 typedef struct sres_a_record
00103 {
00104 sres_common_t a_record[1];
00105 struct in_addr a_addr;
00106 } sres_a_record_t;
00107
00112 typedef struct
00113 {
00114 uint8_t u6_addr[16];
00115 } sres_in6_t;
00116
00118 typedef struct sres_a6_record
00119 {
00120 sres_common_t a6_record[1];
00121 uint8_t a6_prelen;
00122 uint8_t a6_pad[3];
00123 sres_in6_t a6_suffix;
00124 char *a6_prename;
00125 } sres_a6_record_t;
00126
00128 typedef struct sres_aaaa_record
00129 {
00130 sres_common_t aaaa_record[1];
00131 sres_in6_t aaaa_addr;
00132 } sres_aaaa_record_t;
00133
00135 typedef struct sres_cname_record
00136 {
00137 sres_common_t cn_record[1];
00138 char *cn_cname;
00139 } sres_cname_record_t;
00140
00142 typedef struct sres_ptr_record
00143 {
00144 sres_common_t ptr_record[1];
00145 char *ptr_domain;
00146 } sres_ptr_record_t;
00147
00149 typedef struct sres_srv_record
00150 {
00151 sres_common_t srv_record[1];
00152 uint16_t srv_priority;
00153 uint16_t srv_weight;
00154 uint16_t srv_port;
00155 uint16_t srv_pad;
00156 char *srv_target;
00157 } sres_srv_record_t;
00158
00160 typedef struct sres_naptr_record
00161 {
00162 sres_common_t na_record[1];
00163 uint16_t na_order;
00164 uint16_t na_prefer;
00165 char *na_flags;
00166 char *na_services;
00167 char *na_regexp;
00168 char *na_replace;
00169 } sres_naptr_record_t;
00170
00171
00172 #ifndef SRES_RECORD_T
00173 #define SRES_RECORD_T
00174
00175 typedef union sres_record sres_record_t;
00176 #endif
00177
00179 union sres_record
00180 {
00181 sres_common_t sr_record[1];
00182 sres_generic_t sr_generic[1];
00183 sres_soa_record_t sr_soa[1];
00184 sres_a_record_t sr_a[1];
00185 sres_cname_record_t sr_cname[1];
00186 sres_ptr_record_t sr_ptr[1];
00187 sres_a6_record_t sr_a6[1];
00188 sres_aaaa_record_t sr_aaaa[1];
00189 sres_srv_record_t sr_srv[1];
00190 sres_naptr_record_t sr_naptr[1];
00191 };
00192
00194 enum sres_class {
00195 sres_class_in = 1,
00196 sres_class_any = 255
00197 };
00198
00200 enum sres_qtypes {
00201 sres_type_a = 1,
00202 sres_type_ns = 2,
00203 sres_type_mf = 4,
00204 sres_type_cname = 5,
00205 sres_type_soa = 6,
00206 sres_type_mb = 7,
00207 sres_type_mg = 8,
00208 sres_type_mr = 9,
00209 sres_type_null = 10,
00210 sres_type_wks = 11,
00211 sres_type_ptr = 12,
00212 sres_type_hinfo = 13,
00213 sres_type_minfo = 14,
00214 sres_type_mx = 15,
00215 sres_type_txt = 16,
00216 sres_type_rp = 17,
00217 sres_type_afsdb = 18,
00218 sres_type_x25 = 19,
00219 sres_type_isdn = 20,
00220 sres_type_rt = 21,
00221 sres_type_nsap = 22,
00222 sres_type_nsap_ptr = 23,
00223 sres_type_sig = 24,
00224 sres_type_key = 25,
00225 sres_type_px = 26,
00226 sres_type_gpos = 27,
00227 sres_type_aaaa = 28,
00228 sres_type_loc = 29,
00229 sres_type_nxt = 30,
00230 sres_type_eid = 31,
00231 sres_type_nimloc = 32,
00232 sres_type_srv = 33,
00234 sres_type_atma = 34,
00235 sres_type_naptr = 35,
00237 sres_type_kx = 36,
00238 sres_type_cert = 37,
00239 sres_type_a6 = 38,
00240 sres_type_dname = 39,
00241 sres_type_sink = 40,
00242 sres_type_opt = 41,
00244 sres_qtype_tsig = 250,
00245 sres_qtype_ixfr = 251,
00246 sres_qtype_axfr = 252,
00247 sres_qtype_mailb = 253,
00248 sres_qtype_maila = 254,
00249 sres_qtype_any = 255
00250 };
00251
00253 SRESPUBFUN char const *sres_record_type(int type, char buffer[8]);
00254
00256 SRESPUBFUN char const *sres_record_status(int status, char buffer[8]);
00257
00259 SRESPUBFUN int sres_record_compare(sres_record_t const *,
00260 sres_record_t const *);
00261
00262 #ifdef __cplusplus
00263 }
00264 #endif
00265
00266 #endif