dns.h

Go to the documentation of this file.
00001 /*##############################################################################
00002 
00003 nIP - Stack
00004 
00005 File        : dns.h
00006 
00007 Description : Domain Name System
00008 
00009 Copyright notice:
00010 
00011 Copyright (C) 2005 -
00012 Andreas Dittrich, dittrich@informatik.hu-berlin.de
00013 Jon Kowal, kowal@informatik.hu-berlin.de
00014 
00015 This program is free software; you can redistribute it and/or
00016 modify it under the terms of the GNU General Public License
00017 as published by the Free Software Foundation; either version 2
00018 of the License, or (at your option) any later version.
00019 
00020 This program is distributed in the hope that it will be useful,
00021 but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00023 GNU General Public License for more details.
00024 
00025 You should have received a copy of the GNU General Public License
00026 along with this program; if not, write to the Free Software
00027 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00028 
00029 ##############################################################################*/
00030 
00031 #ifndef _DNS_H_
00032  #define _DNS_H_
00033 
00034 
00035 #define NIP_DNS_QR_OFFSET  7 /**< header QR field    , see rfc 1035 */
00036 #define NIP_DNS_OP_OFFSET  3 /**< header Opcode field, see rfc 1035 */
00037 #define NIP_DNS_AA_OFFSET  2 /**< header AA field    , see rfc 1035 */
00038 #define NIP_DNS_TC_OFFSET  1 /**< header TC field    , see rfc 1035 */
00039 #define NIP_DNS_RD_OFFSET  0 /**< header RD field    , see rfc 1035 */
00040 
00041 #define NIP_DNS_RA_OFFSET  7 /**< header RA field    , see rfc 1035 */
00042 #define NIP_DNS_Z_OFFSET   6 /**< header Z  field    , see rfc 2535 */
00043 #define NIP_DNS_AD_OFFSET  5 /**< header AD field    , see rfc 2535 */
00044 #define NIP_DNS_CD_OFFSET  4 /**< header CD field    , see rfc 2535 */
00045 #define NIP_DNS_RC_OFFSET  0 /**< header RCODE field , see rfc 1035 */
00046 
00047 
00048 #define NIP_DNS_QR_MASK    0x80
00049 #define NIP_DNS_OP_MASK    0x78
00050 #define NIP_DNS_AA_MASK    0x04
00051 #define NIP_DNS_TC_MASK    0x02
00052 #define NIP_DNS_RD_MASK    0x01
00053 
00054 #define NIP_DNS_RA_MASK    0x80
00055 #define NIP_DNS_Z_MASK     0x40
00056 #define NIP_DNS_AD_MASK    0x20
00057 #define NIP_DNS_CD_MASK    0x10
00058 #define NIP_DNS_RC_MASK    0x07
00059 
00060 #define NIP_DNS_CF_FLAG    0x80  /**< cache flush flag */
00061 
00062 #define NIP_DNS_HSIZE      sizeof( struct nip_dns_header )
00063 
00064 #define NIP_DNS_CLASS_IN   1
00065 
00066 struct nip_dns_string
00067 {
00068         uint8_t len;  /** string length */
00069         uint8_t s[0]; /** string */
00070 }
00071 #ifndef DOXYGEN
00072 __attribute__((packed))
00073 #endif
00074 ;
00075 
00076 struct nip_dns_header
00077 {
00078         uint16_t id;                 /**< query ID */
00079         uint8_t  qr_opcode_aa_tc_rd; /**< QR, Opcode, AA, TC, and RD fields */
00080         uint8_t  ra_z_ad_cd_rcode;   /**< RA, Z, AD, CD, and RCODE fields */
00081         uint16_t qa_count[4];        /**< 0: number of entries in question section
00082                                       * 1: number of resourec records in answer section
00083                                       * 2: number of name server resource records in
00084                                       *    the authority records section
00085                                       * 3: number of resource records in additional
00086                                       *    records section */
00087 
00088 }
00089 #ifndef DOXYGEN
00090 __attribute__((packed))
00091 #endif
00092 ;
00093 
00094 #endif

Generated on Thu Jul 10 01:09:29 2008 for NIP by  doxygen 1.5.5