zeroconf/dnsparser/inc/dnsconstants.h
changeset 14 da856f45b798
equal deleted inserted replaced
12:78fbd574edf4 14:da856f45b798
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __DNSCONSTANTS_H__
       
    20 #define __DNSCONSTANTS_H__
       
    21 
       
    22 #include <in_sock.h> 
       
    23 
       
    24 const TInt KDnsPort = 53;
       
    25 const TInt KMdnsPort = 5353;
       
    26 const TUint32 KMDnsAddr = INET_ADDR(224, 0, 0, 251);
       
    27 
       
    28 const TInt KDnsTtl = 60 * 60;               //< default one hour TTL
       
    29 const TInt KKnownAnswerTtl = 120;
       
    30 const TInt KQueryWaitInterval = 225;        //<milliseconds between query loops.
       
    31 const TInt KProbeWaitInterval = 250;        //<milliseconds between probe loops.
       
    32 const TInt KResponseMinWaitInterval = 20;   //<minimal wait interval for response.
       
    33 const TInt KResponseMaxWaitInterval = 115;  //<maximal wait interval for response
       
    34 const TInt KProbeConflictInterval = 1000;   //<milliseconds to wait after conflict.
       
    35 const TInt KAnnounceWaitInterval = 1000;    //<milliseconds between Announce loops.
       
    36 const TInt KRecordReaperInterval = 10000;   //<milliseconds between cache cleanups.
       
    37 
       
    38 const TInt KMaxDnsPacketSize = 9216;        //<max mdns packet size
       
    39 
       
    40 //Dns Opcodes
       
    41 const TUint16 KDnsOpcode_QUERY	= 0x00; 	//< Standard Query
       
    42 const TUint16 KDnsOpcode_IQUERY	= 0x01;	    //< Inverse Query (historical)
       
    43 const TUint16 KDnsOpcode_STATUS	= 0x02;	    //< Server Status Query
       
    44 const TUint16 KDnsOpcode_UPDATE = 0x05;     //< Dynamic mDNS
       
    45 
       
    46 
       
    47 const TInt KResponseBit = 0x8000;
       
    48 const TInt KPointerBit = 0xC0;
       
    49 const TInt KPointerOffsetBit = 0x3F;
       
    50 const TUint16 KFlushBit = 0x8000;
       
    51 const TUint16 KQueryBit = KFlushBit;
       
    52 
       
    53 const TUint KMaxLabelLength = 63;
       
    54 const TUint KMaxDNSNameLength= 256;
       
    55 const TInt KDnsBufferlength = 1000;
       
    56 
       
    57 //mDNS RR Types
       
    58 enum TDnsType
       
    59 	{
       
    60 	EDnsType_IGNORE     = 0,	//< This is a hack to stop further processing
       
    61 	EDnsType_A			= 1,	//< a host address
       
    62 	EDnsType_NS			= 2,	//< an authoritative name server
       
    63 	EDnsType_MD			= 3,	//< a mail destination (Obsolete - use MX)
       
    64 	EDnsType_MF			= 4,	//< a mail forwarder (Obsolete - use MX)
       
    65 	EDnsType_CNAME		= 5,	//< the canonical name for an alias
       
    66 	EDnsType_SOA		= 6,	//< marks the start of a zone of authority
       
    67 	EDnsType_MB			= 7,	//< a mailbox domain name 
       
    68 	EDnsType_MG			= 8,	//< a mail group member 
       
    69 	EDnsType_MR			= 9,	//< a mail rename domain name 
       
    70 	EDnsType_NULL		= 10,	//< a null RR 
       
    71 	EDnsType_WKS		= 11,	//< a well known service description
       
    72 	EDnsType_PTR		= 12,	//< a domain name pointer
       
    73 	EDnsType_HINFO		= 13,	//< host information
       
    74 	EDnsType_MINFO		= 14,	//< mailbox or mail list information
       
    75 	EDnsType_MX			= 15,	//< mail exchange
       
    76 	EDnsType_TXT		= 16,	//< text strings
       
    77 	EDnsType_AAAA		= 28,	//< single IPv6 address (RFC-1886)
       
    78 	EDnsType_DNAME		= 29,	//< Non-Terminal DNS Name Redirection (RFC-2672)
       
    79 	EDnsType_SRV		= 33,	//< Location of Services (RFC-2782)
       
    80 	EDnsType_NAPTR		= 35,	//< Naming Authority Pointer (RFC-2915)
       
    81     EDnsQType_Any       = 255   //< Request for all records
       
    82 	};
       
    83 
       
    84 
       
    85 //mDNS Class Types
       
    86 enum TDnsClass
       
    87 	{
       
    88     EDnsClass_IN = 1,       //< public final static Internet
       
    89     EDnsClass_CS = 2,        //< CSNET
       
    90     EDnsClass_CH= 3,         //< CHAOS
       
    91     EDnsClass_HS = 4,       //< Hesiod
       
    92     EDnsClass_NONE = 254,	 //< Used in DNS UPDATE [RFC 2136]
       
    93     EDnsClass_ANY = 255    //< Not a DNS class, but a DNS query class, meaning "all classes"
       
    94 	};
       
    95 
       
    96 
       
    97 //Flags
       
    98 enum TFlags
       
    99 	{
       
   100 	EFlagReserved = 0x0070,
       
   101 	EFlagRecursionAvailable = 0x0080,
       
   102 	EFlagRecurse = 0x0100,
       
   103 	EFlagTruncated = 0x0200,
       
   104 	EFlagAuthoritative = 0x0400,
       
   105 	EFlagOpcode = 0x0F00,
       
   106 	EFlagQuery = 0x8000,
       
   107 	EFlagResponseCode = 0x000F		
       
   108 	};
       
   109 
       
   110 
       
   111 // Response Codes
       
   112 enum TDnsRcode
       
   113 	{
       
   114     EDnsRcode_NOERROR		    = 0,
       
   115 	EDnsRcode_FORMAT_ERROR	    = 1,
       
   116 	EDnsRcode_SERVER_FAILURE	= 2,
       
   117 	EDnsRcode_NAME_ERROR		= 3,
       
   118 	EDnsRcode_NOT_IMPLEMENTED	= 4,
       
   119 	EDnsRcode_REFUSED			= 5
       
   120 	};
       
   121 
       
   122 #endif //__DNSCONSTANTS_H__
       
   123