5 #include "ace/Log_Msg.h"
6 #include "ace/OS_NS_string.h"
7 #include "ace/OS_NS_unistd.h"
8 #include "ace/OS_NS_stdio.h"
9 #include "ace/OS_Memory.h"
11 // This function packs the located friends userids, plus the machines
12 // they are logged into (along with the inactive and active counts on
13 // each machine) into a buffer that is subsequently transmitted back
14 // to the client across the network.
17 PMS_Flo::encode (char *packet
, int &packet_length
)
19 if (Options::get_opt (Options::DEBUGGING
) != 0)
21 "in PMS_Flo::encode"));
24 char *buf_ptr
= packet
;
26 ACE_OS::sprintf (buf_ptr
,
28 this->get_total_users ());
29 buf_ptr
+= ACE_OS::strlen (buf_ptr
) + 1;
31 // We only send back info on friends that we actually see logged in.
34 (prp
= this->get_next_friend ()) != 0;
36 buf_ptr
= this->handle_protocol_entries (ACE_OS::strecpy (buf_ptr
,
38 prp
->get_drwho_list ());
40 packet_length
= buf_ptr
- packet
;
42 if (Options::get_opt (Options::DEBUGGING
) != 0)
45 "packet_length = %d\n",
47 ACE_OS::write (ACE_STDERR
, packet
, packet_length
);
55 // This function takes a packet received from the client and calls the
56 // appropriate Protocol_Manager routine to build the local table of
60 PMS_Flo::decode (char *packet
, int &packet_length
)
62 if (Options::get_opt (Options::DEBUGGING
) != 0)
64 "in PMS_Flo::decode, packet_length = %d\n",
67 ACE_NEW_RETURN (this->ss
,