~ubuntu-branches/ubuntu/trusty/xprobe/trusty

« back to all changes in this revision

Viewing changes to src/xprobe.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: xprobe.h,v 1.7 2005/02/13 18:41:31 mederchik Exp $ */
 
2
/*
 
3
** Copyright (C) 2001 Fyodor Yarochkin <fygrave@tigerteam.net>,
 
4
**                    Ofir Arkin       <ofir@sys-security.com>
 
5
**
 
6
** This program is free software; you can redistribute it and/or modify
 
7
** it under the terms of the GNU General Public License as published by
 
8
** the Free Software Foundation; either version 2 of the License, or
 
9
** (at your option) any later version.
 
10
**
 
11
**
 
12
** This program is distributed in the hope that it will be useful,
 
13
** but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
** GNU General Public License for more details.
 
16
**
 
17
** You should have received a copy of the GNU General Public License
 
18
** along with this program; if not, write to the Free Software
 
19
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
20
*/
 
21
 
 
22
#ifndef XPROBE_H
 
23
#define XPROBE_H
 
24
 
 
25
#include "config.h"
 
26
#include <stdio.h>
 
27
#include <stdlib.h>
 
28
#include <unistd.h>
 
29
 
 
30
#include <time.h>
 
31
#define IP_VERSION 4
 
32
 
 
33
#ifdef HAVE_STRING_H
 
34
#include <string.h>
 
35
#endif
 
36
#ifdef HAVE_STRINGS_H
 
37
#include <strings.h>
 
38
#endif
 
39
 
 
40
#include <sys/param.h>
 
41
 
 
42
#ifndef bzero
 
43
#ifdef NOBZERO
 
44
#define bzero(x,y) memset((void *)x,(int)0,(size_t) y)
 
45
#define bcopy(x,y,z) memcpy((void *)y, (const void *)x, (size_t) z)
 
46
#endif /* NOBZERO */
 
47
#endif /* bzero*/
 
48
 
 
49
#include <stdarg.h>
 
50
#include <errno.h>
 
51
 
 
52
#ifdef __linux__
 
53
#ifdef HAVE_GLIB_H
 
54
#include <glib.h>
 
55
#endif
 
56
#endif
 
57
 
 
58
#include <sys/types.h>
 
59
#include <sys/file.h>
 
60
#include <sys/stat.h>
 
61
#include <sys/ioctl.h>
 
62
#include <dirent.h>
 
63
#include <time.h>
 
64
#include <sys/time.h>
 
65
#ifdef __linux__ 
 
66
#define __FAVOR_BSD
 
67
#endif
 
68
/* fix the OsX bug */
 
69
#ifndef _BSD_SOCKLEN_T_
 
70
#define _BSD_SOCKLEN_T_ unsigned int
 
71
#endif
 
72
#include <sys/socket.h>
 
73
#include <net/if.h>
 
74
#include <net/route.h>
 
75
#include <netinet/in.h>
 
76
#include <arpa/nameser.h>
 
77
#include <netinet/in_systm.h>
 
78
#include <netinet/ip.h>
 
79
#ifndef __linux__
 
80
//#include <netinet/ip_var.h>
 
81
#else /* __linux__ */
 
82
#include <sys/time.h>
 
83
#endif /* __linux__ */
 
84
#include <netinet/ip_icmp.h>
 
85
// #include <netinet/tcp.h>
 
86
#ifndef  IFNAMSIZ
 
87
#include <net/if.h>
 
88
#endif
 
89
#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(SOLARIS) &&  !defined(__sgi)
 
90
#include <net/ethernet.h>
 
91
#endif
 
92
 
 
93
#ifdef SOLARIS
 
94
#include <sys/sockio.h>
 
95
#ifndef INADDR_NONE
 
96
#define INADDR_NONE -1
 
97
#endif
 
98
#endif
 
99
 
 
100
#include <netinet/if_ether.h>
 
101
#include <netdb.h>
 
102
#include <arpa/inet.h>
 
103
#include <ctype.h>
 
104
// #include <math.h> /* conflicts with <string>
 
105
#include <signal.h>
 
106
#ifdef HAVE_DLFCN_H
 
107
#include <dlfcn.h>
 
108
#endif
 
109
 
 
110
#ifdef __cplusplus
 
111
extern "C" {
 
112
#include <pcap.h>
 
113
}
 
114
#else
 
115
#include <pcap.h>
 
116
#endif
 
117
 
 
118
/* some types correction */
 
119
#if defined(__FreeBSD__) || defined(__linux__)
 
120
#define TIMEZONE_T struct timezone
 
121
#else
 
122
#define TIMEZONE_T unsigned long
 
123
#endif
 
124
#ifndef IF_NAMESIZE
 
125
#define IF_NAMESIZE 16
 
126
#endif
 
127
 
 
128
/* macroses */
 
129
/* linux and OpenBSD want ip offset in network order, others: in host
 
130
 * order
 
131
 */
 
132
 
 
133
#if defined(__linux__) || defined(__OpenBSD__)    
 
134
#define IPOFF_FIX(off)      htons((unsigned short)(off))
 
135
#else
 
136
#define IPOFF_FIX(off)      (off)
 
137
#endif
 
138
 
 
139
#define IFRLEN(ifrptr)  (ifrptr->ifr_addr.sa_len + sizeof(ifrptr->ifr_name))
 
140
 
 
141
#include "defines.h"
 
142
#include "xprobe_timeval.h"
 
143
// STL includes
 
144
#include <string>
 
145
#include <map>
 
146
#include <vector>
 
147
#include <algorithm>
 
148
#endif /* XPROBE_H */