From 8cb60ca0a52f5e11bac27da542c153d9e8ed2551 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 28 Feb 2008 20:57:22 +0000 Subject: anyrtpproxy almost finished --- anyrtpproxy/options.h | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'anyrtpproxy/options.h') diff --git a/anyrtpproxy/options.h b/anyrtpproxy/options.h index f4aeb5d..48df36a 100644 --- a/anyrtpproxy/options.h +++ b/anyrtpproxy/options.h @@ -32,6 +32,31 @@ #define _OPTIONS_H_ #include "../threadUtils.hpp" +#include +#include + +class IfListElement +{ +public: + IfListElement(std::string host, u_int16_t port) : host_(host), port_(port) {} + IfListElement(std::string host_port) + { + std::istringstream iss(host_port); + getline(iss, host_, ':'); + if(!(iss >> port_)) port_ = 0; + } + std::string toString() const + { + std::ostringstream oss; + oss << host_ << ":" << port_; + return oss.str(); + } + + std::string host_; + u_int16_t port_; +}; + +typedef std::list IfList; class Options { @@ -44,13 +69,23 @@ public: std::string getProgname(); Options& setProgname(std::string p); - + bool getChroot(); + Options& setChroot(bool c); + std::string getUsername(); + Options& setUsername(std::string u); + std::string getChrootDir(); + Options& setChrootDir(std::string c); + bool getDaemonize(); + Options& setDaemonize(bool d); + IfList getLocalInterfaces(); + IfList getRemoteHosts(); private: Options(); ~Options(); Options(const Options &l); void operator=(const Options &l); + bool sanityCheck(); static Options* inst; static Mutex instMutex; @@ -65,6 +100,12 @@ private: Mutex mutex; std::string progname_; + bool chroot_; + std::string username_; + std::string chroot_dir_; + bool daemonize_; + IfList local_interfaces_; + IfList remote_hosts_; }; extern Options& gOpt; -- cgit v1.2.3