This patch adds EnableServer as a virtual to base NetworkServer class, so that protocol frameworks do not need to explicitly cast their netserver member. Index: kis_droneframe.cc =================================================================== --- kis_droneframe.cc (revision 2977) +++ kis_droneframe.cc (working copy) @@ -253,9 +253,7 @@ return -1; } - TcpServer *tcpsrv = (TcpServer *) netserver; - - if (tcpsrv->EnableServer() < 0 || globalreg->fatal_condition) { + if (netserver->EnableServer() < 0 || globalreg->fatal_condition) { _MSG("Failed to enable TCP listener for Kismet drone server", MSGFLAG_FATAL); globalreg->fatal_condition = 1; @@ -264,9 +262,6 @@ netserver->RegisterServerFramework(this); - osstr << "Created Kismet drone TCP server on port " << tcpsrv->FetchPort(); - _MSG(osstr.str(), MSGFLAG_INFO); - return 1; } Index: netframework.h =================================================================== --- netframework.h (revision 2977) +++ netframework.h (working copy) @@ -78,7 +78,7 @@ // Generic stuff that every network-y server will need to do. // Most of this needs to be overridden - + // Core select loop merge - combine FDs with the master FD list, and // handle a strobe across pending FDs virtual int MergeSet(int in_max_fd, fd_set *out_rset, fd_set *out_wset); @@ -128,6 +128,9 @@ // Fetch a clients remote address virtual string GetRemoteAddr(int in_fd) = 0; + // Enable server + virtual int EnableServer() = 0; + // Shutdown the server virtual void Shutdown() = 0; Index: kis_netframe.cc =================================================================== --- kis_netframe.cc (revision 2977) +++ kis_netframe.cc (working copy) @@ -647,8 +647,6 @@ } int KisNetFramework::Activate() { - char errstr[1024]; - if (server_type != 0) { _MSG("KisNetFramework unknown server type, something didn't initialize", MSGFLAG_FATAL); @@ -656,18 +654,13 @@ return -1; } - TcpServer *tcpsrv = (TcpServer *) netserver; - - if (tcpsrv->EnableServer() < 0 || globalreg->fatal_condition) { + if (netserver->EnableServer() < 0 || globalreg->fatal_condition) { _MSG("Failed to enable TCP listener for the Kismet UI server", MSGFLAG_FATAL); globalreg->fatal_condition = 1; return -1; } netserver->RegisterServerFramework(this); - snprintf(errstr, 1024, "Created Kismet UI TCP server on port %d", - tcpsrv->FetchPort()); - _MSG(errstr, MSGFLAG_INFO); return 1; } Index: tcpserver.cc =================================================================== --- tcpserver.cc (revision 2977) +++ tcpserver.cc (working copy) @@ -116,6 +116,9 @@ free(maskaddr); } + snprintf(errstr, 1024, "Created TCP listener on port %d", + FetchPort()); + _MSG(errstr, MSGFLAG_INFO); return 1; }