~ubuntu-branches/ubuntu/karmic/xprobe/karmic

« back to all changes in this revision

Viewing changes to src/xpmodules/os_probe/icmp_port_unreach/util.h

  • Committer: Bazaar Package Importer
  • Author(s): Richard Atterer
  • Date: 2005-02-22 22:54:24 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050222225424-6cqy8rr45pkna819
Tags: 0.2.2-1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: util.h,v 1.8 2003/08/05 03:35:12 mederchik Exp $ */
 
2
/*
 
3
** Copyright (C) 2001, 2002 Meder Kydyraliev
 
4
**
 
5
** Copyright (C) 2001 Fyodor Yarochkin <fygrave@tigerteam.net>,
 
6
**                    Ofir Arkin       <ofir@sys-security.com>
 
7
**
 
8
** This program is free software; you can redistribute it and/or modify
 
9
** it under the terms of the GNU General Public License as published by
 
10
** the Free Software Foundation; either version 2 of the License, or
 
11
** (at your option) any later version.
 
12
**
 
13
**
 
14
** This program is distributed in the hope that it will be useful,
 
15
** but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
** GNU General Public License for more details.
 
18
**
 
19
** You should have received a copy of the GNU General Public License
 
20
** along with this program; if not, write to the Free Software
 
21
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
22
*/
 
23
 
 
24
#ifndef ICMPUTIL_H
 
25
#define ICMPUTIL_H
 
26
 
 
27
#include <xprobe.h>
 
28
 
 
29
#define DNSREPLYSIZE sizeof(struct ip) + sizeof(struct udphdr)+sizeof(struct DNSHEADER)
 
30
#define TCPPACKETSIZE sizeof(struct ip) + sizeof (struct tcphdr)
 
31
#define SA struct sockaddr
 
32
#define U_CHARMAX 254
 
33
#define U_SHORTMAX 65535
 
34
#define U_INTMAX 0xffffffffU
 
35
#define U_DOUBLEMAX 4294967296
 
36
 
 
37
#define TRUE 1
 
38
#define FALSE 0
 
39
 
 
40
#define DEFPORT 80
 
41
 
 
42
#define TCPPACKETFLAGS TH_SYN
 
43
 
 
44
#define DNSREPLYSTRING "\003www\015securityfocus\003com"
 
45
#define DNSMASQUERADE   "www.securityfocus.com"
 
46
#define DNSREPLYLEN             sizeof(DNSREPLYSTRING)
 
47
 
 
48
struct DNSHEADER{
 
49
        unsigned        id :16;         /* query identification number */
 
50
#if BYTE_ORDER == BIG_ENDIAN
 
51
                        /* fields in third byte */
 
52
        unsigned        qr: 1;          /* response flag */
 
53
        unsigned        opcode: 4;      /* purpose of message */
 
54
        unsigned        aa: 1;          /* authoritive answer */
 
55
        unsigned        tc: 1;          /* truncated message */
 
56
        unsigned        rd: 1;          /* recursion desired */
 
57
                        /* fields in fourth byte */
 
58
        unsigned        ra: 1;          /* recursion available */
 
59
        unsigned        unused :1;      /* unused bits (MBZ as of 4.9.3a3) */
 
60
        unsigned        ad: 1;          /* authentic data from named */
 
61
        unsigned        cd: 1;          /* checking disabled by resolver */
 
62
        unsigned        rcode :4;       /* response code */
 
63
#endif
 
64
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
 
65
                        /* fields in third byte */
 
66
        unsigned        rd :1;          /* recursion desired */
 
67
        unsigned        tc :1;          /* truncated message */
 
68
        unsigned        aa :1;          /* authoritive answer */
 
69
        unsigned        opcode :4;      /* purpose of message */
 
70
        unsigned        qr :1;          /* response flag */
 
71
                        /* fields in fourth byte */
 
72
        unsigned        rcode :4;       /* response code */
 
73
        unsigned        cd: 1;          /* checking disabled by resolver */
 
74
        unsigned        ad: 1;          /* authentic data from named */
 
75
        unsigned        unused :1;      /* unused bits (MBZ as of 4.9.3a3) */
 
76
        unsigned        ra :1;          /* recursion available */
 
77
#endif
 
78
                        /* remaining bytes */
 
79
        unsigned        qdcount :16;    /* number of question entries */
 
80
        unsigned        ancount :16;    /* number of answer entries */
 
81
        unsigned        nscount :16;    /* number of authority entries */
 
82
        unsigned        arcount :16;    /* number of resource entries */
 
83
        u_char          domainname[DNSREPLYLEN-1]; /* string www.hotmail.com */
 
84
                u_short         querytype;
 
85
                u_short         queryclass;
 
86
        u_char          replyname[DNSREPLYLEN-1]; /* string www.hotmail.com */
 
87
                u_short         type;
 
88
                u_short         classs;
 
89
                u_long          ttl;
 
90
                u_short         dl;
 
91
                struct in_addr          replydata;
 
92
        
 
93
};
 
94
 
 
95
#define ICMP_UNREACH            3               /* dest unreachable, codes: */
 
96
#define         ICMP_UNREACH_HOST               1       /* bad host */
 
97
#define         ICMP_UNREACH_PROTOCOL           2       /* bad protocol */
 
98
#define         ICMP_UNREACH_PORT               3       /* bad port */
 
99
#define ICMP_TIMXCEED           11              /* time exceeded, code: */
 
100
#define         ICMP_TIMXCEED_INTRANS   0               /* ttl==0 in transit */
 
101
#define         ICMP_TIMXCEED_REASS     1               /* ttl==0 in reass */
 
102
 
 
103
struct IcmpUnreachHdr {
 
104
        u_char type;
 
105
        u_char code;
 
106
        u_short checksum;
 
107
        u_int zero;
 
108
};
 
109
 
 
110
#endif /* TTL_PRECALC */