Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DnsStructs.h

Go to the documentation of this file.
00001 #ifndef DNSSTRUCTS_H
00002 #define DNSSTRUCTS_H
00003 
00004 #include <abuse/Url.h>
00005 #include <list>
00006 
00007 namespace Dns
00008 {
00009         /*header of a DNS message*/
00010         typedef struct _tagheader
00011         {
00012                 unsigned short int id;          //in net order
00013                 byte rd :         1;
00014                 byte tc :         1;
00015                 byte aa         : 1;
00016                 byte opcode : 4;
00017                 byte qr :         1;
00018                 
00019                 byte rcode :  4;
00020                 byte z     :  3;
00021                 byte ra    :  1;
00022 
00023                 unsigned short int qdcount; //in net order
00024                 unsigned short int ancount; //in net order
00025                 unsigned short int nscount; //in net order
00026                 unsigned short int arcount; //in net order
00027         }DNSHEADER;
00028 
00029 #define IS_A_PTR(x) (*((byte*)x) & 0xc0)
00030 #define MSGOFFSET(x) (htons(*((unsigned short int*)x)) & ~0xc000)
00031         
00032         enum DNSTYPE{MX=0,TEXT=1,NS=2,HINFO=3}; 
00033         typedef std::list<Url>(*GetDns)(void);
00034         typedef DNSHEADER* (*SendRequest)(DNSTYPE,const std::string&, void*,size_t);
00035 
00036 #ifdef WIN32
00037         std::list<Url> getDns98();
00038         std::list<Url> getDns95();
00039 #else
00040         std::list<Url> getDnsLinux();
00041 #endif
00042 
00043 #ifdef WIN32
00044         DNSHEADER* sendRequest2k(DNSTYPE,const std::string&, void*, size_t);
00045 #endif
00046         DNSHEADER* sendRequest98(DNSTYPE,const std::string&, void*, size_t)throw(net_error);
00047 
00048 }
00049 
00050 #endif

Generated on Thu Jun 16 00:13:14 2005 for Netlib for Abuse! by  doxygen 1.4.3