Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / apps / drwho / SM_Server.cpp
blobbcc2a29f33e7e88e627c4ce2c16b7f953b1b9325
1 #include "Options.h"
2 #include "PMS_All.h"
3 #include "PMS_Flo.h"
4 #include "PMS_Usr.h"
5 #include "PMS_Ruser.h"
6 #include "SM_Server.h"
7 #include "ace/Log_Msg.h"
8 #include "ace/OS_Memory.h"
10 int
11 SM_Server::demux (char *packet, int &packet_length)
13 switch (GET_PACKET_TYPE (packet))
15 case Options::PROTO_USR:
16 ACE_NEW_RETURN (this->pm_server,
17 PMS_Usr,
18 -1);
19 break;
20 case Options::PROTO_ALL:
21 ACE_NEW_RETURN (this->pm_server,
22 PMS_All,
23 -1);
24 break;
25 case Options::PROTO_FLO:
26 ACE_NEW_RETURN (this->pm_server,
27 PMS_Flo,
28 -1);
29 break;
30 case Options::PROTO_RUSER:
31 ACE_NEW_RETURN (this->pm_server,
32 PMS_Ruser,
33 -1);
34 break;
35 default:
36 ACE_DEBUG ((LM_DEBUG,
37 "%s: bad protocol\n",
38 Options::program_name));
39 return -1;
42 packet_length = SUBTRACT_PACKET_TYPE (packet_length);
44 if (pm_server->decode (SKIP_PACKET_TYPE (packet),
45 packet_length) < 0)
46 return -1;
48 if (pm_server->process () < 0)
49 return -1;
51 return 1;
54 int
55 SM_Server::mux (char *packet,
56 int &packet_length)
58 return pm_server->encode (packet, packet_length);
61 SM_Server::SM_Server ()
65 SM_Server::~SM_Server ()