Fast Probing
 All Classes Files Functions Variables Typedefs Macros
fastprobing.h
Go to the documentation of this file.
1 /*
2  * Fast Probing - An Active Probing Library for IP Options Equipped probes (http://traffic.comics.unina.it/)
3  *
4  * Copyright : (C) 2012 by Pietro Marchetta, Walter de Donato, Francesco Cesareo,
5  * Antonio Pescape' (PI)
6  * of the COMICS (COMputer for Interaction and
7  * CommunicationS) Group, Dipartimento di Informatica
8  * e Sistemistica of the University of Napoli "Federico II".
9  *
10  * email : pietro.marchetta@unina.it , walter.dedonato@unina.it , cesareo.francesco@gmail.com
11  * pescape@unina.it
12  *
13  * This program is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation, either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program. If not, see <http://www.gnu.org/licenses/>.
25  *
26  */
27 
28 #ifndef FASTPROBING_H
29 #define FASTPROBING_H
30 
31 #include "probereply.h"
32 #include "generaloption.h"
33 
34 #define NIPS 4
35 
36 typedef u_int8_t uint8;
37 
38 typedef struct pseudoheader // pseudo header for TCP checksum calculations
39 {
40  u_int32_t sip, dip; // IP addr
41  u_int8_t zero; // checksum placeholder
42  u_int8_t protocol; // protocol number
43  u_int16_t tcplen; // tcp packet length
45 
47 {
48 private:
49 
50  int _retrieve_src_addr(uint32& src_addr_raw, GeneralOption* option);
51 
52  int _udp(GeneralOption* option, ProbeReply* reply, std::string dst_addr);
53  int _udp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_ip_addr, std::string ts_addr_1, std::string ts_addr_2, std::string ts_addr_3, std::string ts_addr_4);
54 
55  int _icmp(GeneralOption* option, ProbeReply* reply, std::string dst_addr);
56  int _icmp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_ip_addr, std::string ts_addr_1, std::string ts_addr_2, std::string ts_addr_3, std::string ts_addr_4);
57 
58  int _tcp(GeneralOption* option, ProbeReply* reply, std::string dst_addr);
59  int _tcp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_ip_addr, std::string ts_addr_1, std::string ts_addr_2, std::string ts_addr_3, std::string ts_addr_4);
60 
61  int _protocol(GeneralOption* option, ProbeReply* reply, std::string dst_addr);
62  int _protocol_ts(GeneralOption* option, ProbeReply* reply, std::string dst_ip_addr, std::string ts_addr_1, std::string ts_addr_2, std::string ts_addr_3, std::string ts_addr_4);
63 
64  public:
65  FastProbing();
66  ~FastProbing();
67 
68  // UDP
69  int udp(GeneralOption* option, ProbeReply* reply, std::string dst_addr); // send UDP to D
70  // UDP_TS
71  int udp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr); // send UDP_TS to D|DDDD
72  int udp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1); // send UDP_TS to D|XXXX
73  int udp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1, std::string ts_addr_2); // send UDP_TS to D|XYYY
74  int udp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1, std::string ts_addr_2, std::string ts_addr_3); // send UDP_TS to D|XYZZ
75  int udp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1, std::string ts_addr_2, std::string ts_addr_3, std::string ts_addr_4); // send UDP_TS to D|XYZW
76 
77  // ICMP
78  int icmp(GeneralOption* option, ProbeReply* reply, std::string dst_addr); // send ICMP to D
79  // ICMP_TS
80  int icmp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr); // send ICMP_TS to D|DDDD
81  int icmp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1); // send ICMP_TS to D|XXXX
82  int icmp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1, std::string ts_addr_2); // send ICMP_TS to D|XYYY
83  int icmp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1, std::string ts_addr_2, std::string ts_addr_3); // send ICMP_TS to D|XYZZ
84  int icmp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1, std::string ts_addr_2, std::string ts_addr_3, std::string ts_addr_4); // send ICMP_TS to D|XYZW
85 
86  // TCP
87  int tcp(GeneralOption* option, ProbeReply* reply, std::string dst_addr); // send TCP to D
88  // TCP_TS
89  int tcp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr); // send TCP_TS to D|DDDD
90  int tcp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1); // send ICMP_TS to D|XXXX
91  int tcp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1, std::string ts_addr_2); // send ICMP_TS to D|XYYY
92  int tcp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1, std::string ts_addr_2, std::string ts_addr_3); // send ICMP_TS to D|XYZZ
93  int tcp_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1, std::string ts_addr_2, std::string ts_addr_3, std::string ts_addr_4); // send ICMP_TS to D|XYZW
94 
95  // PROTOCOL
96  int protocol(GeneralOption* option, ProbeReply* reply, std::string dst_addr);
97  // PROTOCOL_TS
98  int protocol_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr); // send PROTOCOL_TS to D|DDDD
99  int protocol_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1); // send ICMP_TS to D|XXXX
100  int protocol_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1, std::string ts_addr_2); // send ICMP_TS to D|XYYY
101  int protocol_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1, std::string ts_addr_2, std::string ts_addr_3); // send ICMP_TS to D|XYZZ
102  int protocol_ts(GeneralOption* option, ProbeReply* reply, std::string dst_addr, std::string ts_addr_1, std::string ts_addr_2, std::string ts_addr_3, std::string ts_addr_4); // send ICMP_TS to D|XYZW
103 
104 };
105 
106 #endif // FASTPROBING_H