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 };
00076
00078 typedef struct sres_soa_record
00079 {
00080 sres_common_t soa_record[1];
00081 char *soa_mname;
00082 char *soa_rname;
00083 uint32_t soa_serial;
00084 uint32_t soa_refresh;
00085 uint32_t soa_retry;
00086 uint32_t soa_expire;
00087 uint32_t soa_minimum;
00088 } sres_soa_record_t;
00089
00091 typedef struct sres_generic
00092 {
00093 sres_common_t g_record[1];
00094 uint8_t g_data[128];
00095 } sres_generic_t;
00096
00098 typedef struct sres_a_record
00099 {
00100 sres_common_t a_record[1];
00101 struct in_addr a_addr;
00102 } sres_a_record_t;
00103
00108 typedef struct
00109 {
00110 uint8_t u6_addr[16];
00111 } sres_in6_t;
00112
00114 typedef struct sres_a6_record
00115 {
00116 sres_common_t a6_record[1];
00117 uint8_t a6_prelen;
00118 uint8_t a6_pad[3];
00119 sres_in6_t a6_suffix;
00120 char *a6_prename;
00121 } sres_a6_record_t;
00122
00124 typedef struct sres_aaaa_record
00125 {
00126 sres_common_t aaaa_record[1];
00127 sres_in6_t aaaa_addr;
00128 } sres_aaaa_record_t;
00129
00131 typedef struct sres_cname_record
00132 {
00133 sres_common_t cn_record[1];
00134 char *cn_cname;
00135 } sres_cname_record_t;
00136
00138 typedef struct sres_ptr_record
00139 {
00140 sres_common_t ptr_record[1];
00141 char *ptr_domain;
00142 } sres_ptr_record_t;
00143
00145 typedef struct sres_srv_record
00146 {
00147 sres_common_t srv_record[1];
00148 uint16_t srv_priority;
00149 uint16_t srv_weight;
00150 uint16_t srv_port;
00151 uint16_t srv_pad;
00152 char *srv_target;
00153 } sres_srv_record_t;
00154
00156 typedef struct sres_naptr_record
00157 {
00158 sres_common_t na_record[1];
00159 uint16_t na_order;
00160 uint16_t na_prefer;
00161 char *na_flags;
00162 char *na_services;
00163 char *na_regexp;
00164 char *na_replace;
00165 } sres_naptr_record_t;
00166
00167
00168 #ifndef SRES_RECORD_T
00169 #define SRES_RECORD_T
00170
00171 typedef union sres_record sres_record_t;
00172 #endif
00173
00175 union sres_record
00176 {
00177 sres_common_t sr_record[1];
00178 sres_generic_t sr_generic[1];
00179 sres_soa_record_t sr_soa[1];
00180 sres_a_record_t sr_a[1];
00181 sres_cname_record_t sr_cname[1];
00182 sres_ptr_record_t sr_ptr[1];
00183 sres_a6_record_t sr_a6[1];
00184 sres_aaaa_record_t sr_aaaa[1];
00185 sres_srv_record_t sr_srv[1];
00186 sres_naptr_record_t sr_naptr[1];
00187 };
00188
00189 enum sres_class {
00190 sres_class_in = 1,
00191 sres_class_any = 255
00192 };
00193
00194 enum sres_qtypes {
00195 sres_type_a = 1,
00196 sres_type_ns = 2,
00197 sres_type_mf = 4,
00198 sres_type_cname = 5,
00199 sres_type_soa = 6,
00200 sres_type_mb = 7,
00201 sres_type_mg = 8,
00202 sres_type_mr = 9,
00203 sres_type_null = 10,
00204 sres_type_wks = 11,
00205 sres_type_ptr = 12,
00206 sres_type_hinfo = 13,
00207 sres_type_minfo = 14,
00208 sres_type_mx = 15,
00209 sres_type_txt = 16,
00210 sres_type_rp = 17,
00211 sres_type_afsdb = 18,
00212 sres_type_x25 = 19,
00213 sres_type_isdn = 20,
00214 sres_type_rt = 21,
00215 sres_type_nsap = 22,
00216 sres_type_nsap_ptr = 23,
00217 sres_type_sig = 24,
00218 sres_type_key = 25,
00219 sres_type_px = 26,
00220 sres_type_gpos = 27,
00221 sres_type_aaaa = 28,
00222 sres_type_loc = 29,
00223 sres_type_nxt = 30,
00224 sres_type_eid = 31,
00225 sres_type_nimloc = 32,
00226 sres_type_srv = 33,
00228 sres_type_atma = 34,
00229 sres_type_naptr = 35,
00231 sres_type_kx = 36,
00232 sres_type_cert = 37,
00233 sres_type_a6 = 38,
00234 sres_type_dname = 39,
00235 sres_type_sink = 40,
00236 sres_type_opt = 41,
00238 sres_qtype_tsig = 250,
00239 sres_qtype_ixfr = 251,
00240 sres_qtype_axfr = 252,
00241 sres_qtype_mailb = 253,
00242 sres_qtype_maila = 254,
00243 sres_qtype_any = 255
00244 };
00245
00247 SRESPUBFUN char const *sres_record_type(int type, char buffer[8]);
00248
00250 SRESPUBFUN int sres_record_compare(sres_record_t const *,
00251 sres_record_t const *);
00252
00253 #ifdef __cplusplus
00254 }
00255 #endif
00256
00257 #endif