From a4a513624c7f56488bcc7a609c9ef391b3ba34d9 Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Wed, 27 Sep 2006 13:44:05 +0000 Subject: [PATCH] removed unneeded UserData in CtrlInterface git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@87 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmCtrlInterface.cpp | 12 ++++++------ core/AmCtrlInterface.h | 22 +++++----------------- core/AmInterfaceHandler.cpp | 2 +- core/AmSipDialog.cpp | 4 ++-- core/sems.cpp | 8 ++++---- 5 files changed, 18 insertions(+), 30 deletions(-) diff --git a/core/AmCtrlInterface.cpp b/core/AmCtrlInterface.cpp index b08c3b51..8d2be106 100644 --- a/core/AmCtrlInterface.cpp +++ b/core/AmCtrlInterface.cpp @@ -15,7 +15,7 @@ #include -AmCtrlInterface* AmCtrlInterface::getNewCtrl(AmCtrlUserData* p) +AmCtrlInterface* AmCtrlInterface::getNewCtrl() { // if(AmConfig::SendMethod == "fifo"){ // return new AmFifoCtrlInterface(p); @@ -26,7 +26,7 @@ AmCtrlInterface* AmCtrlInterface::getNewCtrl(AmCtrlUserData* p) // ERROR("unknown send method\n"); // return 0; - return new AmUnixCtrlInterface(p); + return new AmUnixCtrlInterface(); } int AmCtrlInterface::getLine(string& line) @@ -84,8 +84,8 @@ int AmFifoCtrlInterface::get_param(string& p, char* lb, unsigned int lbs) } -AmFifoCtrlInterface::AmFifoCtrlInterface(AmCtrlUserData* p) - : AmCtrlInterface(p), fp_fifo(NULL) +AmFifoCtrlInterface::AmFifoCtrlInterface() + : AmCtrlInterface(), fp_fifo(NULL) { } @@ -206,8 +206,8 @@ int AmUnixCtrlInterface::get_param(string& p, char* lb, unsigned int lbs) return msg_get_param(msg_c,p,lb,lbs); } -AmUnixCtrlInterface::AmUnixCtrlInterface(AmCtrlUserData* p) - : AmCtrlInterface(p),msg_c(NULL),msg_sz(0) +AmUnixCtrlInterface::AmUnixCtrlInterface() + : AmCtrlInterface(),msg_c(NULL),msg_sz(0) { memset(sock_name,0,UNIX_PATH_MAX); } diff --git a/core/AmCtrlInterface.h b/core/AmCtrlInterface.h index cdb75323..887494fc 100644 --- a/core/AmCtrlInterface.h +++ b/core/AmCtrlInterface.h @@ -18,13 +18,6 @@ using std::auto_ptr; #define CTRL_MSGBUF_SIZE 2048 #define MAX_MSG_ERR 5 -/** \brief user data in a \ref AmCtrlInterface */ -class AmCtrlUserData -{ -public: - virtual ~AmCtrlUserData(){} -}; - /** * \brief Base class for the control interfaces. * @@ -58,8 +51,6 @@ public: class AmCtrlInterface { - auto_ptr u_data; - protected: int fd; bool close_fd; @@ -70,13 +61,13 @@ protected: virtual int get_lines(char* lb, unsigned int lbs)=0; virtual int get_param(string& p, char* lb, unsigned int lbs)=0; - AmCtrlInterface(AmCtrlUserData* p): u_data(p),fd(-1),close_fd(true) {} - AmCtrlInterface(int fd,AmCtrlUserData* p): u_data(p),fd(fd),close_fd(true) {} + AmCtrlInterface(): fd(-1),close_fd(true) {} + AmCtrlInterface(int fd): fd(fd),close_fd(true) {} public: - static AmCtrlInterface* getNewCtrl(AmCtrlUserData* p); + static AmCtrlInterface* getNewCtrl(); virtual ~AmCtrlInterface(){} @@ -110,9 +101,6 @@ public: int getFd() const { return fd; } - const AmCtrlUserData* getUserData() const - { return u_data.get(); } - /** @return -1 on error, 0 if success */ virtual int cacheMsg()=0; int getLine(string& line); @@ -134,7 +122,7 @@ class AmFifoCtrlInterface: public AmCtrlInterface int get_param(string& p, char* lb, unsigned int lbs); public: - AmFifoCtrlInterface(AmCtrlUserData* p); + AmFifoCtrlInterface(); ~AmFifoCtrlInterface(); int createFifo(const string& addr); @@ -163,7 +151,7 @@ class AmUnixCtrlInterface: public AmCtrlInterface int get_param(string& p, char* lb, unsigned int lbs); public: - AmUnixCtrlInterface(AmCtrlUserData* p); + AmUnixCtrlInterface(); ~AmUnixCtrlInterface(); int init(const string& addr); diff --git a/core/AmInterfaceHandler.cpp b/core/AmInterfaceHandler.cpp index 0dfd99e5..43a46506 100644 --- a/core/AmInterfaceHandler.cpp +++ b/core/AmInterfaceHandler.cpp @@ -163,7 +163,7 @@ AmReplyHandler::AmReplyHandler(AmCtrlInterface* ctrl) AmReplyHandler* AmReplyHandler::get() { if(!_instance){ - AmCtrlInterface* ctrl = AmCtrlInterface::getNewCtrl(NULL); + AmCtrlInterface* ctrl = AmCtrlInterface::getNewCtrl(); if(ctrl->init(AmConfig::ReplySocketName)){ ERROR("could not initialize the reply socket '%s'\n", AmConfig::ReplySocketName.c_str()); diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index 596f4a2f..4a7f30aa 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -304,7 +304,7 @@ int AmSipDialog::reply_error(const AmSipRequest& req, unsigned int code, int AmSipDialog::send_reply(const string& msg, const string& reply_sock) { auto_ptr ctrl; - ctrl.reset(AmCtrlInterface::getNewCtrl(NULL)); + ctrl.reset(AmCtrlInterface::getNewCtrl()); if(ctrl->init(reply_sock) || ctrl->sendto(AmConfig::SerSocketName,msg.c_str(),msg.length())){ @@ -452,7 +452,7 @@ int AmSipDialog::cancel() + int2str(cancel_cseq) + "\n\n"; auto_ptr ctrl; - ctrl.reset(AmCtrlInterface::getNewCtrl(NULL)); + ctrl.reset(AmCtrlInterface::getNewCtrl()); if(ctrl->init(reply_sock) || ctrl->sendto(AmConfig::SerSocketName,msg.c_str(),msg.length())){ diff --git a/core/sems.cpp b/core/sems.cpp index f1a2ee35..e3193856 100644 --- a/core/sems.cpp +++ b/core/sems.cpp @@ -203,7 +203,7 @@ static int use_args(char* progname, map& args) AmFifoCtrlInterface* init_fifo(const string& path) { - AmFifoCtrlInterface* ctrl = new AmFifoCtrlInterface(NULL); + AmFifoCtrlInterface* ctrl = new AmFifoCtrlInterface(); if(ctrl->createFifo(path)) goto fifo_error; @@ -420,7 +420,7 @@ int main(int argc, char* argv[]) AmUnixCtrlInterface* un_ctrl=0; if(!AmConfig::SocketName.empty()){ - un_ctrl = new AmUnixCtrlInterface(NULL); + un_ctrl = new AmUnixCtrlInterface(); if(un_ctrl->init(AmConfig::SocketName.c_str())){ delete un_ctrl; un_ctrl = 0; @@ -444,8 +444,8 @@ int main(int argc, char* argv[]) } else { ERROR("Sems cannot start without a working link to Ser.\n" - "Please set in the config file 'fifo_name' and/or\n" - " 'socket_name' parameter and check the log file" + "Please set in the config file 'socket_name' \n" + " parameter and check the log file" " for errors or warnings.\nExiting.\n"); return -1; }