IPPOLib
 All Classes Files Functions Variables Typedefs Macros
generaloption.h
Go to the documentation of this file.
1 /*
2  * ippo-lib - IP oPtion-based active PrObing
3  * An Active Probing Library for IP Options Equipped probes (http://traffic.comics.unina.it/ippolib)
4  *
5  * Copyright : (C) 2012 by Pietro Marchetta, Walter de Donato, Francesco Cesareo,
6  * Antonio Pescape' (PI)
7  * of the COMICS (COMputer for Interaction and
8  * CommunicationS) Group, Dipartimento di Informatica
9  * e Sistemistica of the University of Napoli "Federico II".
10  *
11  * email : pietro.marchetta@unina.it , walter.dedonato@unina.it , cesareo.francesco@gmail.com
12  * pescape@unina.it
13  *
14  * This program is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation, either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program. If not, see <http://www.gnu.org/licenses/>.
26  *
27  */
28 
29 #ifndef GENERALOPTION_H
30 #define GENERALOPTION_H
31 
32 #include <string>
33 
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <unistd.h>
37 
38 #include <arpa/inet.h>
39 
40 typedef unsigned short uint16;
41 typedef unsigned int uint32;
42 
44 {
45 private:
46  bool _verbose_mode;
47  int _retries;
48  int _timeout;
49  int _ttl;
50 
51  pid_t _ipid;
52  int _protocol_number;
53 
54  std::string _eth;
55 
56  uint16 _src_port;
57  uint16 _dst_port;
58 
59  int _socketudp;
60  pthread_mutex_t _lock;
61 
62  void _default_value();
63 
64 public:
65  GeneralOption();
67  GeneralOption(int socketudp, pthread_mutex_t lock);
68 
70 
71  int retries();
72  void set_retries(int retries);
73 
74  int timeout();
75  void set_timeout(int timeout);
76 
77  int ttl();
78  void set_ttl(int ttl);
79 
80  pid_t ip_id();
81 
82  std::string eth();
83  void set_eth(std::string eth);
84 
85  int socketudp();
86  void set_socketudp(int socketudp);
87 
88  pthread_mutex_t lock();
89  void set_lock(pthread_mutex_t lock);
90 
91  int protocol_number();
92  void set_protocol_number(int protocol_number);
93 
94  bool verbose_mode();
95  void set_verbose_mode(bool verbose_mode);
96 
97  uint16 src_port();
98  void set_src_port(uint16 src_port);
99 
100  uint16 dst_port();
101  void set_dst_port(uint16 dst_port);
102 };
103 
104 #endif // GENERALOPTION_H