26 #include <sys/types.h>
28 #define ANDNS_MAX_QUESTION_LEN 263
29 #define ANDNS_MAX_ANSWER_LEN 516
30 #define ANDNS_MAX_ANSWERS_NUM 256
31 #define ANDNS_MAX_PK_LEN ANDNS_MAX_QUESTION_LEN+\
32 ANDNS_MAX_ANSWERS_NUM*ANDNS_MAX_ANSWER_LEN
34 #define ANDNS_MAX_DATA_LEN 512
35 #define ANDNS_MAX_QST_LEN 512
36 #define ANNDS_DNS_MAZ_QST_LEN 255
37 #define ANDNS_MAX_ANSW_IP_LEN 20
38 #define ANDNS_MAX_ANSW_H_LEN 516
40 #define ANDNS_HASH_H 16
42 #define ANDNS_COMPR_LEVEL Z_BEST_COMPRESSION
43 #define ANDNS_COMPR_THRESHOLD 1000
56 #define ANDNS_PKT_DATA_SZ sizeof(andns_pkt_data)
57 #define APD_ALIGN(apd) (apd)->rdata=(char*)xmalloc((apd)->rdlength+1); \
58 memset((apd)->rdata,0,(apd)->rdlength+1)
59 #define APD_MAIN_IP 1<<0
81 #define ANDNS_PKT_SZ sizeof(andns_pkt)
82 #define AP_ALIGN(ap) (ap)->qstdata=(char*)xmalloc((ap)->qstlength)
84 #define ANDNS_HDR_SZ 4
86 #define ANDNS_MAX_SZ ANDNS_HDR_SZ+ANDNS_MAX_QST_LEN+ANDNS_MAX_QST_LEN+4
89 #define ANDNS_SET_RCODE(s,c) *((s)+3)=(((*((s)+3))&0xf0)|c)
90 #define ANDNS_SET_QR(s) (*((s)+2))|=0x80
91 #define ANDNS_SET_ANCOUNT(s,n) *(s+2)|=((n)>>1);*(s+3)|=((n)<<7);
92 #define ANDNS_SET_Z(s) *(s+3)|=0x20;
93 #define ANDNS_UNSET_Z(s) *(s+3)&=0xdf;
96 #define ANDNS_PROTO_TCP 0
97 #define ANDNS_PROTO_UDP 1
103 #define ANDNS_RCODE_NOERR 0
104 #define ANDNS_RCODE_EINTRPRT 1
105 #define ANDNS_RCODE_ESRVFAIL 2
106 #define ANDNS_RCODE_ENSDMN 3
107 #define ANDNS_RCODE_ENIMPL 4
108 #define ANDNS_RCODE_ERFSD 5
int a_answ_u(char *buf, andns_pkt *ap, int limitlen)
Definition: andns_lib.c:186
uint16_t ancount
Definition: andns_lib.h:72
void andns_del_answ(andns_pkt *ap)
Definition: andns_lib.c:578
uint8_t m
Definition: andns_lib.h:47
andns_pkt_data * pkt_answ
Definition: andns_lib.h:79
int a_hdr_u(char *buf, andns_pkt *ap)
Definition: andns_lib.c:93
uint16_t id
Definition: andns_lib.h:66
int a_answ_p(andns_pkt *ap, andns_pkt_data *apd, char *buf, int limitlen)
Definition: andns_lib.c:417
andns_pkt_data * andns_add_answ(andns_pkt *ap)
Definition: andns_lib.c:557
void destroy_andns_pkt(andns_pkt *ap)
Definition: andns_lib.c:604
void destroy_andns_pkt_data(andns_pkt_data *apd)
Definition: andns_lib.c:572
struct andns_pkt andns_pkt
char * rdata
Definition: andns_lib.h:52
uint8_t nk
Definition: andns_lib.h:74
struct andns_pkt_data * next
Definition: andns_lib.h:53
int andns_compress(char *src, int srclen)
Definition: andns_lib.c:30
uint16_t qstlength
Definition: andns_lib.h:77
uint8_t rcode
Definition: andns_lib.h:75
int a_answs_u(char *buf, andns_pkt *ap, int limitlen)
Definition: andns_lib.c:261
uint16_t service
Definition: andns_lib.h:51
uint8_t ipv
Definition: andns_lib.h:73
int a_p(andns_pkt *ap, char *buf)
Definition: andns_lib.c:504
andns_pkt_data * create_andns_pkt_data(void)
Definition: andns_lib.c:550
uint8_t r
Definition: andns_lib.h:67
int a_hdr_p(andns_pkt *ap, char *buf)
Definition: andns_lib.c:341
int a_u(char *buf, int pktlen, andns_pkt **app)
Definition: andns_lib.c:294
int a_answs_p(andns_pkt *ap, char *buf, int limitlen)
Definition: andns_lib.c:479
uint16_t service
Definition: andns_lib.h:76
char * andns_uncompress(char *src, int srclen, int *dstlen)
Definition: andns_lib.c:57
int a_qst_p(andns_pkt *ap, char *buf, int limitlen)
Definition: andns_lib.c:370
uint8_t qtype
Definition: andns_lib.h:71
uint8_t p
Definition: andns_lib.h:69
Definition: andns_lib.h:45
uint16_t rdlength
Definition: andns_lib.h:50
uint8_t wg
Definition: andns_lib.h:48
uint8_t z
Definition: andns_lib.h:70
uint8_t qr
Definition: andns_lib.h:68
int a_qst_u(char *buf, andns_pkt *ap, int limitlen)
Definition: andns_lib.c:129
char * qstdata
Definition: andns_lib.h:78
uint8_t prio
Definition: andns_lib.h:49
void destroy_andns_pkt_datas(andns_pkt *ap)
Definition: andns_lib.c:594
andns_pkt * create_andns_pkt(void)
Definition: andns_lib.c:542
Definition: andns_lib.h:64