00001 /* 00002 * anytun 00003 * 00004 * The secure anycast tunneling protocol (satp) defines a protocol used 00005 * for communication between any combination of unicast and anycast 00006 * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel 00007 * mode and allows tunneling of every ETHER TYPE protocol (e.g. 00008 * ethernet, ip, arp ...). satp directly includes cryptography and 00009 * message authentication based on the methodes used by SRTP. It is 00010 * intended to deliver a generic, scaleable and secure solution for 00011 * tunneling and relaying of packets of any protocol. 00012 * 00013 * 00014 * Copyright (C) 2007 anytun.org <satp@wirdorange.org> 00015 * 00016 * This program is free software; you can redistribute it and/or modify 00017 * it under the terms of the GNU General Public License version 2 00018 * as published by the Free Software Foundation. 00019 * 00020 * This program is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * You should have received a copy of the GNU General Public License 00026 * along with this program (see the file COPYING included with this 00027 * distribution); if not, write to the Free Software Foundation, Inc., 00028 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00029 */ 00030 00031 #ifndef _OPTIONS_H_ 00032 #define _OPTIONS_H_ 00033 00034 #include "datatypes.h" 00035 #include "threadUtils.hpp" 00036 00037 class Options 00038 { 00039 public: 00040 Options(); 00041 bool parse(int argc, char* argv[]); 00042 void printUsage(); 00043 void printOptions(); 00044 00045 std::string getProgname(); 00046 Options& setProgname(std::string p); 00047 sender_id_t getSenderId(); 00048 Options& setSenderId(sender_id_t s); 00049 std::string getLocalAddr(); 00050 Options& setLocalAddr(std::string l); 00051 std::string getLocalSyncAddr(); 00052 Options& setLocalSyncAddr(std::string l); 00053 u_int16_t getLocalPort(); 00054 Options& setLocalPort(u_int16_t l); 00055 std::string getRemoteAddr(); 00056 Options& setRemoteAddr(std::string r); 00057 u_int16_t getLocalSyncPort(); 00058 Options& setLocalSyncPort(u_int16_t l); 00059 u_int16_t getRemotePort(); 00060 Options& setRemotePort(u_int16_t r); 00061 Options& setRemoteAddrPort(std::string addr, u_int16_t port); 00062 std::string getDevName(); 00063 Options& setDevName(std::string d); 00064 std::string getDevType(); 00065 Options& setDevType(std::string d); 00066 std::string getIfconfigParamLocal(); 00067 Options& setIfconfigParamLocal(std::string i); 00068 std::string getIfconfigParamRemoteNetmask(); 00069 Options& setIfconfigParamRemoteNetmask(std::string i); 00070 window_size_t getSeqWindowSize(); 00071 Options& setSeqWindowSize(window_size_t s); 00072 std::string getCypher(); 00073 Options& setCypher(std::string c); 00074 std::string getAuthAlgo(); 00075 Options& setAuthAlgo(std::string a); 00076 00077 private: 00078 Mutex mutex; 00079 00080 std::string progname_; 00081 sender_id_t sender_id_; 00082 std::string local_addr_; 00083 std::string local_sync_addr_; 00084 u_int16_t local_port_; 00085 u_int16_t local_sync_port_; 00086 std::string remote_addr_; 00087 u_int16_t remote_port_; 00088 std::string dev_name_; 00089 std::string dev_type_; 00090 std::string ifconfig_param_local_; 00091 std::string ifconfig_param_remote_netmask_; 00092 window_size_t seq_window_size_; 00093 std::string cypher_; 00094 std::string auth_algo_; 00095 }; 00096 00097 #endif