fixed typo
[anytun.git] / anyctrOptions.h
blobedbd62157dc3441d134dc40401eb9291ade93587
1 /*
2 * anytun
4 * The secure anycast tunneling protocol (satp) defines a protocol used
5 * for communication between any combination of unicast and anycast
6 * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel
7 * mode and allows tunneling of every ETHER TYPE protocol (e.g.
8 * ethernet, ip, arp ...). satp directly includes cryptography and
9 * message authentication based on the methodes used by SRTP. It is
10 * intended to deliver a generic, scaleable and secure solution for
11 * tunneling and relaying of packets of any protocol.
14 * Copyright (C) 2007 anytun.org <satp@wirdorange.org>
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2
18 * as published by the Free Software Foundation.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program (see the file COPYING included with this
27 * distribution); if not, write to the Free Software Foundation, Inc.,
28 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #ifndef _ANYCTR_OPTIONS_H_
32 #define _ANYCTR_OPTIONS_H_
34 #include "datatypes.h"
35 #include "buffer.h"
36 #include "threadUtils.hpp"
37 #include <list>
39 typedef struct OptionConnectTo
41 std::string host;
42 uint16_t port;
45 typedef std::list<OptionConnectTo> ConnectToList;
47 class Options
49 public:
50 static Options& instance();
52 bool parse(int argc, char* argv[]);
53 void printUsage();
54 void printOptions();
56 std::string getProgname();
57 Options& setProgname(std::string p);
58 std::string getRemoteAddr();
59 Options& setRemoteAddr(std::string r);
60 u_int16_t getRemotePort();
61 Options& setRemotePort(u_int16_t r);
62 Options& setRemoteAddrPort(std::string addr, u_int16_t port);
63 std::string getIfconfigParamRemoteNetmask();
64 Options& setIfconfigParamRemoteNetmask(std::string i);
65 window_size_t getSeqWindowSize();
66 Options& setSeqWindowSize(window_size_t s);
67 std::string getKdPrf();
68 Options& setKdPrf(std::string k);
69 Options& setMux(u_int16_t m);
70 u_int16_t getMux();
71 Options& setKey(std::string k);
72 Buffer getKey();
73 Options& setSalt(std::string s);
74 Buffer getSalt();
75 Options& setNetworkPrefixLength(u_int16_t l);
76 u_int16_t getNetworkPrefixLength();
78 private:
79 Options();
80 ~Options();
81 Options(const Options &l);
82 void operator=(const Options &l);
84 static Options* inst;
85 static Mutex instMutex;
86 class instanceCleaner {
87 public: ~instanceCleaner() {
88 if(Options::inst != 0)
89 delete Options::inst;
92 friend class instanceCleaner;
94 Mutex mutex;
96 ConnectToList connect_to_;
97 std::string progname_;
98 std::string remote_addr_;
99 u_int16_t remote_port_;
100 std::string ifconfig_param_local_;
101 std::string ifconfig_param_remote_netmask_;
102 window_size_t seq_window_size_;
103 std::string kd_prf_;
104 u_int16_t mux_;
105 u_int16_t network_prefix_length_;
106 Buffer key_;
107 Buffer salt_;
110 extern Options& gOpt;
112 #endif