diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-04-20 16:23:14 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-04-20 16:23:14 +0000 |
commit | 331cb9c4d12c6e7f42c58bf679b40de0249993d0 (patch) | |
tree | 9e166379282c47d78e3822db842f7f0000250a3d /apps | |
parent | a838cef26db076242f1cf07b9be833576b87ce66 (diff) | |
download | ATCD-331cb9c4d12c6e7f42c58bf679b40de0249993d0.tar.gz |
ChangeLogTag:Thu Apr 20 09:20:28 2000 Carlos O'Ryan <coryan@uci.edu>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/drwho/CM_Client.cpp | 19 | ||||
-rw-r--r-- | apps/drwho/CM_Server.cpp | 13 | ||||
-rw-r--r-- | apps/drwho/ChangeLog | 330 | ||||
-rw-r--r-- | apps/drwho/Drwho_Node.cpp | 20 | ||||
-rw-r--r-- | apps/drwho/File_Manager.cpp | 55 | ||||
-rw-r--r-- | apps/drwho/HT_Client.cpp | 5 | ||||
-rw-r--r-- | apps/drwho/HT_Server.cpp | 1 | ||||
-rw-r--r-- | apps/drwho/Hash_Table.cpp | 7 | ||||
-rw-r--r-- | apps/drwho/Makefile | 64 | ||||
-rw-r--r-- | apps/drwho/PMC_All.cpp | 11 | ||||
-rw-r--r-- | apps/drwho/PMC_Flo.cpp | 11 | ||||
-rw-r--r-- | apps/drwho/PMC_Ruser.cpp | 12 | ||||
-rw-r--r-- | apps/drwho/PMC_Usr.cpp | 19 | ||||
-rw-r--r-- | apps/drwho/PMS_All.cpp | 7 | ||||
-rw-r--r-- | apps/drwho/PMS_Flo.cpp | 1 | ||||
-rw-r--r-- | apps/drwho/PMS_Ruser.cpp | 13 | ||||
-rw-r--r-- | apps/drwho/PMS_Usr.cpp | 3 | ||||
-rw-r--r-- | apps/drwho/PM_Client.cpp | 35 | ||||
-rw-r--r-- | apps/drwho/PM_Server.cpp | 5 | ||||
-rw-r--r-- | apps/drwho/Protocol_Manager.cpp | 15 | ||||
-rw-r--r-- | apps/drwho/Protocol_Record.cpp | 38 | ||||
-rw-r--r-- | apps/drwho/Rwho_DB_Manager.cpp | 40 | ||||
-rw-r--r-- | apps/drwho/Single_Lookup.cpp | 1 | ||||
-rw-r--r-- | apps/drwho/server.cpp | 5 |
24 files changed, 404 insertions, 326 deletions
diff --git a/apps/drwho/CM_Client.cpp b/apps/drwho/CM_Client.cpp index 4c553b04dae..e223b404fbd 100644 --- a/apps/drwho/CM_Client.cpp +++ b/apps/drwho/CM_Client.cpp @@ -9,13 +9,11 @@ int CM_Client::open (short port_number) { - int max_packet_size = UDP_PACKET_SIZE; - Comm_Manager::sokfd_ = ACE_OS::socket (PF_INET, SOCK_DGRAM, 0); if (Comm_Manager::sokfd_ == ACE_INVALID_HANDLE) return -1; - + ACE_OS::memset ((char *) &this->sin_, 0, sizeof this->sin_); @@ -43,7 +41,7 @@ CM_Client::receive (int timeout) if (ACE_OS::select (Comm_Manager::sokfd_ + 1, &this->read_fd_, 0, - 0, + 0, this->top_) <= 0) break; else @@ -80,9 +78,9 @@ CM_Client::receive (int timeout) } for (const char *host_name; - Multicast_Manager::get_next_non_responding_host (host_name); + Multicast_Manager::get_next_non_responding_host (host_name); ) - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "%s did not respond\n", host_name)); return 1; @@ -92,10 +90,10 @@ int CM_Client::send (void) { int packet_length = 0; - + if (this->mux (this->send_packet_, packet_length) < 0) return -1; - + // Ship off the info to all the hosts. while (Multicast_Manager::get_next_host_addr (this->sin_.sin_addr) != 0) @@ -105,8 +103,8 @@ CM_Client::send (void) hostent *np = ACE_OS::gethostbyaddr ((char *) &this->sin_.sin_addr, sizeof this->sin_.sin_addr, AF_INET); - - ACE_DEBUG ((LM_DEBUG, + + ACE_DEBUG ((LM_DEBUG, "sending to server host %s (%s)\n", np->h_name, inet_ntoa (this->sin_.sin_addr))); @@ -136,4 +134,3 @@ CM_Client::~CM_Client (void) ACE_OS::closesocket (Comm_Manager::sokfd_); } - diff --git a/apps/drwho/CM_Server.cpp b/apps/drwho/CM_Server.cpp index 5f9fc643045..97e21e5f855 100644 --- a/apps/drwho/CM_Server.cpp +++ b/apps/drwho/CM_Server.cpp @@ -3,10 +3,11 @@ #include "global.h" #include "Options.h" #include "CM_Server.h" +#include "ace/ACE.h" -// Creates and binds a UDP socket... +// Creates and binds a UDP socket... -int +int CM_Server::open (short port_number) { int max_packet_size = UDP_PACKET_SIZE; @@ -15,13 +16,13 @@ CM_Server::open (short port_number) if (this->sokfd_ < 0) return -1; - + ACE_OS::memset (&this->sin_, sizeof this->sin_, 0); this->sin_.sin_family = AF_INET; this->sin_.sin_port = htons (port_number); this->sin_.sin_addr.s_addr = INADDR_ANY; - // This call fails if an rflo daemon is already running. + // This call fails if an rflo daemon is already running. if (ACE_OS::bind (this->sokfd_, (sockaddr *) &this->sin_, sizeof this->sin_) < 0) @@ -40,7 +41,7 @@ CM_Server::open (short port_number) int CM_Server::receive (int) { - int sin_len = sizeof this->sin_; + size_t sin_len = sizeof this->sin_; if (Options::get_opt (Options::DEBUG) != 0) ACE_DEBUG ((LM_DEBUG, "waiting for client to send...\n")); @@ -69,7 +70,7 @@ int CM_Server::send (void) { int packet_length = 0; - + if (this->mux (this->send_packet_, packet_length) < 0) return -1; diff --git a/apps/drwho/ChangeLog b/apps/drwho/ChangeLog index 114661947ba..47080d74f53 100644 --- a/apps/drwho/ChangeLog +++ b/apps/drwho/ChangeLog @@ -1,106 +1,136 @@ +Thu Apr 20 09:20:28 2000 Carlos O'Ryan <coryan@uci.edu> + + * Drwho_Node.cpp: + * File_Manager.cpp: + * HT_Client.cpp: + * HT_Server.cpp: + * Hash_Table.cpp: + * Makefile: + * PMC_All.cpp: + * PMC_Flo.cpp: + * PMC_Ruser.cpp: + * PMC_Usr.cpp: + * PMS_All.cpp: + * PMS_Flo.cpp: + * PMS_Ruser.cpp: + * PMS_Usr.cpp: + * PM_Client.cpp: + * PM_Server.cpp: + * Protocol_Manager.cpp: + * Protocol_Record.cpp: + * Rwho_DB_Manager.cpp: + * Single_Lookup.cpp: + * server.cpp: + Fixed many warnings wrt order of fields in the initialization + section. + Add missing template instantiation. + Add missing includes. + Fixed problems with the scope of variables declared inside a + for() loop. + Wed Sep 30 13:00:52 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> - * Fixed a bunch of warnings related to char * and const char *. - Thanks to Sandro Doro <doros@aureus.sublink.org> for reporting - this. + * Fixed a bunch of warnings related to char * and const char *. + Thanks to Sandro Doro <doros@aureus.sublink.org> for reporting + this. Sat Sep 12 21:21:01 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> - * Made zillions of changes to "ACE"ify all of the code. Drwho is - now officially working again! + * Made zillions of changes to "ACE"ify all of the code. Drwho is + now officially working again! Sun Sep 6 22:48:52 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> - * Replaced all Str::*() methods with the new ACE::*() methods, - which are more "standard". + * Replaced all Str::*() methods with the new ACE::*() methods, + which are more "standard". - * Began to work on drwho after a 5 year absence... + * Began to work on drwho after a 5 year absence... Sun Feb 14 16:13:10 1993 Douglas C. Schmidt (schmidt at net1.ics.uci.edu) - * Yow. Once again back at work... This time I fixed things up so - that the release compiles properly with Solaris 2.1 C++, g++ - 2.3.3, and the Sun C++ compiler on Sun OS 4.1.x. To do this I - had to change the user-defined memory allocator somewhat, since - the Sun C++ compiler was using the global NEW operator to - allocate pools of memory behind my back... Naturally, this - reaked havoc with the existing version in the server, which - returns all the allocated memory to the free list once a request - is satisfied. In addition, g++ had a weird multiple - inheritance/pure virtual function bug that I fixed by reordering - certain pure virtual functions. Oh what fun... ;-) Anyhow, - everything is now back in running order! + * Yow. Once again back at work... This time I fixed things up so + that the release compiles properly with Solaris 2.1 C++, g++ + 2.3.3, and the Sun C++ compiler on Sun OS 4.1.x. To do this I + had to change the user-defined memory allocator somewhat, since + the Sun C++ compiler was using the global NEW operator to + allocate pools of memory behind my back... Naturally, this + reaked havoc with the existing version in the server, which + returns all the allocated memory to the free list once a request + is satisfied. In addition, g++ had a weird multiple + inheritance/pure virtual function bug that I fixed by reordering + certain pure virtual functions. Oh what fun... ;-) Anyhow, + everything is now back in running order! Sun Dec 6 16:13:21 1992 Douglas C. Schmidt (schmidt at net1.ics.uci.edu) - * Yow, well, after about 8 months of total neglect I'm finally - back at work on this program! The current changes I did today - involved getting drwho to compile with g++ 2.3.2. This required - a couple of small work arounds in the source code due to bugs, - but hey, I guess it is better than nothing right?! - - Also, I had to fix a couple of places where I didn't correctly - initialize static variables (the compiler implementations have - changed since last year obviously). Also, I've changed a couple - of the default server hosts to reflect the fascist policies of - our support group ;-) (I've no longer got access to certain - servers...) - - Anyhow, I think drwho is once again running with g++, so now I - can hand the release over to Ericka... ;-) + * Yow, well, after about 8 months of total neglect I'm finally + back at work on this program! The current changes I did today + involved getting drwho to compile with g++ 2.3.2. This required + a couple of small work arounds in the source code due to bugs, + but hey, I guess it is better than nothing right?! + + Also, I had to fix a couple of places where I didn't correctly + initialize static variables (the compiler implementations have + changed since last year obviously). Also, I've changed a couple + of the default server hosts to reflect the fascist policies of + our support group ;-) (I've no longer got access to certain + servers...) + + Anyhow, I think drwho is once again running with g++, so now I + can hand the release over to Ericka... ;-) Wed May 6 23:12:02 1992 Douglas C. Schmidt (schmidt at net4.ics.uci.edu) - * There is something horribly wrong with g++ 2.1. Therefore, I - had to make a couple of changes in the pmc-rusers.C and - pm-client.C files in order to make the blasted thing compile - when I had pointers to member functions... Make sure to change - this back when g++ is fixed... + * There is something horribly wrong with g++ 2.1. Therefore, I + had to make a couple of changes in the pmc-rusers.C and + pm-client.C files in order to make the blasted thing compile + when I had pointers to member functions... Make sure to change + this back when g++ is fixed... Tue Feb 4 11:23:12 1992 Douglas C. Schmidt (schmidt at net6.ics.uci.edu) - * The blasted program was crashing when there were consecutive - newlines in the input file. I fixed - File_Manager::get_login_and_real_name and - File_Manager::open_friends_file so that they detect and skip - over these consecutive newlines. + * The blasted program was crashing when there were consecutive + newlines in the input file. I fixed + File_Manager::get_login_and_real_name and + File_Manager::open_friends_file so that they detect and skip + over these consecutive newlines. Thu Nov 21 21:55:00 1991 Douglas C. Schmidt (schmidt at net6.ics.uci.edu) - * Make the time that drwho uses to consider a host idle be a - command-line parameter. + * Make the time that drwho uses to consider a host idle be a + command-line parameter. Wed Nov 13 14:24:40 1991 Douglas C. Schmidt (schmidt at bastille.ics.uci.edu) - * Something else that ought to be done: + * Something else that ought to be done: - Add a flag to the -R option that allows the hostname to be - printed using the internet address and/or the hostname... + Add a flag to the -R option that allows the hostname to be + printed using the internet address and/or the hostname... Sat Nov 9 13:45:30 1991 Douglas C. Schmidt (schmidt at bastille.ics.uci.edu) - * Added zillions more changes yet again. We now have an rusers - compatibility mode (-R), to go along with the -a, -w, and - default (flo) options. + * Added zillions more changes yet again. We now have an rusers + compatibility mode (-R), to go along with the -a, -w, and + default (flo) options. - * Changed the -w option so that it only returns the name of the - host machine where the user is logged in. This way, I can say: - - % talk schmidt@`drwho -w schmidt` - % rsh `drwho -w schmidt` w + * Changed the -w option so that it only returns the name of the + host machine where the user is logged in. This way, I can say: - etc... ;-) + % talk schmidt@`drwho -w schmidt` + % rsh `drwho -w schmidt` w - * Added support for the -L option (print using login name rather - than real name). Also added support for the -l option (print - out verbosely, a la ls -l!). + etc... ;-) + + * Added support for the -L option (print using login name rather + than real name). Also added support for the -l option (print + out verbosely, a la ls -l!). Sun Oct 27 21:32:15 1991 Douglas C. Schmidt (schmidt at bastille.ics.uci.edu) - * Need to complete the -s and -S options to support sorting the - output by login name and real name, respectively... In order to - support the '*' indication with this scheme we probably need to - lists, one for active and one for inactive users! + * Need to complete the -s and -S options to support sorting the + output by login name and real name, respectively... In order to + support the '*' indication with this scheme we probably need to + lists, one for active and one for inactive users! Tue Oct 22 00:13:21 1991 Douglas C. Schmidt (schmidt at net6.ics.uci.edu) @@ -108,143 +138,141 @@ Tue Oct 22 00:13:21 1991 Douglas C. Schmidt (schmidt at net6.ics.uci.edu) Sun Oct 20 21:35:24 1991 Douglas C. Schmidt (schmidt at net6.ics.uci.edu) - * Added support for the -p option to allow setting the client and - server port number from the command-line. + * Added support for the -p option to allow setting the client and + server port number from the command-line. - * Things done so far: + * Things done so far: - * Owen also wants an new rflo feature (done) + * Owen also wants an new rflo feature (done) - I also want a version that given a command like: + I also want a version that given a command like: - whereis omalley + whereis omalley - would return the login where that login is active if there is - one (ie. omalley@zola). Then you could have commands like: + would return the login where that login is active if there is + one (ie. omalley@zola). Then you could have commands like: - talk `whereis omalley` + talk `whereis omalley` - that would find where I am and try to talk to me there. + that would find where I am and try to talk to me there. - * Another neat addition would be: have an option (e.g., `-a') so - that rflo would return *all* the users logged in and then look - up their names using the yp passwd stuff! (partially done, but - not very elegantly yet...). (done) + * Another neat addition would be: have an option (e.g., `-a') so + that rflo would return *all* the users logged in and then look + up their names using the yp passwd stuff! (partially done, but + not very elegantly yet...). (done) - * Make the port number a command-line option... (done) + * Make the port number a command-line option... (done) - * we also need think about how to incorporate inheritance and - dynamic binding into this thang (probably it can be used for - the local/remote split, and also perhaps for the - friends/everyone split (see below)). (done) + * we also need think about how to incorporate inheritance and + dynamic binding into this thang (probably it can be used for + the local/remote split, and also perhaps for the + friends/everyone split (see below)). (done) - * Fix up the options stuff wrt the -F option etc... (done) + * Fix up the options stuff wrt the -F option etc... (done) - * Have I fixed the is_active shit? (done) + * Have I fixed the is_active shit? (done) - * we need a "message abstraction" that abstracts away from the - details of packets protocols and remote operations protocols. - (done). + * we need a "message abstraction" that abstracts away from the + details of packets protocols and remote operations protocols. + (done). - * Note, should make an option so we could read the names of the - hosts to query from a file... (done) + * Note, should make an option so we could read the names of the + hosts to query from a file... (done) Fri Oct 18 16:17:39 1991 Douglas C. Schmidt (schmidt at net6.ics.uci.edu) - * I've made countless changes... + * I've made countless changes... Wed Oct 16 17:42:40 1991 Douglas C. Schmidt (schmidt at net6.ics.uci.edu) - * Undid the message manager abstraction and merged it in with the - Friend_Manager client and server. This really cleans up the - interface! + * Undid the message manager abstraction and merged it in with the + Friend_Manager client and server. This really cleans up the + interface! - * Yow, make zillions of important changes to make the - client/server split more explicit... Now the Friend_Manager is - split into client and server, the message manager is split, and - the communications manager is also split. Each file is much - smaller and easier to understand! + * Yow, make zillions of important changes to make the + client/server split more explicit... Now the Friend_Manager is + split into client and server, the message manager is split, and + the communications manager is also split. Each file is much + smaller and easier to understand! Mon Oct 14 18:36:55 1991 Douglas C. Schmidt (schmidt at net1.ics.uci.edu) - * Added support for the -h and -? options, that print out a long - and short usage message, respectively. + * Added support for the -h and -? options, that print out a long + and short usage message, respectively. Tue Oct 1 09:28:29 1991 Douglas C. Schmidt (schmidt at net4.ics.uci.edu) - * The -a option works a great deal better too... I added a check - in the File_Manager::open_passwd_file routine to strip off the - extra subfields in the pw_gecos field, since this info isn't - really very useful and makes the "real name" field too long! + * The -a option works a great deal better too... I added a check + in the File_Manager::open_passwd_file routine to strip off the + extra subfields in the pw_gecos field, since this info isn't + really very useful and makes the "real name" field too long! - * Added some extra stuff to the Comm_Manager so that I could - change the max size of the UDP datagrams that are passed around. - As it turns out, I don't really need to do this, but it is more - robust this way... + * Added some extra stuff to the Comm_Manager so that I could + change the max size of the UDP datagrams that are passed around. + As it turns out, I don't really need to do this, but it is more + robust this way... Thu Sep 26 14:00:45 1991 Douglas C. Schmidt (schmidt at net4.ics.uci.edu) - * Make sun3 and sun4 subdirectories to help the build process! + * Make sun3 and sun4 subdirectories to help the build process! + + * Changed the UDP port number from 12346 to 12344 so I wouldn't + collide with Owen! - * Changed the UDP port number from 12346 to 12344 so I wouldn't - collide with Owen! - - * There is a weird bus error problem on the sun 4s... Hum... + * There is a weird bus error problem on the sun 4s... Hum... - * Yow, got everything working again... + * Yow, got everything working again... - * Still to do: + * Still to do: - * Think about fixing the -f option to work correctly for - *relative* filenames... + * Think about fixing the -f option to work correctly for + *relative* filenames... - * Make UDP_BUFFER_SIZE a command-line option... + * Make UDP_BUFFER_SIZE a command-line option... - * Modify server.C to be started by inetd. + * Modify server.C to be started by inetd. - * For -a option... if they are a friend, use the name from - .friend.dta otherwise use the name from the passwd file. + * For -a option... if they are a friend, use the name from + .friend.dta otherwise use the name from the passwd file. - * Don't forget about: + * Don't forget about: - delete Friend_Manager::friend_record; - delete Friend_Manager::sorted_record; + delete Friend_Manager::friend_record; + delete Friend_Manager::sorted_record; - Need to figure out a good way to deal with this! + Need to figure out a good way to deal with this! Mon Sep 23 16:09:46 1991 Douglas C. Schmidt (schmidt at net4.ics.uci.edu) - * Added a neat feature that now allows the user to specify which - hosts to examine by specifying an option ('-F') on the - command-line that reads the contents of that file and inserts it - into the list of files. + * Added a neat feature that now allows the user to specify which + hosts to examine by specifying an option ('-F') on the + command-line that reads the contents of that file and inserts it + into the list of files. Wed Sep 18 10:46:41 1991 Douglas C. Schmidt (schmidt at bastille.ics.uci.edu) - * We need to make all the interfaces throughout rflo much more - object-oriented, e.g.: - - * Made a host-manager abstraction to handle all the host - machine related operations. This makes the options stuff - *much* cleaner! + * We need to make all the interfaces throughout rflo much more + object-oriented, e.g.: + + * Made a host-manager abstraction to handle all the host + machine related operations. This makes the options stuff + *much* cleaner! - * Make rflo compile with g++ 1.37.2! Now it compiles with cfront - 2.0, Saber C++ 1.0.1 and g++-1.39.0 and g++-1.37.2. + * Make rflo compile with g++ 1.37.2! Now it compiles with cfront + 2.0, Saber C++ 1.0.1 and g++-1.39.0 and g++-1.37.2. Tue Sep 17 19:02:47 1991 Douglas C. Schmidt (schmidt at net4.ics.uci.edu) - * Started merging in the stuff Owen did. I'm trying to maintain a - consistent programming style... The Owen stuff adds support for - timeouts and fixes problems with returning a count of the number - of friends! + * Started merging in the stuff Owen did. I'm trying to maintain a + consistent programming style... The Owen stuff adds support for + timeouts and fixes problems with returning a count of the number + of friends! Wed Sep 4 10:14:51 1991 Douglas C. Schmidt (schmidt at net4.ics.uci.edu) - * Things to do: - - * Add comprehensive daemon support for server.C. - * Add timeout stuff in case hosts are down! - * Talk to support about making a standard daemon. - * Fix the problem with returning the number of friends. - + * Things to do: + * Add comprehensive daemon support for server.C. + * Add timeout stuff in case hosts are down! + * Talk to support about making a standard daemon. + * Fix the problem with returning the number of friends. diff --git a/apps/drwho/Drwho_Node.cpp b/apps/drwho/Drwho_Node.cpp index 4570eb43877..ab3b66b93f9 100644 --- a/apps/drwho/Drwho_Node.cpp +++ b/apps/drwho/Drwho_Node.cpp @@ -3,21 +3,23 @@ #include "Drwho_Node.h" Drwho_Node::Drwho_Node (const char *h_name, Drwho_Node *n) - : next_ (n), - inactive_count_ (0), + : key_name1_ (h_name), + key_name2_ (0), + tty_name_ (0), + idle_time_ (0), active_count_ (0), - key_name1_ (h_name), - key_name2_ (0) + inactive_count_ (0), + next_ (n) {} Drwho_Node::Drwho_Node (void) - : next_ (0), - inactive_count_ (0), - active_count_ (0), - key_name1_ (0), + : key_name1_ (0), + key_name2_ (0), tty_name_ (0), idle_time_ (0), - key_name2_ (0) + active_count_ (0), + inactive_count_ (0), + next_ (0) {} const char * diff --git a/apps/drwho/File_Manager.cpp b/apps/drwho/File_Manager.cpp index 190b5321c46..873b221a65c 100644 --- a/apps/drwho/File_Manager.cpp +++ b/apps/drwho/File_Manager.cpp @@ -3,10 +3,10 @@ #include "File_Manager.h" File_Manager::File_Manager (void) - : current_ptr (0), - number_of_friends (0), + : number_of_friends (0), max_key_length (0), buffer_ptr (0), + current_ptr (0), buffer_size (0) { } @@ -15,7 +15,7 @@ File_Manager::File_Manager (void) // or opens up the password file. In either case, the number of // entries in the file are returned, i.e., number of friends... -int +int File_Manager::open_file (const char *filename) { return filename == 0 @@ -32,31 +32,31 @@ File_Manager::get_login_and_real_name (const char *&login_name, const char *&rea login_name = buf_ptr; - // Skip to the end of the login name. - + // Skip to the end of the login name. + while (isalnum (*buf_ptr)) buf_ptr++; - + *buf_ptr++ = '\0'; - + // Now skip over white space to *start* of real name! - + while (isspace (*buf_ptr) || *buf_ptr == '\0') buf_ptr++; - + real_name = buf_ptr; - + while (*buf_ptr++ != '\n') continue; - - // Clear the trailing blanks and junk. - + + // Clear the trailing blanks and junk. + for (char *tmp_ptr = buf_ptr - 1; isspace (*tmp_ptr); tmp_ptr--) *tmp_ptr = '\0'; - - // Skip over consecutive blank lines. + + // Skip over consecutive blank lines. while (*buf_ptr == '\n') buf_ptr++; @@ -74,9 +74,9 @@ File_Manager::open_passwd_file (void) if (fp == 0) return -1; - + passwd *pwent; - + for (ACE_OS::setpwent (); (pwent = ACE_OS::getpwent ()) != 0; ) if (*pwent->pw_gecos != '\0') @@ -92,11 +92,11 @@ File_Manager::open_passwd_file (void) pwent->pw_gecos); this->number_of_friends++; } - + ACE_OS::endpwent (); - + ACE_OS::fclose (fp); - + if (this->mmap_.map (filename) == -1) return -1; @@ -138,7 +138,7 @@ File_Manager::open_friends_file (const char *filename) } ACE_OS::strcat (directory, filename); } - + // Do the mmap'ing. if (this->mmap_.map (pathname) == -1) @@ -152,8 +152,8 @@ File_Manager::open_friends_file (const char *filename) this->current_ptr = this->buffer_ptr; // Determine how many friends there are by counting the newlines. - - for (char *cp = this->buffer_ptr + this->buffer_size; + + for (char *cp = this->buffer_ptr + this->buffer_size; cp > this->buffer_ptr ; ) if (*--cp == '\n') @@ -171,3 +171,12 @@ File_Manager::open_friends_file (const char *filename) return -1; } +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Singleton<File_Manager,ACE_Null_Mutex>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Singleton<File_Manager,ACE_Null_Mutex> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/apps/drwho/HT_Client.cpp b/apps/drwho/HT_Client.cpp index 2cd548c6506..0ff9674cf93 100644 --- a/apps/drwho/HT_Client.cpp +++ b/apps/drwho/HT_Client.cpp @@ -1,6 +1,7 @@ // $Id$ #include "HT_Client.h" +#include "ace/ACE.h" // Insert a KEY_NAME into the hash table, if it doesn't already exist // there. What gets returned is a pointer to the node inserted. Note @@ -11,7 +12,7 @@ HT_Client::insert (const char *key_name, int max_len) { Protocol_Record **prpp = 0; - // This is tricky... + // This is tricky... for (prpp = &this->hash_table[ACE::hash_pjw (key_name) % this->hash_table_size]; *prpp != 0 @@ -31,5 +32,3 @@ HT_Client::insert (const char *key_name, int max_len) return *prpp; } - - diff --git a/apps/drwho/HT_Server.cpp b/apps/drwho/HT_Server.cpp index c57297d7e0d..5af2b21c4b5 100644 --- a/apps/drwho/HT_Server.cpp +++ b/apps/drwho/HT_Server.cpp @@ -1,6 +1,7 @@ // $Id$ #include "HT_Server.h" +#include "ace/ACE.h" // Insert a KEY_NAME into the hash table, if it doesn't already exist // there. What gets returned is a pointer to the node inserted. Note diff --git a/apps/drwho/Hash_Table.cpp b/apps/drwho/Hash_Table.cpp index e98122b4bfb..fe00a372024 100644 --- a/apps/drwho/Hash_Table.cpp +++ b/apps/drwho/Hash_Table.cpp @@ -28,8 +28,8 @@ Hash_Table::get_next_entry (void) if (this->current_ptr == 0) { - for (; - this->current_index < this->hash_table_size; + for (; + this->current_index < this->hash_table_size; this->current_index++) if (this->hash_table[this->current_index] != 0) { @@ -41,7 +41,7 @@ Hash_Table::get_next_entry (void) this->current_index = -1; return 0; } - else + else { Protocol_Record *prp = this->current_ptr; this->current_ptr = this->current_ptr->next_; @@ -67,7 +67,6 @@ Hash_Table::~Hash_Table (void) for (Protocol_Record *prp = this->hash_table[i]; prp != 0; ) { - Protocol_Record *tmp = prp; prp = prp->next_; } } diff --git a/apps/drwho/Makefile b/apps/drwho/Makefile index a95611b3a28..fa4aece30ce 100644 --- a/apps/drwho/Makefile +++ b/apps/drwho/Makefile @@ -134,7 +134,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Record.i \ SMR_Server.h SM_Server.h PM_Server.h Protocol_Manager.h \ Search_Struct.h Protocol_Record.h Drwho_Node.h CM_Server.h \ - Comm_Manager.h Select_Manager.h + Comm_Manager.h Select_Manager.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/Protocol_Manager.o .obj/Protocol_Manager.so .shobj/Protocol_Manager.o .shobj/Protocol_Manager.so: Protocol_Manager.cpp Options.h global.h \ $(ACE_ROOT)/ace/OS.h \ @@ -366,7 +368,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Record.h \ $(ACE_ROOT)/ace/Log_Priority.h \ $(ACE_ROOT)/ace/Log_Record.i \ - Single_Lookup.h Search_Struct.h Protocol_Record.h Drwho_Node.h + Single_Lookup.h Search_Struct.h Protocol_Record.h Drwho_Node.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/SML_Server.o .obj/SML_Server.so .shobj/SML_Server.o .shobj/SML_Server.so: SML_Server.cpp SML_Server.h SM_Server.h PM_Server.h \ Protocol_Manager.h \ @@ -425,7 +429,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Priority.h \ $(ACE_ROOT)/ace/Log_Record.i \ SL_Server.h Single_Lookup.h Search_Struct.h Protocol_Record.h \ - Drwho_Node.h PMS_Usr.h PM_Server.h Protocol_Manager.h + Drwho_Node.h PMS_Usr.h PM_Server.h Protocol_Manager.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/SL_Server.o .obj/SL_Server.so .shobj/SL_Server.o .shobj/SL_Server.so: SL_Server.cpp global.h \ $(ACE_ROOT)/ace/OS.h \ @@ -463,7 +469,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Priority.h \ $(ACE_ROOT)/ace/Log_Record.i \ BS_Server.h Binary_Search.h Search_Struct.h Protocol_Record.h \ - Drwho_Node.h PMS_Flo.h PM_Server.h Protocol_Manager.h + Drwho_Node.h PMS_Flo.h PM_Server.h Protocol_Manager.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/PM_Server.o .obj/PM_Server.so .shobj/PM_Server.o .shobj/PM_Server.so: PM_Server.cpp Options.h global.h \ $(ACE_ROOT)/ace/OS.h \ @@ -485,7 +493,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Dirent.h \ $(ACE_ROOT)/ace/Dirent.i \ Protocol_Record.h Drwho_Node.h PM_Server.h Protocol_Manager.h \ - Search_Struct.h + Search_Struct.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/HT_Server.o .obj/HT_Server.so .shobj/HT_Server.o .shobj/HT_Server.so: HT_Server.cpp HT_Server.h Hash_Table.h Search_Struct.h \ Protocol_Record.h Drwho_Node.h global.h \ @@ -503,7 +513,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Msg.h \ $(ACE_ROOT)/ace/Log_Record.h \ $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/BS_Server.o .obj/BS_Server.so .shobj/BS_Server.o .shobj/BS_Server.so: BS_Server.cpp BS_Server.h Binary_Search.h Search_Struct.h \ Protocol_Record.h Drwho_Node.h global.h \ @@ -540,7 +552,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Priority.h \ $(ACE_ROOT)/ace/Log_Record.i \ HT_Server.h Hash_Table.h Search_Struct.h Protocol_Record.h \ - Drwho_Node.h PMS_All.h PM_Server.h Protocol_Manager.h + Drwho_Node.h PMS_All.h PM_Server.h Protocol_Manager.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/PMS_Ruser.o .obj/PMS_Ruser.so .shobj/PMS_Ruser.o .shobj/PMS_Ruser.so: PMS_Ruser.cpp Options.h global.h \ $(ACE_ROOT)/ace/OS.h \ @@ -559,7 +573,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Priority.h \ $(ACE_ROOT)/ace/Log_Record.i \ HT_Server.h Hash_Table.h Search_Struct.h Protocol_Record.h \ - Drwho_Node.h PMS_Ruser.h PM_Server.h Protocol_Manager.h + Drwho_Node.h PMS_Ruser.h PM_Server.h Protocol_Manager.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/SMR_Server.o .obj/SMR_Server.so .shobj/SMR_Server.o .shobj/SMR_Server.so: SMR_Server.cpp Options.h global.h \ $(ACE_ROOT)/ace/OS.h \ @@ -656,7 +672,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Priority.h \ $(ACE_ROOT)/ace/Log_Record.i \ PM_Server.h Protocol_Manager.h Search_Struct.h Protocol_Record.h \ - Drwho_Node.h PM_Client.h + Drwho_Node.h PM_Client.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/HT_Client.o .obj/HT_Client.so .shobj/HT_Client.o .shobj/HT_Client.so: HT_Client.cpp HT_Client.h Hash_Table.h Search_Struct.h \ Protocol_Record.h Drwho_Node.h global.h \ @@ -674,7 +692,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Msg.h \ $(ACE_ROOT)/ace/Log_Record.h \ $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/BS_Client.o .obj/BS_Client.so .shobj/BS_Client.o .shobj/BS_Client.so: BS_Client.cpp Options.h global.h \ $(ACE_ROOT)/ace/OS.h \ @@ -739,7 +759,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Priority.h \ $(ACE_ROOT)/ace/Log_Record.i \ Options.h HT_Client.h Hash_Table.h Search_Struct.h Protocol_Record.h \ - Drwho_Node.h PMC_All.h PM_Client.h Protocol_Manager.h + Drwho_Node.h PMC_All.h PM_Client.h Protocol_Manager.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/PMC_Flo.o .obj/PMC_Flo.so .shobj/PMC_Flo.o .shobj/PMC_Flo.so: PMC_Flo.cpp Options.h global.h \ $(ACE_ROOT)/ace/OS.h \ @@ -758,7 +780,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Priority.h \ $(ACE_ROOT)/ace/Log_Record.i \ BS_Client.h Binary_Search.h Search_Struct.h Protocol_Record.h \ - Drwho_Node.h PMC_Flo.h PM_Client.h Protocol_Manager.h + Drwho_Node.h PMC_Flo.h PM_Client.h Protocol_Manager.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/PMC_Usr.o .obj/PMC_Usr.so .shobj/PMC_Usr.o .shobj/PMC_Usr.so: PMC_Usr.cpp Options.h global.h \ $(ACE_ROOT)/ace/OS.h \ @@ -777,7 +801,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Priority.h \ $(ACE_ROOT)/ace/Log_Record.i \ SL_Client.h Single_Lookup.h Search_Struct.h Protocol_Record.h \ - Drwho_Node.h PMC_Usr.h PM_Client.h Protocol_Manager.h + Drwho_Node.h PMC_Usr.h PM_Client.h Protocol_Manager.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/SL_Client.o .obj/SL_Client.so .shobj/SL_Client.o .shobj/SL_Client.so: SL_Client.cpp Options.h global.h \ $(ACE_ROOT)/ace/OS.h \ @@ -815,7 +841,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Priority.h \ $(ACE_ROOT)/ace/Log_Record.i \ Options.h HT_Client.h Hash_Table.h Search_Struct.h Protocol_Record.h \ - Drwho_Node.h PMC_Ruser.h PM_Client.h Protocol_Manager.h + Drwho_Node.h PMC_Ruser.h PM_Client.h Protocol_Manager.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/SMR_Client.o .obj/SMR_Client.so .shobj/SMR_Client.o .shobj/SMR_Client.so: SMR_Client.cpp Options.h global.h \ $(ACE_ROOT)/ace/OS.h \ @@ -874,7 +902,9 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Record.h \ $(ACE_ROOT)/ace/Log_Priority.h \ $(ACE_ROOT)/ace/Log_Record.i \ - Options.h CM_Server.h Comm_Manager.h + Options.h CM_Server.h Comm_Manager.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i .obj/client.o .obj/client.so .shobj/client.o .shobj/client.so: client.cpp Options.h global.h \ $(ACE_ROOT)/ace/OS.h \ @@ -915,6 +945,8 @@ drwho-server: $(addprefix $(VDIR),$(SERVER-OBJ)) $(addprefix $(VDIR),$(SHARED-OB $(ACE_ROOT)/ace/Log_Record.i \ SMR_Server.h SM_Server.h PM_Server.h Protocol_Manager.h \ Search_Struct.h Protocol_Record.h Drwho_Node.h CM_Server.h \ - Comm_Manager.h Select_Manager.h + Comm_Manager.h Select_Manager.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/apps/drwho/PMC_All.cpp b/apps/drwho/PMC_All.cpp index 5e28711950b..129677a78f7 100644 --- a/apps/drwho/PMC_All.cpp +++ b/apps/drwho/PMC_All.cpp @@ -4,6 +4,7 @@ #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. @@ -30,7 +31,7 @@ PMC_All::encode (char *packet, int &packet_length) // 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) { @@ -57,12 +58,12 @@ PMC_All::decode (char *packet, int &packet_length) *cp != '\n'; cp++) { - // Skip over the LOGIN_NAME. + // Skip over the LOGIN_NAME. char *login_name = cp; char *real_name = cp = (char *) ACE::strend (cp); - for (cp = (char *) ACE::strend (cp); + for (cp = (char *) ACE::strend (cp); *(cp = this->handle_protocol_entries (cp, login_name, real_name)) != '\t'; ) continue; @@ -76,13 +77,13 @@ 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) { diff --git a/apps/drwho/PMC_Flo.cpp b/apps/drwho/PMC_Flo.cpp index a0e5a216423..732db80b1e9 100644 --- a/apps/drwho/PMC_Flo.cpp +++ b/apps/drwho/PMC_Flo.cpp @@ -3,6 +3,7 @@ #include "Options.h" #include "BS_Client.h" #include "PMC_Flo.h" +#include "ace/ACE.h" // This function "encodes" a list of friends by putting the userid's // in a contiguous block. This block can then be transmitted over to @@ -32,7 +33,7 @@ PMC_Flo::encode (char *packet, int &packet_length) this->friend_count ()); buf_ptr += MAXUSERIDNAMELEN; - + // Iterate through all the friends, copying them into the packet // buffer. @@ -44,11 +45,11 @@ PMC_Flo::encode (char *packet, int &packet_length) if (Options::get_opt (Options::DEBUG) != 0) { - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "\n")); } @@ -57,7 +58,7 @@ PMC_Flo::encode (char *packet, int &packet_length) // This method is responsible for transforming the msg from the server // back into a form usable by the client. - + int PMC_Flo::decode (char *packet, int &packet_length) { @@ -87,7 +88,7 @@ PMC_Flo::decode (char *packet, int &packet_length) char *login_name = cp; for (cp = (char *) ACE::strend (cp); - *(cp = this->handle_protocol_entries (cp, login_name)) != '\t'; + *(cp = this->handle_protocol_entries (cp, login_name)) != '\t'; ) continue; } diff --git a/apps/drwho/PMC_Ruser.cpp b/apps/drwho/PMC_Ruser.cpp index 0cd26d102e4..571b95fb58d 100644 --- a/apps/drwho/PMC_Ruser.cpp +++ b/apps/drwho/PMC_Ruser.cpp @@ -4,6 +4,7 @@ #include "Options.h" #include "HT_Client.h" #include "PMC_Ruser.h" +#include "ace/ACE.h" // This function is pretty much a no-op that just sets up the // appropriate lookup function to use. @@ -32,7 +33,7 @@ PMC_Ruser::encode (char *packet, int &packet_length) // 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_Ruser::decode (char *packet, int &packet_length) { @@ -91,7 +92,7 @@ PMC_Ruser::insert_protocol_info (Protocol_Record &protocol_record) return prp; } - + char * PMC_Ruser::handle_protocol_entries (const char *cp, const char *host_name, @@ -99,7 +100,7 @@ PMC_Ruser::handle_protocol_entries (const char *cp, { static Protocol_Record protocol_record (1); Drwho_Node *current_node = protocol_record.get_drwho_list (); - + protocol_record.set_host (host_name); current_node->set_inactive_count (atoi (cp)); current_node->set_active_count (atoi (cp = ACE_OS::strchr (cp, ' ') + 1)); @@ -135,7 +136,7 @@ PMC_Ruser::process (void) ACE_DEBUG ((LM_DEBUG, "%s", (np->*get_name) ())); - + if (np->get_inactive_count () != 0) { if (np->get_active_count () != 0) @@ -161,7 +162,7 @@ PMC_Ruser::process (void) ACE_DEBUG ((LM_DEBUG, ", ")); } - + ACE_DEBUG ((LM_DEBUG, "\n")); } @@ -170,4 +171,3 @@ PMC_Ruser::process (void) PMC_Ruser::PMC_Ruser (void) { } - diff --git a/apps/drwho/PMC_Usr.cpp b/apps/drwho/PMC_Usr.cpp index ec5738044c3..2859bae5565 100644 --- a/apps/drwho/PMC_Usr.cpp +++ b/apps/drwho/PMC_Usr.cpp @@ -3,6 +3,7 @@ #include "Options.h" #include "SL_Client.h" #include "PMC_Usr.h" +#include "ace/ACE.h" int PMC_Usr::encode (char *packet, int &packet_length) @@ -30,7 +31,7 @@ PMC_Usr::encode (char *packet, int &packet_length) "packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "\n")); } return 1; @@ -38,7 +39,7 @@ PMC_Usr::encode (char *packet, int &packet_length) // This method is responsible for transforming the msg from the server // back into a form usable by the client. - + int PMC_Usr::decode (char *packet, int &packet_length) { @@ -51,7 +52,7 @@ PMC_Usr::decode (char *packet, int &packet_length) ACE_DEBUG ((LM_DEBUG, "\n")); } - + char *cp = packet; if (*cp != '\n') @@ -72,14 +73,14 @@ PMC_Usr::process (void) { Protocol_Record *prp = this->get_each_friend (); Drwho_Node *np = prp->get_drwho_list (); - + if (np == 0) - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "<unknown>")); else { - // First try to get a login session that is active... - + // First try to get a login session that is active... + for (; np != 0; np = np->next_) if (np->active_count_ > 0) { @@ -90,7 +91,7 @@ PMC_Usr::process (void) if (Options::get_opt (Options::USE_VERBOSE_FORMAT) == 0) return; } - + for (np = prp->get_drwho_list (); np != 0; np = np->next_) @@ -99,7 +100,7 @@ PMC_Usr::process (void) ACE_DEBUG ((LM_DEBUG, "%s ", np->get_host_name ())); - + if (Options::get_opt (Options::USE_VERBOSE_FORMAT) == 0) return; } diff --git a/apps/drwho/PMS_All.cpp b/apps/drwho/PMS_All.cpp index b100bd93132..5209512a851 100644 --- a/apps/drwho/PMS_All.cpp +++ b/apps/drwho/PMS_All.cpp @@ -3,6 +3,7 @@ #include "Options.h" #include "HT_Server.h" #include "PMS_All.h" +#include "ace/ACE.h" // This function packs the located friends userids, plus the machines // they are logged into (along with the inactive and active counts on @@ -34,7 +35,7 @@ PMS_All::encode (char *packet, int &packet_length) prp->get_login ()), prp->get_real ()), prp->get_drwho_list ()); - + *buf_ptr++ = '\n'; packet_length = buf_ptr - packet; @@ -77,8 +78,8 @@ PMS_All::insert_protocol_info (Protocol_Record &protocol_record) { Protocol_Record *prp = PM_Server::insert_protocol_info (protocol_record); passwd *pwent = getpwnam (prp->get_login ()); - char *cp = (char *) ACE_OS::strchr (prp->set_real - (pwent == 0 + char *cp = (char *) ACE_OS::strchr (prp->set_real + (pwent == 0 ? prp->get_login () : ACE::strnew (pwent->pw_gecos)), ','); diff --git a/apps/drwho/PMS_Flo.cpp b/apps/drwho/PMS_Flo.cpp index e969ad4f4c6..e042831b11e 100644 --- a/apps/drwho/PMS_Flo.cpp +++ b/apps/drwho/PMS_Flo.cpp @@ -3,6 +3,7 @@ #include "Options.h" #include "BS_Server.h" #include "PMS_Flo.h" +#include "ace/ACE.h" // This function packs the located friends userids, plus the machines // they are logged into (along with the inactive and active counts on diff --git a/apps/drwho/PMS_Ruser.cpp b/apps/drwho/PMS_Ruser.cpp index 99d3905f44b..ee01a831347 100644 --- a/apps/drwho/PMS_Ruser.cpp +++ b/apps/drwho/PMS_Ruser.cpp @@ -3,6 +3,7 @@ #include "Options.h" #include "HT_Server.h" #include "PMS_Ruser.h" +#include "ace/ACE.h" // This function packs the located friends userids, plus the machines // they are logged into (along with the inactive and active counts on @@ -33,7 +34,7 @@ PMS_Ruser::encode (char *packet, int &packet_length) buf_ptr = this->handle_protocol_entries (ACE::strecpy (buf_ptr, prp->get_host ()), prp->get_drwho_list ()); - + *buf_ptr++ = '\n'; packet_length = buf_ptr - packet; @@ -85,9 +86,9 @@ PMS_Ruser::insert_protocol_info (Protocol_Record &protocol_record) else { passwd *pwent = getpwnam (np->get_login_name ()); - char *cp = - (char *) ACE_OS::strchr (np->set_real_name (pwent == 0 - ? np->get_login_name () + char *cp = + (char *) ACE_OS::strchr (np->set_real_name (pwent == 0 + ? np->get_login_name () : ACE::strnew (pwent->pw_gecos)), ','); if (cp != 0) @@ -98,7 +99,7 @@ PMS_Ruser::insert_protocol_info (Protocol_Record &protocol_record) np->inactive_count_++; else np->active_count_++; - + return prp; } @@ -120,7 +121,7 @@ PMS_Ruser::handle_protocol_entries (char *buf_ptr, } return buf_ptr; -} +} PMS_Ruser::PMS_Ruser (void) { diff --git a/apps/drwho/PMS_Usr.cpp b/apps/drwho/PMS_Usr.cpp index ce83f664bce..cf97e3a9ae8 100644 --- a/apps/drwho/PMS_Usr.cpp +++ b/apps/drwho/PMS_Usr.cpp @@ -3,6 +3,7 @@ #include "Options.h" #include "SL_Server.h" #include "PMS_Usr.h" +#include "ace/ACE.h" // This function "encodes" a list of friends by putting the userid's in // a contiguous block. This block can then be transmitted over to the @@ -53,7 +54,7 @@ PMS_Usr::encode (char *packet, int &packet_length) // This function takes a packet received from the client and calls the // appropriate Protocol_Manager routine to build the local table of // friends. - + int PMS_Usr::decode (char *packet, int &packet_length) { diff --git a/apps/drwho/PM_Client.cpp b/apps/drwho/PM_Client.cpp index f34922fee72..edb5e88c28c 100644 --- a/apps/drwho/PM_Client.cpp +++ b/apps/drwho/PM_Client.cpp @@ -1,7 +1,9 @@ // $Id$ + #include "Options.h" #include "PM_Server.h" #include "PM_Client.h" +#include "ace/ACE.h" // This function is used to merge the LOGIN_NAME from server HOST_NAME // into the userids kept on the client's side. Note that we must @@ -16,7 +18,7 @@ PM_Client::insert_protocol_info (Protocol_Record &protocol_record) prp->drwho_list_); // Update the active and inactive counts. - + if (np->get_active_count () < current_node->get_active_count ()) { np->set_active_count (current_node->get_active_count ()); @@ -35,8 +37,8 @@ PM_Client::insert_protocol_info (Protocol_Record &protocol_record) void PM_Client::process (void) { - char *(Protocol_Record::*get_name)(void); - + const char *(Protocol_Record::*get_name)(void); + if (Options::get_opt (Options::PRINT_LOGIN_NAME)) get_name = &Protocol_Record::get_login; else @@ -47,30 +49,30 @@ PM_Client::process (void) ACE_DEBUG ((LM_DEBUG, "------------------------\n")); - + if (Options::get_opt (Options::PRINT_LOGIN_NAME)) this->max_key_length = MAXUSERIDNAMELEN; // Goes through the queue of all the logged in friends and prints // out the associated information. - + for (Protocol_Record *prp = this->Protocol_Manager::get_each_friend (); prp != 0; prp = this->Protocol_Manager::get_each_friend ()) { ACE_DEBUG ((LM_DEBUG, - "%c%-*s [", (prp->is_active_ != 0 ? '*' : ' '), + "%c%-*s [", (prp->is_active_ != 0 ? '*' : ' '), this->max_key_length, (prp->*get_name) ())); - + for (Drwho_Node *np = prp->get_drwho_list (); ;) { ACE_DEBUG ((LM_DEBUG, np->get_host_name (), stdout)); - + active_friends += np->get_active_count (); - + if (np->get_inactive_count () != 0) { if (np->get_active_count () != 0) @@ -85,7 +87,7 @@ PM_Client::process (void) else if (np->get_active_count () == 1) ACE_DEBUG ((LM_DEBUG, "*")); - + np = np->next_; if (np == 0) break; @@ -93,14 +95,14 @@ PM_Client::process (void) ACE_DEBUG ((LM_DEBUG, " ")); } - + ACE_DEBUG ((LM_DEBUG, "]\n")); } - + ACE_DEBUG ((LM_DEBUG, "------------------------\n")); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "friends: %d\tusers: %d\n", active_friends, users)); @@ -113,15 +115,15 @@ PM_Client::handle_protocol_entries (const char *cp, { static Protocol_Record protocol_record (1); Drwho_Node *current_node = protocol_record.get_drwho_list (); - + protocol_record.set_login (login_name); protocol_record.set_real (real_name); current_node->set_inactive_count (atoi (cp)); current_node->set_active_count (atoi (cp = ACE_OS::strchr (cp, ' ') + 1)); current_node->set_host_name (cp = ACE_OS::strchr (cp, ' ') + 1); - + this->insert_protocol_info (protocol_record); - + return (char *) ACE::strend (cp); } @@ -133,4 +135,3 @@ PM_Client::PM_Client (void) PM_Client::~PM_Client (void) { } - diff --git a/apps/drwho/PM_Server.cpp b/apps/drwho/PM_Server.cpp index 9fa3b78679b..0b946f5cca9 100644 --- a/apps/drwho/PM_Server.cpp +++ b/apps/drwho/PM_Server.cpp @@ -3,6 +3,7 @@ #include "Options.h" #include "Rwho_DB_Manager.h" #include "PM_Server.h" +#include "ace/ACE.h" // This is the main method for the server side of things. It reads // the RWHO file on the local machine and inserts HOST_NAME @@ -18,7 +19,7 @@ PM_Server::process (void) while (ru.get_next_user (protocol_record) > 0) this->insert_protocol_info (protocol_record); - + return 1; } @@ -70,7 +71,7 @@ PM_Server::handle_protocol_entries (char *buf_ptr, } return buf_ptr; -} +} PM_Server::PM_Server (void) { diff --git a/apps/drwho/Protocol_Manager.cpp b/apps/drwho/Protocol_Manager.cpp index 23895610893..0d7413edced 100644 --- a/apps/drwho/Protocol_Manager.cpp +++ b/apps/drwho/Protocol_Manager.cpp @@ -7,17 +7,16 @@ // it exists, otherwise a new node is created. Note that if a // Drwho_Node is found it is moved to the front of the list so that // subsequent finds are faster (i.e., self-organizing!) - + Drwho_Node * Protocol_Manager::get_drwho_node (char *key_name, Drwho_Node *&head) { - for (Drwho_Node **temp = &head; - *temp != 0; - temp = &(*temp)->next_) + Drwho_Node **temp = &head; + for (; *temp != 0; temp = &(*temp)->next_) if (ACE_OS::strcmp (key_name, (*temp)->get_login_name ()) == 0) break; - + if (*temp == 0) ACE_NEW_RETURN (head, Drwho_Node (key_name, head), @@ -25,7 +24,7 @@ Protocol_Manager::get_drwho_node (char *key_name, Drwho_Node *&head) else { Drwho_Node *t = *temp; - + *temp = (*temp)->next_; t->next_ = head; @@ -71,13 +70,13 @@ Protocol_Manager::friend_count (void) // Returns total number of users logged in throughout the system. -int +int Protocol_Manager::get_total_users (void) { return Protocol_Manager::total_users; } -void +void Protocol_Manager::increment_total_users (int remote_users) { Protocol_Manager::total_users += remote_users; diff --git a/apps/drwho/Protocol_Record.cpp b/apps/drwho/Protocol_Record.cpp index 98e64c795ad..72524ed201c 100644 --- a/apps/drwho/Protocol_Record.cpp +++ b/apps/drwho/Protocol_Record.cpp @@ -3,7 +3,7 @@ #include "Options.h" #include "Protocol_Record.h" -// Static initialization. +// Static initialization. Drwho_Node Protocol_Record::drwho_node_; @@ -23,49 +23,49 @@ Protocol_Record::~Protocol_Record (void) } Protocol_Record::Protocol_Record (void) - : is_active_ (0), - drwho_list_ (0), - key_name1_ (0), + : key_name1_ (0), key_name2_ (0), - next_ (0) + drwho_list_ (0), + next_ (0), + is_active_ (0) { } Protocol_Record::Protocol_Record (int) - : is_active_ (0), - drwho_list_ (&Protocol_Record::drwho_node_), - key_name1_ (0), + : key_name1_ (0), key_name2_ (0), - next_ (0) + drwho_list_ (&Protocol_Record::drwho_node_), + next_ (0), + is_active_ (0) { } Protocol_Record::Protocol_Record (const char *kn1, Protocol_Record *next) - : is_active_ (0), + : key_name1_ (kn1), + key_name2_ (0), drwho_list_ (0), - key_name2_ (0) + next_ (next), + is_active_ (0) { - this->key_name1_ = kn1; - this->next_ = next; } const char * -Protocol_Record::get_login (void) -{ +Protocol_Record::get_login (void) +{ return this->key_name1_; } const char * Protocol_Record::set_login (const char *str) -{ +{ this->key_name1_ = str; return str; } const char * -Protocol_Record::get_real (void) -{ +Protocol_Record::get_real (void) +{ return this->key_name2_; } @@ -77,7 +77,7 @@ Protocol_Record::get_host (void) const char * Protocol_Record::set_host (const char *str) -{ +{ this->key_name1_ = str; return str; } diff --git a/apps/drwho/Rwho_DB_Manager.cpp b/apps/drwho/Rwho_DB_Manager.cpp index 902e4cb4ade..4b78701e12a 100644 --- a/apps/drwho/Rwho_DB_Manager.cpp +++ b/apps/drwho/Rwho_DB_Manager.cpp @@ -12,28 +12,28 @@ RWho_DB_Manager::RWho_DB_Manager (void) : number_of_users (0), current_user (0), - rwho_dir_name (RWHODIR), - WHOD_HEADER_SIZE (sizeof host_data - sizeof host_data.wd_we) + WHOD_HEADER_SIZE (sizeof host_data - sizeof host_data.wd_we), + rwho_dir_name (RWHODIR) { if (ACE_OS::getcwd (this->original_pathname, MAXPATHLEN + 1) == 0) ACE_ERROR ((LM_ERROR, - "%p\n%a", + "%p\n%a", Options::program_name, 1)); if (ACE_OS::chdir (this->rwho_dir_name) < 0) ACE_ERROR ((LM_ERROR, - "%p\n%a", + "%p\n%a", this->rwho_dir_name, 1)); this->rwho_dir.open (this->rwho_dir_name); -#if 0 - // Skip "." and ".." +#if 0 + // Skip "." and ".." this->rwho_dir.read (); this->rwho_dir.read (); -#endif +#endif } // The destructor cleans up the RWHOD_DIR handle. @@ -42,7 +42,7 @@ RWho_DB_Manager::~RWho_DB_Manager (void) { if (ACE_OS::chdir (this->original_pathname) < 0) ACE_ERROR ((LM_ERROR, - "%p\n%a", + "%p\n%a", Options::program_name, 1)); @@ -51,16 +51,16 @@ RWho_DB_Manager::~RWho_DB_Manager (void) "disposing the RWho_DB_Manager\n")); } -// This procedure looks through the rwhod directory until it finds the next -// valid user file. -// +// This procedure looks through the rwhod directory until it finds the next +// valid user file. +// // The requirements for user files are: // 1) The file is at least MIN_HOST_DATA_SIZE bytes long // 2) It was received within the last MAX_HOST_TIMEOUT seconds // Return: // Are there any more hosts? */ -int +int RWho_DB_Manager::get_next_host (void) { time_t current_time; @@ -75,16 +75,16 @@ RWho_DB_Manager::get_next_host (void) { ACE_HANDLE user_file = ACE_OS::open (dir_ptr->d_name, O_RDONLY); - + if (user_file < 0) return -1; - + int host_data_length = ACE_OS::read (user_file, (char *) &this->host_data, sizeof this->host_data); - - if (host_data_length > WHOD_HEADER_SIZE + + if (host_data_length > WHOD_HEADER_SIZE && current_time - this->host_data.wd_recvtime < MAX_HOST_TIMEOUT) { this->current_user = 0; @@ -97,18 +97,18 @@ RWho_DB_Manager::get_next_host (void) } // There are no more hosts, so return False. - return 0; + return 0; } // Returns the next user's information. Note that for efficiency only // pointers are copied, i.e., this info must be used before we call // this function again. -int +int RWho_DB_Manager::get_next_user (Protocol_Record &protocol_record) { - // Get the next host file if necessary - if (this->current_user >= this->number_of_users + // Get the next host file if necessary + if (this->current_user >= this->number_of_users && this->get_next_host () == 0) return 0; diff --git a/apps/drwho/Single_Lookup.cpp b/apps/drwho/Single_Lookup.cpp index 07b981c69b1..fa4358cff83 100644 --- a/apps/drwho/Single_Lookup.cpp +++ b/apps/drwho/Single_Lookup.cpp @@ -2,6 +2,7 @@ #include "Options.h" #include "Single_Lookup.h" +#include "ace/ACE.h" Single_Lookup::Single_Lookup (const char *usr_name) { diff --git a/apps/drwho/server.cpp b/apps/drwho/server.cpp index 15ffb574012..720b9201f9b 100644 --- a/apps/drwho/server.cpp +++ b/apps/drwho/server.cpp @@ -21,6 +21,7 @@ #include "Options.h" #include "SMR_Server.h" +#include "ace/ACE.h" static char * tstamp (void) @@ -59,7 +60,7 @@ started_by_inetd (void) &size) == 0; } -// Does the drwho service. +// Does the drwho service. static void do_drwho (SMR_Server &smr_server) @@ -68,7 +69,7 @@ do_drwho (SMR_Server &smr_server) ACE_ERROR ((LM_ERROR, "%p\n", Options::program_name)); - + if (smr_server.send () == -1) ACE_ERROR ((LM_ERROR, "%p\n", |