Blame view

Network/libnet/lib/include/dns.h 2.38 KB
fee2cbd6   amoreau   ajout des librairies
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
  /*----------------------------------------------------------------
   * dns.h - definitions for the DNS interface in wnsck.c (internal)
   *----------------------------------------------------------------
   *  libnet is (c) Copyright Chad Catlett and George Foot 1997-1998
   *
   *  Please look in `docs' for details, documentation and
   *  distribution conditions.
   */
  
  
  #ifndef _gf_included_dns_h
  #define _gf_included_dns_h
  
  
  /* DNS RR types */
  #define DNS_TYPE_A		1
  #define DNS_TYPE_NS		2
  #define DNS_TYPE_MD		3
  #define DNS_TYPE_MF		4
  #define DNS_TYPE_CNAME	5
  #define DNS_TYPE_SOA	6
  #define DNS_TYPE_MB		7
  #define DNS_TYPE_MG		8
  #define DNS_TYPE_MR		9
  #define DNS_TYPE_NULL	10
  #define DNS_TYPE_WKS	11
  #define DNS_TYPE_PTR	12
  #define DNS_TYPE_HINFO	13
  #define DNS_TYPE_MINFO	14
  #define DNS_TYPE_MX		15
  #define DNS_TYPE_TXT	16
  #define DNS_TYPE_AXFR	252
  #define DNS_TYPE_MAILB	253
  #define DNS_TYPE_MAILA	254
  #define DNS_TYPE_ANY	255
  
  /* DNS RR classes */
  #define DNS_CLASS_IN	1
  #define DNS_CLASS_CS	2
  #define DNS_CLASS_CH	3
  #define DNS_CLASS_HS	4
  #define DNS_CLASS_ANY	255
  
  /* DNS communication port (UDP or TCP) */
  #define IPPORT_DNS 53
  
  struct dns_query {
  	char *qname;
  	int qtype,qclass;
  };
  
  struct dns_rr {
  	char *name;
  	int type,_class,ttl,rdlength;
  	char *rdata;
  	union {
  		struct { long address;           } a;
  		struct { char *cname;            } cname;
  		struct { char *cpu,*os;          } hinfo;
  		struct { char *madname;          } mb;
  		struct { char *madname;          } md;
  		struct { char *madname;          } mf;
  		struct { char *mgmname;          } mg;
  		struct { char *rmailbx,*emailbx; } minfo;
  		struct { char *newname;          } mr;
  		struct { int preference; char *exchange; } mx;
  		struct { char *nsdname;          } ns;
  		struct { char *data;             } null;
  		struct { char *ptrdname;         } ptr;
  		struct { char *mname,*rname; unsigned serial,refresh,retry,expire,minimum; } soa;
  		struct { char **txt_data;        } txt;
  		struct { int address; unsigned char protocol; int bitmapsize; char *bitmap; } wks;
  	} data;
  };
  
  union dns_flags {
  	unsigned short i;
  	struct {
  		int rd:1;
  		int tc:1;
  		int aa:1;
  		int opcode:4;
  		int qr:1;
  		int rcode:4;
  		int z:3;
  		int ra:1;
  	} f;
  };
  
  struct dns_packet {
  	int nameserver;
  	int id;
  	union dns_flags flags;
  	int qdcount,ancount,nscount,arcount;
  	struct dns_query *questions;
  	struct dns_rr *answers;
  	struct dns_rr *authorities;
  	struct dns_rr *additionals;
  };
  
  
  #endif