diff options
Diffstat (limited to 'ACE/apps/drwho/SM_Server.cpp')
-rw-r--r-- | ACE/apps/drwho/SM_Server.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/ACE/apps/drwho/SM_Server.cpp b/ACE/apps/drwho/SM_Server.cpp new file mode 100644 index 00000000000..25a43375524 --- /dev/null +++ b/ACE/apps/drwho/SM_Server.cpp @@ -0,0 +1,69 @@ +// $Id$ + +#include "Options.h" +#include "PMS_All.h" +#include "PMS_Flo.h" +#include "PMS_Usr.h" +#include "PMS_Ruser.h" +#include "SM_Server.h" +#include "ace/Log_Msg.h" +#include "ace/OS_Memory.h" + +int +SM_Server::demux (char *packet, int &packet_length) +{ + switch (GET_PACKET_TYPE (packet)) + { + case Options::PROTO_USR: + ACE_NEW_RETURN (this->pm_server, + PMS_Usr, + -1); + break; + case Options::PROTO_ALL: + ACE_NEW_RETURN (this->pm_server, + PMS_All, + -1); + break; + case Options::PROTO_FLO: + ACE_NEW_RETURN (this->pm_server, + PMS_Flo, + -1); + break; + case Options::PROTO_RUSER: + ACE_NEW_RETURN (this->pm_server, + PMS_Ruser, + -1); + break; + default: + ACE_DEBUG ((LM_DEBUG, + "%s: bad protocol\n", + Options::program_name)); + return -1; + } + + packet_length = SUBTRACT_PACKET_TYPE (packet_length); + + if (pm_server->decode (SKIP_PACKET_TYPE (packet), + packet_length) < 0) + return -1; + + if (pm_server->process () < 0) + return -1; + + return 1; +} + +int +SM_Server::mux (char *packet, + int &packet_length) +{ + return pm_server->encode (packet, packet_length); +} + +SM_Server::SM_Server (void) +{ +} + +SM_Server::~SM_Server (void) +{ +} |