2 #include "Rwho_DB_Manager.h"
5 #include "ace/OS_NS_string.h"
6 #include "ace/OS_NS_stdio.h"
8 // This is the main method for the server side of things. It reads
9 // the RWHO file on the local machine and inserts HOST_NAME
10 // information for each LOGIN_NAME that is a friend into the
11 // DRWHO_LIST. This function is also responsible for determining
12 // whether a given LOGIN_NAME is currently idle or not.
18 Protocol_Record
protocol_record (1);
20 while (ru
.get_next_user (protocol_record
) > 0)
21 this->insert_protocol_info (protocol_record
);
26 // Insert the HOST_NAME into the server's lookup table on behalf of
27 // user LOGIN_NAME. Note that we need to allocate memory for
31 PM_Server::insert_protocol_info (Protocol_Record
&protocol_record
)
33 Protocol_Record
*prp
= this->ss
->insert (protocol_record
.get_login ());
35 Drwho_Node
*current_node
= protocol_record
.get_drwho_list ();
37 if (current_node
->get_idle_time () < MAX_USER_TIMEOUT
)
38 this->increment_total_users ();
43 this->get_drwho_node (ACE::strnew (current_node
->get_host_name ()),
46 if (current_node
->get_idle_time () >= MAX_USER_TIMEOUT
)
47 np
->inactive_count_
++;
55 // Put the inactive and active counts, plus the hostname into the
59 PM_Server::handle_protocol_entries (char *buf_ptr
,
62 for (; np
!= 0; np
= np
->next_
)
64 ACE_OS::sprintf (buf_ptr
,
66 np
->get_inactive_count (),
67 np
->get_active_count (),
68 np
->get_host_name ());
69 buf_ptr
+= ACE_OS::strlen (buf_ptr
) + 1;
75 PM_Server::PM_Server ()
79 PM_Server::~PM_Server ()