[9] | 1 | /*
|
---|
| 2 | * Copyright (c) 1983, 1989 Regents of the University of California.
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms are permitted
|
---|
| 6 | * provided that: (1) source distributions retain this entire copyright
|
---|
| 7 | * notice and comment, and (2) distributions including binaries display
|
---|
| 8 | * the following acknowledgement: ``This product includes software
|
---|
| 9 | * developed by the University of California, Berkeley and its contributors''
|
---|
| 10 | * in the documentation or other materials provided with the distribution
|
---|
| 11 | * and in all advertising materials mentioning features or use of this
|
---|
| 12 | * software. Neither the name of the University nor the names of its
|
---|
| 13 | * contributors may be used to endorse or promote products derived
|
---|
| 14 | * from this software without specific prior written permission.
|
---|
| 15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
---|
| 16 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
---|
| 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 18 | *
|
---|
| 19 | * @(#)nameser.h 5.24 (Berkeley) 6/1/90
|
---|
| 20 | */
|
---|
| 21 |
|
---|
| 22 | /*
|
---|
| 23 | server/ip/gen/nameser.h
|
---|
| 24 |
|
---|
| 25 | Created Sept 18, 1991 by Philip Homburg
|
---|
| 26 | */
|
---|
| 27 |
|
---|
| 28 | #ifndef __SERVER__IP__GEN__NAEMSER_H__
|
---|
| 29 | #define __SERVER__IP__GEN__NAEMSER_H__
|
---|
| 30 |
|
---|
| 31 | typedef struct dns_hdr
|
---|
| 32 | {
|
---|
| 33 | u16_t dh_id;
|
---|
| 34 | u8_t dh_flag1;
|
---|
| 35 | u8_t dh_flag2;
|
---|
| 36 | u16_t dh_qdcount;
|
---|
| 37 | u16_t dh_ancount;
|
---|
| 38 | u16_t dh_nscount;
|
---|
| 39 | u16_t dh_arcount;
|
---|
| 40 | } dns_hdr_t;
|
---|
| 41 |
|
---|
| 42 | typedef dns_hdr_t HEADER;
|
---|
| 43 |
|
---|
| 44 | #define DHF_QR 0x80
|
---|
| 45 | #define DHF_OPCODE 0x78
|
---|
| 46 | #define DHF_AA 0x04
|
---|
| 47 | #define DHF_TC 0x02
|
---|
| 48 | #define DHF_RD 0x01
|
---|
| 49 |
|
---|
| 50 | #define DHF_RA 0x80
|
---|
| 51 | #define DHF_PR 0x40
|
---|
| 52 | #define DHF_UNUSED 0x30
|
---|
| 53 | #define DHF_RCODE 0x0F
|
---|
| 54 |
|
---|
| 55 | /*
|
---|
| 56 | Define constants based on rfc883
|
---|
| 57 | */
|
---|
| 58 | #define PACKETSZ 512 /* maximum packet size */
|
---|
| 59 | #define MAXDNAME 256 /* maximum domain name */
|
---|
| 60 | #define MAXCDNAME 255 /* maximum compressed domain name */
|
---|
| 61 | #define MAXLABEL 63 /* maximum length of domain label */
|
---|
| 62 | /* Number of bytes of fixed size data in query structure */
|
---|
| 63 | #define QFIXEDSZ 4
|
---|
| 64 | /* number of bytes of fixed size data in resource record */
|
---|
| 65 | #define RRFIXEDSZ 10
|
---|
| 66 | #define INDIR_MASK 0xc0
|
---|
| 67 | /* Defines for handling compressed domain names */
|
---|
| 68 |
|
---|
| 69 | /*
|
---|
| 70 | Opcodes for DNS
|
---|
| 71 | */
|
---|
| 72 |
|
---|
| 73 | #define QUERY 0x0 /* standard query */
|
---|
| 74 | #define IQUERY 0x1 /* inverse query */
|
---|
| 75 |
|
---|
| 76 | /*
|
---|
| 77 | Error codes
|
---|
| 78 | */
|
---|
| 79 | #define NOERROR 0 /* no error */
|
---|
| 80 | #define FORMERR 1 /* format error */
|
---|
| 81 | #define SERVFAIL 2 /* server failure */
|
---|
| 82 | #define NXDOMAIN 3 /* non existent domain */
|
---|
| 83 | #define NOTIMP 4 /* not implemented */
|
---|
| 84 | #define REFUSED 5 /* query refused */
|
---|
| 85 | /* non standard */
|
---|
| 86 | #define NOCHANGE 0xf /* update failed to change db */
|
---|
| 87 |
|
---|
| 88 | /* Valid types */
|
---|
| 89 |
|
---|
| 90 | #define T_A 1 /* host address */
|
---|
| 91 | #define T_NS 2 /* authoritative server */
|
---|
| 92 | #define T_MD 3 /* mail destination */
|
---|
| 93 | #define T_MF 4 /* mail forwarder */
|
---|
| 94 | #define T_CNAME 5 /* connonical name */
|
---|
| 95 | #define T_SOA 6 /* start of authority zone */
|
---|
| 96 | #define T_MB 7 /* mailbox domain name */
|
---|
| 97 | #define T_MG 8 /* mail group member */
|
---|
| 98 | #define T_MR 9 /* mail rename name */
|
---|
| 99 | #define T_NULL 10 /* null resource record */
|
---|
| 100 | #define T_WKS 11 /* well known service */
|
---|
| 101 | #define T_PTR 12 /* domain name pointer */
|
---|
| 102 | #define T_HINFO 13 /* host information */
|
---|
| 103 | #define T_MINFO 14 /* mailbox information */
|
---|
| 104 | #define T_MX 15 /* mail routing information */
|
---|
| 105 | #define T_TXT 16 /* text strings */
|
---|
| 106 | /* non standard */
|
---|
| 107 | #define T_UINFO 100 /* user (finger) information */
|
---|
| 108 | #define T_UID 101 /* user ID */
|
---|
| 109 | #define T_GID 102 /* group ID */
|
---|
| 110 | #define T_UNSPEC 103 /* Unspecified format (binary data) */
|
---|
| 111 | /* Query type values which do not appear in resource records */
|
---|
| 112 | #define T_AXFR 252 /* transfer zone of authority */
|
---|
| 113 | #define T_MAILB 253 /* transfer mailbox records */
|
---|
| 114 | #define T_MAILA 254 /* transfer mail agent records */
|
---|
| 115 | #define T_ANY 255 /* wildcard match */
|
---|
| 116 |
|
---|
| 117 | /* Valid classes */
|
---|
| 118 |
|
---|
| 119 | #define C_IN 1 /* the internet */
|
---|
| 120 | #define C_CHAOS 3 /* for chaos net (MIT) */
|
---|
| 121 | #define C_HS 4 /* for Hesiod name server at MIT */
|
---|
| 122 |
|
---|
| 123 | #define C_ANY 255 /* wildcard */
|
---|
| 124 |
|
---|
| 125 | #endif /* __SERVER__IP__GEN__NAEMSER_H__ */
|
---|