]> The Tcpdump Group git mirrors - tcpdump/blobdiff - nameser.h
Avoid collison with error(), clean up code a bit.
[tcpdump] / nameser.h
index 3aeedb45152c9f74df8bd6645e7d289481677728..e075f09228aa6533744ee779088caa05e3fdb84a 100644 (file)
--- a/nameser.h
+++ b/nameser.h
@@ -1,4 +1,3 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/nameser.h,v 1.15 2006-04-07 08:47:34 guy Exp $ (LBL) */
 /*
  * Copyright (c) 1983, 1989, 1993
  *     The Regents of the University of California.  All rights reserved.
        /* number of bytes of fixed size data in resource record */
 #define RRFIXEDSZ      10
 
-/*
- * Internet nameserver port number
- */
-#define NAMESERVER_PORT        53
-#define MULTICASTDNS_PORT      5353
-
 /*
  * Currently defined opcodes
  */
 #define C_HS           4               /* for Hesiod name server (MIT) (XXX) */
        /* Query class values which do not appear in resource records */
 #define C_ANY          255             /* wildcard match */
-#define C_CACHE_FLUSH  0x8000          /* mDNS cache flush flag */
+#define C_QU           0x8000          /* mDNS QU flag in queries */
+#define C_CACHE_FLUSH  0x8000          /* mDNS cache flush flag in replies */
 
 /*
  * Status return codes for T_UNSPEC conversion routines
  * Structure for query header.
  */
 typedef struct {
-       u_int16_t id;           /* query identification number */
-       u_int8_t  flags1;       /* first byte of flags */
-       u_int8_t  flags2;       /* second byte of flags */
-       u_int16_t qdcount;      /* number of question entries */
-       u_int16_t ancount;      /* number of answer entries */
-       u_int16_t nscount;      /* number of authority entries */
-       u_int16_t arcount;      /* number of resource entries */
+       uint16_t id;            /* query identification number */
+       uint8_t  flags1;        /* first byte of flags */
+       uint8_t  flags2;        /* second byte of flags */
+       uint16_t qdcount;       /* number of question entries */
+       uint16_t ancount;       /* number of answer entries */
+       uint16_t nscount;       /* number of authority entries */
+       uint16_t arcount;       /* number of resource entries */
 } HEADER;
 
 /*
@@ -253,36 +247,36 @@ struct rrec {
        int16_t r_zone;                 /* zone number */
        int16_t r_class;                /* class number */
        int16_t r_type;                 /* type number */
-       u_int32_t       r_ttl;                  /* time to live */
+       uint32_t        r_ttl;                  /* time to live */
        int     r_size;                 /* size of data area */
        char    *r_data;                /* pointer to data */
 };
 
 /*
  * Inline versions of get/put short/long.  Pointer is advanced.
- * We also assume that a "u_int16_t" holds 2 "chars"
- * and that a "u_int32_t" holds 4 "chars".
+ * We also assume that a "uint16_t" holds 2 "chars"
+ * and that a "uint32_t" holds 4 "chars".
  *
  * These macros demonstrate the property of C whereby it can be
  * portable or it can be elegant but never both.
  */
 #define GETSHORT(s, cp) { \
        register u_char *t_cp = (u_char *)(cp); \
-       (s) = ((u_int16_t)t_cp[0] << 8) | (u_int16_t)t_cp[1]; \
+       (s) = ((uint16_t)t_cp[0] << 8) | (uint16_t)t_cp[1]; \
        (cp) += 2; \
 }
 
 #define GETLONG(l, cp) { \
        register u_char *t_cp = (u_char *)(cp); \
-       (l) = (((u_int32_t)t_cp[0]) << 24) \
-           | (((u_int32_t)t_cp[1]) << 16) \
-           | (((u_int32_t)t_cp[2]) << 8) \
-           | (((u_int32_t)t_cp[3])); \
+       (l) = (((uint32_t)t_cp[0]) << 24) \
+           | (((uint32_t)t_cp[1]) << 16) \
+           | (((uint32_t)t_cp[2]) << 8) \
+           | (((uint32_t)t_cp[3])); \
        (cp) += 4; \
 }
 
 #define PUTSHORT(s, cp) { \
-       register u_int16_t t_s = (u_int16_t)(s); \
+       register uint16_t t_s = (uint16_t)(s); \
        register u_char *t_cp = (u_char *)(cp); \
        *t_cp++ = t_s >> 8; \
        *t_cp   = t_s; \
@@ -294,7 +288,7 @@ struct rrec {
  * were depending on this "feature", you will lose.
  */
 #define PUTLONG(l, cp) { \
-       register u_int32_t t_l = (u_int32_t)(l); \
+       register uint32_t t_l = (uint32_t)(l); \
        register u_char *t_cp = (u_char *)(cp); \
        *t_cp++ = t_l >> 24; \
        *t_cp++ = t_l >> 16; \