1 #include "ace/config-all.h"
2 #include "ace/Log_Msg.h"
3 #include "ace/OS_Memory.h"
4 #include "ace/OS_NS_string.h"
7 #include "Protocol_Manager.h"
9 // Returns a pointer to the Drwho_Node associated with HOST_NAME (if
10 // it exists, otherwise a new node is created. Note that if a
11 // Drwho_Node is found it is moved to the front of the list so that
12 // subsequent finds are faster (i.e., self-organizing!)
15 Protocol_Manager::get_drwho_node (char *key_name
, Drwho_Node
*&head
)
17 Drwho_Node
**temp
= &head
;
18 for (; *temp
!= 0; temp
= &(*temp
)->next_
)
19 if (ACE_OS::strcmp (key_name
,
20 (*temp
)->get_login_name ()) == 0)
25 Drwho_Node (key_name
, head
),
29 Drwho_Node
*t
= *temp
;
31 *temp
= (*temp
)->next_
;
40 Protocol_Manager::Protocol_Manager ()
45 Protocol_Manager::~Protocol_Manager ()
47 if (Options::get_opt (Options::DEBUGGING
))
49 "disposing Protocol_Manager\n"));
52 // Returns the next friend in the sequence of sorted friends.
55 Protocol_Manager::get_next_friend ()
57 return this->ss
->get_next_entry ();
61 Protocol_Manager::get_each_friend ()
63 return this->ss
->get_each_entry ();
66 // Returns the number of friends.
69 Protocol_Manager::friend_count ()
71 return this->ss
->n_elems ();
74 // Returns total number of users logged in throughout the system.
77 Protocol_Manager::get_total_users ()
79 return Protocol_Manager::total_users
;
83 Protocol_Manager::increment_total_users (int remote_users
)
85 Protocol_Manager::total_users
+= remote_users
;