1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
// $Id$
#include "global.h"
#include "Options.h"
#include "HT_Client.h"
#include "PMC_All.h"
#include "ace/ACE.h"
// This function is pretty much a no-op that just sets up the
// appropriate lookup function to use.
int
PMC_All::encode (char *packet, int &packet_length)
{
if (Options::get_opt (Options::DEBUG) != 0)
ACE_DEBUG ((LM_DEBUG,
"in PMC_All::encode\n"));
ACE_NEW_RETURN (this->ss,
HT_Client,
-1);
SET_PACKET_TYPE (packet, Options::PROTO_ALL);
char *buf_ptr = SKIP_PACKET_TYPE (packet);
packet_length = buf_ptr - packet;
return 1;
}
// This method is responsible for transforming the msg from the server
// back into a form usable by the client. Note that it reads the
// REAL_NAME from the packet (since the server placed it there)...
int
PMC_All::decode (char *packet, int &packet_length)
{
if (Options::get_opt (Options::DEBUG) != 0)
{
ACE_DEBUG ((LM_DEBUG,
"in PMC_All::decode, packet_length = %d\n",
packet_length));
ACE_OS::write (ACE_STDERR, packet, packet_length);
ACE_DEBUG ((LM_DEBUG,
"\n"));
}
char *cp = packet;
int remote_users = 0;
sscanf (cp,
"Users %d",
&remote_users);
this->increment_total_users (remote_users);
for (cp = (char *) ACE::strend (cp);
*cp != '\n';
cp++)
{
// Skip over the LOGIN_NAME.
char *login_name = cp;
char *real_name = cp = (char *) ACE::strend (cp);
for (cp = (char *) ACE::strend (cp);
*(cp = this->handle_protocol_entries (cp, login_name, real_name)) != '\t';
)
continue;
}
return 1;
}
Protocol_Record *
PMC_All::insert_protocol_info (Protocol_Record &protocol_record)
{
Protocol_Record *prp = PM_Client::insert_protocol_info (protocol_record);
int length = ACE_OS::strlen (prp->set_real (ACE::strnew (protocol_record.get_real ())));
if (length > this->max_key_length)
this->max_key_length = length;
return prp;
}
void
PMC_All::process (void)
{
ACE_DEBUG ((LM_DEBUG,
"remote users logged on\n"));
PM_Client::process ();
}
PMC_All::PMC_All (void)
{
}
|