From 341e86693229de761e5241ed2de68001c0dbdffe Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 29 Feb 2008 19:55:02 +0000 Subject: redone the bad anyrtpproxy --- anyrtpproxy/options.h | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'anyrtpproxy/options.h') diff --git a/anyrtpproxy/options.h b/anyrtpproxy/options.h index 48139f7..c75da6a 100644 --- a/anyrtpproxy/options.h +++ b/anyrtpproxy/options.h @@ -35,28 +35,28 @@ #include #include -class IfListElement +class Host { public: - IfListElement(std::string host, u_int16_t port) : host_(host), port_(port) {} - IfListElement(std::string host_port) + Host(std::string addr, u_int16_t port) : addr_(addr), port_(port) {} + Host(std::string addr_port) { - std::istringstream iss(host_port); - getline(iss, host_, ':'); + std::istringstream iss(addr_port); + getline(iss, addr_, ':'); if(!(iss >> port_)) port_ = 0; } std::string toString() const { std::ostringstream oss; - oss << host_ << ":" << port_; + oss << addr_ << ":" << port_; return oss.str(); } - std::string host_; + std::string addr_; u_int16_t port_; }; -typedef std::list IfList; +typedef std::list HostList; class Options { @@ -68,19 +68,13 @@ public: void printOptions(); 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); u_int16_t getSendPort(); - Options& setSendPort(u_int16_t p); - IfList getLocalInterfaces(); - IfList getRemoteHosts(); + Host getControlInterface(); + HostList getRemoteHosts(); private: Options(); @@ -107,8 +101,8 @@ private: std::string chroot_dir_; bool daemonize_; u_int16_t send_port_; - IfList local_interfaces_; - IfList remote_hosts_; + Host control_interface_; + HostList remote_hosts_; }; extern Options& gOpt; -- cgit v1.2.3