Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / apps / drwho / SM_Client.cpp
blob17e5635799a23a1fb9bc370482a91a6422182485
1 #include "Options.h"
2 #include "PMC_All.h"
3 #include "PMC_Flo.h"
4 #include "PMC_Usr.h"
5 #include "PMC_Ruser.h"
6 #include "SM_Client.h"
7 #include "ace/Log_Msg.h"
8 #include "ace/OS_Memory.h"
10 // Call-back function that invokes the appropriate decode function.
12 int
13 SM_Client::demux (char *packet,
14 int &packet_length)
16 if (this->pm_client->decode (packet, packet_length) < 0)
17 return -1;
18 else
19 return 1;
22 // Call-back function that invokes the appropriate encode function.
24 int
25 SM_Client::mux (char *packet, int &packet_length)
27 switch (Options::protocol_type)
29 case Options::PROTO_USR:
30 ACE_NEW_RETURN (this->pm_client,
31 PMC_Usr (Options::user_name),
32 -1);
33 break;
34 case Options::PROTO_ALL:
35 ACE_NEW_RETURN (this->pm_client,
36 PMC_All,
37 -1);
38 break;
39 case Options::PROTO_FLO:
40 ACE_NEW_RETURN (this->pm_client,
41 PMC_Flo,
42 -1);
43 break;
44 case Options::PROTO_RUSER:
45 ACE_NEW_RETURN (this->pm_client,
46 PMC_Ruser,
47 -1);
48 break;
49 default:
50 ACE_DEBUG ((LM_DEBUG,
51 "%s: bad protocol\n",
52 Options::program_name));
53 return -1;
56 if (this->pm_client->encode (packet, packet_length) < 0)
57 return -1;
58 return 1;
61 SM_Client::SM_Client ()
65 SM_Client::~SM_Client ()
69 void
70 SM_Client::process ()
72 this->pm_client->process ();