diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2005-10-06 08:24:26 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2005-10-06 08:24:26 +0000 |
commit | c859aad8d31f292f109e6b0c1545dc9878c86c69 (patch) | |
tree | bb719c9badd92ac411de7a06d565c57094c5dfc1 /netsvcs | |
parent | 99f5ac11f6575e3548a0708982d551dd3546f626 (diff) | |
download | ATCD-c859aad8d31f292f109e6b0c1545dc9878c86c69.tar.gz |
ChangeLogTag: Thu Oct 6 08:19:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'netsvcs')
-rw-r--r-- | netsvcs/lib/Base_Optimizer.h | 37 | ||||
-rw-r--r-- | netsvcs/lib/Client_Logging_Handler.h | 82 | ||||
-rw-r--r-- | netsvcs/lib/Log_Message_Receiver.h | 102 | ||||
-rw-r--r-- | netsvcs/lib/Name_Handler.h | 151 | ||||
-rw-r--r-- | netsvcs/lib/Server_Logging_Handler.h | 25 | ||||
-rw-r--r-- | netsvcs/lib/Server_Logging_Handler_T.h | 147 | ||||
-rw-r--r-- | netsvcs/lib/TS_Clerk_Handler.h | 162 | ||||
-rw-r--r-- | netsvcs/lib/TS_Server_Handler.h | 82 | ||||
-rw-r--r-- | netsvcs/lib/Token_Handler.h | 222 |
9 files changed, 525 insertions, 485 deletions
diff --git a/netsvcs/lib/Base_Optimizer.h b/netsvcs/lib/Base_Optimizer.h index 1869531cba9..87c19185d3b 100644 --- a/netsvcs/lib/Base_Optimizer.h +++ b/netsvcs/lib/Base_Optimizer.h @@ -1,18 +1,15 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// netsvcs -// -// = FILENAME -// Base_Optimizer.h -// -// = AUTHOR -// Per Andersson. -// -// ============================================================================ + +//============================================================================= +/** + * @file Base_Optimizer.h + * + * $Id$ + * + * @author Per Andersson. + */ +//============================================================================= + #ifndef BASE_OPTIMIZER_H #define BASE_OPTIMIZER_H @@ -23,14 +20,16 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +/** + * @class Base_Optimizer + * + * + * Thanks to Nathan Myers and Fergus Henderson for this little + * beauty. + */ template<class Base, class Member> class Base_Optimizer : public Base { - // = TITLE - // - // = DESCRIPTION - // Thanks to Nathan Myers and Fergus Henderson for this little - // beauty. public: Base_Optimizer (void); diff --git a/netsvcs/lib/Client_Logging_Handler.h b/netsvcs/lib/Client_Logging_Handler.h index 87d6bd70de3..955cb1d90a8 100644 --- a/netsvcs/lib/Client_Logging_Handler.h +++ b/netsvcs/lib/Client_Logging_Handler.h @@ -1,19 +1,15 @@ // -*- C++ -*- -// -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// Client_Logging_Handler.h -// -// = AUTHOR -// Doug Schmidt <schmidt@.cs.wustl.edu> -// -// ============================================================================ + +//============================================================================= +/** + * @file Client_Logging_Handler.h + * + * $Id$ + * + * @author Doug Schmidt <schmidt@.cs.wustl.edu> + */ +//============================================================================= + #ifndef ACE_CLIENT_LOGGER_H #define ACE_CLIENT_LOGGER_H @@ -42,60 +38,64 @@ template class ACE_Svc_Export ACE_Svc_Handler<LOGGING_STREAM, ACE_NULL_SYNCH>; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ +/** + * @class ACE_Client_Logging_Handler + * + * @brief This client logging daemon is a mediator that receives logging + * records from local applications processes and forwards them to + * the server logging daemon running on another host. + * + * The default implementation uses an <ACE_SPIPE_Stream> to + * receive the logging message from the application and an + * <ACE_SOCK_Stream> to forward the logging message to the + * server. However, on platforms that don't support + * <ACE_SPIPEs> (e.g., Win32) we use sockets instead. + */ class ACE_Svc_Export ACE_Client_Logging_Handler : public ACE_Svc_Handler<LOGGING_STREAM, ACE_NULL_SYNCH> { - // = TITLE - // This client logging daemon is a mediator that receives logging - // records from local applications processes and forwards them to - // the server logging daemon running on another host. - // - // = DESCRIPTION - // The default implementation uses an <ACE_SPIPE_Stream> to - // receive the logging message from the application and an - // <ACE_SOCK_Stream> to forward the logging message to the - // server. However, on platforms that don't support - // <ACE_SPIPEs> (e.g., Win32) we use sockets instead. public: // = Initialization and termination. + /// Default constructor. <handle> is where the output is sent. ACE_Client_Logging_Handler (ACE_HANDLE handle = ACE_STDERR); - // Default constructor. <handle> is where the output is sent. + /// Activate this instance of the <ACE_Client_Logging_Handler> + /// (called by the <ACE_Client_Logging_Acceptor>). virtual int open (void * = 0); - // Activate this instance of the <ACE_Client_Logging_Handler> - // (called by the <ACE_Client_Logging_Acceptor>). + /// Return the handle of the <ACE_SPIPE_Stream>; virtual ACE_HANDLE get_handle (void) const; - // Return the handle of the <ACE_SPIPE_Stream>; + /// Called when object is removed from the <ACE_Reactor>. virtual int close (u_long); - // Called when object is removed from the <ACE_Reactor>. private: + /// Handle SIGPIPE. virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); - // Handle SIGPIPE. + /// Receive logging records from applications. virtual int handle_input (ACE_HANDLE); - // Receive logging records from applications. + /** + * Receive logging records from applications. This is necessary to + * handle madness with UNIX select, which can't deal with MSG_BAND + * data easily due to its overly simple interface... This just + * calls <handle_input>. + */ virtual int handle_exception (ACE_HANDLE); - // Receive logging records from applications. This is necessary to - // handle madness with UNIX select, which can't deal with MSG_BAND - // data easily due to its overly simple interface... This just - // calls <handle_input>. + /// Called back when it's ok to send. virtual int handle_output (ACE_HANDLE); - // Called back when it's ok to send. + /// Send the <log_record> to the logging server. int send (ACE_Log_Record &log_record); - // Send the <log_record> to the logging server. + /// This is either a SOCKET (if we're connected to a logging server) + /// or ACE_STDERR. ACE_HANDLE logging_output_; - // This is either a SOCKET (if we're connected to a logging server) - // or ACE_STDERR. }; ACE_SVC_FACTORY_DECLARE (ACE_Client_Logging_Acceptor) diff --git a/netsvcs/lib/Log_Message_Receiver.h b/netsvcs/lib/Log_Message_Receiver.h index 1124b3f4884..3c56561eb1c 100644 --- a/netsvcs/lib/Log_Message_Receiver.h +++ b/netsvcs/lib/Log_Message_Receiver.h @@ -1,18 +1,15 @@ /* -*- C++ -*- */ -// $Id$ -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// Log_Message_Receiver -// -// = AUTHOR -// Per Andersson -// -// ============================================================================ +//============================================================================= +/** + * @file Log_Message_Receiver + * + * $Id$ + * + * @author Per Andersson + */ +//============================================================================= + #ifndef LOG_MESSAGE_RECEIVER_H #define LOG_MESSAGE_RECEIVER_H @@ -90,29 +87,31 @@ // Type based log message receiver +/** + * @class Static_Log_Message_Receiver + * + * @brief Static_Log_Message_Receiver is a simple log message receiver. It + * has no instance data and only static member + * functions. Static/typed based receivers are best when all LMR + * should do exactly the same thing. + * + * This class contains a static log_record member function that + * prints the content of log_records on stderr. + */ template<ACE_SYNCH_DECL> class Static_Log_Message_Receiver { - // = TITLE - // Static_Log_Message_Receiver is a simple log message receiver. It - // has no instance data and only static member - // functions. Static/typed based receivers are best when all LMR - // should do exactly the same thing. - // - // = DESCRIPTION - // This class contains a static log_record member function that - // prints the content of log_records on stderr. public: + /// Prints the log_record to stderr using record.print (hostname, 0, stderr). + /// Serializes the output by using a ACE_SYNCH_MUTEX. static void log_record(const ACE_TCHAR *hostname, ACE_Log_Record &record); - // Prints the log_record to stderr using record.print (hostname, 0, stderr). - // Serializes the output by using a ACE_SYNCH_MUTEX. + /// Prints the log_record to a user specified ostream. static void log_output(const ACE_TCHAR *hostname, ACE_Log_Record &record, ostream *output); - // Prints the log_record to a user specified ostream. }; // Instance based log message receiver @@ -129,33 +128,33 @@ public: //Forward declaration template<ACE_SYNCH_DECL> class Log_Message_Receiver_Impl; +/** + * @class Log_Message_Receiver + * + * @brief Log_Message_Receiver is a little more complicated log message + * receiver. It is instance based and have a reference counted + * implementation. Log_Message_Receiver is the envelope class for + * Log_Message_Receiver_Impl. The difference between + * Static_Log_Message_Receiver and Log_Message_Receiver is that is + * possible to have instance data in Log_Message_Receiver. + * Comment: + * The practical usage of this is limited with the current + * ACE_Server_Logging_Acceptor_T design. Since + * ACE_Server_Logging_Acceptor_T will create the + * Log_Message_Receiver using the default constructor. The main + * reason for inclusion right now is to ensure that the code in + * ACE_Server_Logging_Handler_T works both with type and instance + * based LMRs. + * + * This class contains a log_record member function that prints the + * content of log_records on stderr. + */ template<ACE_SYNCH_DECL> class Log_Message_Receiver { - // = TITLE - // Log_Message_Receiver is a little more complicated log message - // receiver. It is instance based and have a reference counted - // implementation. Log_Message_Receiver is the envelope class for - // Log_Message_Receiver_Impl. The difference between - // Static_Log_Message_Receiver and Log_Message_Receiver is that is - // possible to have instance data in Log_Message_Receiver. - // - // Comment: - // - // The practical usage of this is limited with the current - // ACE_Server_Logging_Acceptor_T design. Since - // ACE_Server_Logging_Acceptor_T will create the - // Log_Message_Receiver using the default constructor. The main - // reason for inclusion right now is to ensure that the code in - // ACE_Server_Logging_Handler_T works both with type and instance - // based LMRs. - // - // = DESCRIPTION - // This class contains a log_record member function that prints the - // content of log_records on stderr. public: + /// Creates a new Log_Message_Receiver Log_Message_Receiver (void); - // Creates a new Log_Message_Receiver Log_Message_Receiver(Log_Message_Receiver<ACE_SYNCH_USE> const &rhs); ~Log_Message_Receiver (void); @@ -172,11 +171,14 @@ private: Log_Message_Receiver_Impl<ACE_SYNCH_USE> *receiver_impl_; }; +/** + * @class Log_Message_Receiver_Impl + * + * @brief Implementation with reference count. + */ template<ACE_SYNCH_DECL> class Log_Message_Receiver_Impl { - // = TITLE - // Implementation with reference count. friend class ACE_Shutup_GPlusPlus; // Turn off g++ warning public: @@ -196,8 +198,8 @@ private: Log_Message_Receiver_Impl (void); ~Log_Message_Receiver_Impl (void); + /// Attributes typedef ACE_Guard<ACE_SYNCH_MUTEX_T> Guard; - // Attributes int count_; ACE_SYNCH_MUTEX_T print_lock_; diff --git a/netsvcs/lib/Name_Handler.h b/netsvcs/lib/Name_Handler.h index 300da03bfdc..496e3a4cca1 100644 --- a/netsvcs/lib/Name_Handler.h +++ b/netsvcs/lib/Name_Handler.h @@ -1,19 +1,17 @@ // -*- C++ -*- -// -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// Name_Handler.h -// -// = AUTHOR -// Prashant Jain, Gerhard Lenzer, and Douglas C. Schmidt -// -// ============================================================================ + +//============================================================================= +/** + * @file Name_Handler.h + * + * $Id$ + * + * @author Prashant Jain + * @author Gerhard Lenzer + * @author and Douglas C. Schmidt + */ +//============================================================================= + #ifndef ACE_NAME_HANDLER_H #define ACE_NAME_HANDLER_H @@ -33,13 +31,15 @@ #include "ace/Singleton.h" #include "ace/svc_export.h" +/** + * @class Naming_Context + * + * @brief This helper class adds the correct default constructor to the + * <ACE_Naming_Context> class so that we can use it in + * <ACE_Singleton>. + */ class Naming_Context : public ACE_Naming_Context { - // = TITLE - // - // This helper class adds the correct default constructor to the - // <ACE_Naming_Context> class so that we can use it in - // <ACE_Singleton>. public: Naming_Context (void) : ACE_Naming_Context (ACE_Naming_Context::NET_LOCAL) {} @@ -51,80 +51,82 @@ typedef ACE_Singleton<Naming_Context, ACE_SYNCH_NULL_MUTEX> NAMING_CONTEXT; template class ACE_Svc_Export ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ +/** + * @class ACE_Name_Handler + * + * @brief Product object created by <ACE_Name_Acceptor>. An + * <ACE_Name_Handler> exchanges messages with a <ACE_Name_Proxy> + * object on the client-side. + * + * This class is the main workhorse of the <ACE_Name_Server>. It + * handles client requests to bind, rebind, resolve, and unbind + * names. It also schedules and handles timeouts that are used to + * support "timed waits." Clients used timed waits to bound the + * amount of time they block trying to get a name. + */ class ACE_Svc_Export ACE_Name_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> { - // = TITLE - // Product object created by <ACE_Name_Acceptor>. An - // <ACE_Name_Handler> exchanges messages with a <ACE_Name_Proxy> - // object on the client-side. - // - // = DESCRIPTION - // This class is the main workhorse of the <ACE_Name_Server>. It - // handles client requests to bind, rebind, resolve, and unbind - // names. It also schedules and handles timeouts that are used to - // support "timed waits." Clients used timed waits to bound the - // amount of time they block trying to get a name. friend class ACE_Shutup_GPlusPlus; // Turn off g++ warning public: + /// Pointer to a member function of ACE_Name_Handler returning int typedef int (ACE_Name_Handler::*OPERATION) (void); - // Pointer to a member function of ACE_Name_Handler returning int + /// Pointer to a member function of ACE_Naming_Context returning int typedef int (ACE_Naming_Context::*LIST_OP) (ACE_PWSTRING_SET &, const ACE_NS_WString &); - // Pointer to a member function of ACE_Naming_Context returning int + /// Pointer to a member function of ACE_Name_Handler returning ACE_Name_Request typedef ACE_Name_Request (ACE_Name_Handler::*REQUEST) (ACE_NS_WString *); - // Pointer to a member function of ACE_Name_Handler returning ACE_Name_Request // = Initialization and termination. + /// Default constructor. ACE_Name_Handler (ACE_Thread_Manager * = 0); - // Default constructor. + /// Activate this instance of the <ACE_Name_Handler> (called by the + /// <ACE_Strategy_Acceptor>). virtual int open (void * = 0); - // Activate this instance of the <ACE_Name_Handler> (called by the - // <ACE_Strategy_Acceptor>). protected: // = Helper routines for the operations exported to clients. + /// Give up waiting (e.g., when a timeout occurs or a client shuts + /// down unexpectedly). virtual int abandon (void); - // Give up waiting (e.g., when a timeout occurs or a client shuts - // down unexpectedly). // = Low level routines for framing requests, dispatching // operations, and returning replies. + /// Receive, frame, and decode the client's request. virtual int recv_request (void); - // Receive, frame, and decode the client's request. + /// Dispatch the appropriate operation to handle the client's + /// request. virtual int dispatch (void); - // Dispatch the appropriate operation to handle the client's - // request. + /// Create and send a reply to the client. virtual int send_reply (ACE_INT32 status, ACE_UINT32 errnum = 0); - // Create and send a reply to the client. + /// Special kind of reply virtual int send_request (ACE_Name_Request &); - // Special kind of reply // = Demultiplexing hooks. + /// Return the underlying <ACE_HANDLE>. virtual ACE_HANDLE get_handle (void) const; - // Return the underlying <ACE_HANDLE>. + /// Callback method invoked by the <ACE_Reactor> when client events + /// arrive. virtual int handle_input (ACE_HANDLE); - // Callback method invoked by the <ACE_Reactor> when client events - // arrive. // = Timer hook. + /// Enable clients to limit the amount of time they wait for a name. virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); - // Enable clients to limit the amount of time they wait for a name. private: + /// Table of pointers to member functions OPERATION op_table_[ACE_Name_Request::MAX_ENUM]; - // Table of pointers to member functions struct LIST_ENTRY { @@ -140,72 +142,75 @@ private: // Name of the operation we're dispatching (used for debugging). }; + /// This is the table of pointers to functions that we use to + /// simplify the handling of list requests. LIST_ENTRY list_table_[ACE_Name_Request::MAX_LIST]; - // This is the table of pointers to functions that we use to - // simplify the handling of list requests. + /// Cache request from the client. ACE_Name_Request name_request_; - // Cache request from the client. + /// Special kind of reply for resolve and listnames. ACE_Name_Request name_request_back_; - // Special kind of reply for resolve and listnames. + /// Cache reply to the client. ACE_Name_Reply name_reply_; - // Cache reply to the client. + /// Address of client we are connected with. ACE_INET_Addr addr_; - // Address of client we are connected with. + /// Ensure dynamic allocation... ~ACE_Name_Handler (void); - // Ensure dynamic allocation... + /// Handle binds. int bind (void); - // Handle binds. + /// Handle rebinds. int rebind (void); - // Handle rebinds. + /// Handle binds and rebinds. int shared_bind (int rebind); - // Handle binds and rebinds. + /// Handle find requests. int resolve (void); - // Handle find requests. + /// Handle unbind requests. int unbind (void); - // Handle unbind requests. + /// Handle LIST_NAMES, LIST_VALUES, and LIST_TYPES requests. int lists (void); - // Handle LIST_NAMES, LIST_VALUES, and LIST_TYPES requests. + /// Handle LIST_NAME_ENTRIES, LIST_VALUE_ENTRIES, and + /// LIST_TYPE_ENTRIES requests. int lists_entries (void); - // Handle LIST_NAME_ENTRIES, LIST_VALUE_ENTRIES, and - // LIST_TYPE_ENTRIES requests. + /// Create a name request. ACE_Name_Request name_request (ACE_NS_WString *one_name); - // Create a name request. + /// Create a value request. ACE_Name_Request value_request (ACE_NS_WString *one_name); - // Create a value request. + /// Create a type request. ACE_Name_Request type_request (ACE_NS_WString *one_name); - // Create a type request. }; +/** + * @class ACE_Name_Acceptor + * + * @brief This class contains the service-specific methods that can't + * easily be factored into the <ACE_Strategy_Acceptor>. + */ class ACE_Name_Acceptor : public ACE_Strategy_Acceptor<ACE_Name_Handler, ACE_SOCK_ACCEPTOR> { - // = TITLE - // This class contains the service-specific methods that can't - // easily be factored into the <ACE_Strategy_Acceptor>. public: + /// Dynamic linking hook. virtual int init (int argc, ACE_TCHAR *argv[]); - // Dynamic linking hook. + /// Parse svc.conf arguments. int parse_args (int argc, ACE_TCHAR *argv[]); - // Parse svc.conf arguments. private: + /// The scheduling strategy is designed for Reactive services. ACE_Schedule_All_Reactive_Strategy<ACE_Name_Handler> scheduling_strategy_; - // The scheduling strategy is designed for Reactive services. }; ACE_SVC_FACTORY_DECLARE (ACE_Name_Acceptor) diff --git a/netsvcs/lib/Server_Logging_Handler.h b/netsvcs/lib/Server_Logging_Handler.h index e6b017ffd06..b1f9516ef0f 100644 --- a/netsvcs/lib/Server_Logging_Handler.h +++ b/netsvcs/lib/Server_Logging_Handler.h @@ -1,18 +1,15 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// Server_Logging_Handler.h -// -// = AUTHOR -// Doug Schmidt and Per Andersson <Per.Andersson@hfera.ericsson.se> -// -// ============================================================================ + +//============================================================================= +/** + * @file Server_Logging_Handler.h + * + * $Id$ + * + * @author Doug Schmidt and Per Andersson <Per.Andersson@hfera.ericsson.se> + */ +//============================================================================= + #ifndef ACE_SERVER_LOGGING_HANDLER_H #define ACE_SERVER_LOGGING_HANDLER_H diff --git a/netsvcs/lib/Server_Logging_Handler_T.h b/netsvcs/lib/Server_Logging_Handler_T.h index 2bd8942093c..9619e427fbe 100644 --- a/netsvcs/lib/Server_Logging_Handler_T.h +++ b/netsvcs/lib/Server_Logging_Handler_T.h @@ -1,18 +1,15 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// Server_Logging_Handler_T.h -// -// = AUTHOR -// Doug Schmidt and Per Andersson -// -// ============================================================================ + +//============================================================================= +/** + * @file Server_Logging_Handler_T.h + * + * $Id$ + * + * @author Doug Schmidt and Per Andersson + */ +//============================================================================= + #ifndef ACE_SERVER_LOGGING_HANDLER_T_H #define ACE_SERVER_LOGGING_HANDLER_T_H @@ -35,54 +32,58 @@ #include "Base_Optimizer.h" #endif /* ! ACE_HAS_BROKEN_HPUX_TEMPLATES && ! __GNUG__ */ +/** + * @class ACE_Server_Logging_Handler_T + * + * @brief Product object created by an <ACE_Server_Logging_Acceptor_T>. An + * <ACE_Server_Logging_Handler_T> receives, and frames logging + * records. The logging record is then processed by the + * <LOG_MESSAGE_RECEIVER> + * + * Defines the classes that perform server logging daemon + * functionality. + */ template <ACE_PEER_STREAM_1, class COUNTER, ACE_SYNCH_DECL, class LOG_MESSAGE_RECEIVER> class ACE_Server_Logging_Handler_T : public ACE_Svc_Handler<ACE_PEER_STREAM_2, ACE_SYNCH_USE> { - // = TITLE - // Product object created by an <ACE_Server_Logging_Acceptor_T>. An - // <ACE_Server_Logging_Handler_T> receives, and frames logging - // records. The logging record is then processed by the - // <LOG_MESSAGE_RECEIVER> - // - // = DESCRIPTION - // Defines the classes that perform server logging daemon - // functionality. public: + /// Constructor. ACE_Server_Logging_Handler_T (ACE_Thread_Manager *, const LOG_MESSAGE_RECEIVER &receiver ); - // Constructor. + /// Process remote logging records. virtual int handle_input (ACE_HANDLE = ACE_INVALID_HANDLE); - // Process remote logging records. protected: + /// Receive the logging record from a client. int handle_logging_record (void); - // Receive the logging record from a client. + /// Common parts of open function, sets hostname and diables NONBLOCK in peer + /// called from derived classes open method. int open_common (void); - // Common parts of open function, sets hostname and diables NONBLOCK in peer - // called from derived classes open method. #if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + /// Count the number of logging records that arrive. static COUNTER request_count_; - // Count the number of logging records that arrive. #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ #if !defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) && !defined (__GNUG__) + /** + * Packs a LOG_MESSAGE_RECEIVER and ACE_CString attribute together + * in a optimized fashion. The LOG_MESSAGE_RECEIVER class is often + * a class with no instance data. + */ Base_Optimizer<LOG_MESSAGE_RECEIVER, ACE_TString> receiver_; - // Packs a LOG_MESSAGE_RECEIVER and ACE_CString attribute together - // in a optimized fashion. The LOG_MESSAGE_RECEIVER class is often - // a class with no instance data. #else LOG_MESSAGE_RECEIVER receiver_; ACE_TString host_name_; #endif /* ! ACE_HAS_BROKEN_HPUX_TEMPLATES && ! __GNUG__ */ + /// Name of the host we are connected to. const ACE_TCHAR *host_name (void); - // Name of the host we are connected to. + /// The receiver of log records LOG_MESSAGE_RECEIVER &receiver (void){ return receiver_; } - // The receiver of log records }; #if 1 //!defined (ACE_HAS_TLI) @@ -93,30 +94,34 @@ protected: #define LOGGING_PEER_STREAM ACE_TLI_STREAM #endif /* ACE_HAS_TLI */ +/** + * @class ACE_Server_Logging_Acceptor_T + * + * @brief Factory that creates <SERVER_LOGGING_HANDLER>s scheduled with + * <SCHEDULE_STRATEGY> and logging records proccessed by a + * <LOG_MESSAGE_RECEIVER> + * + * This class contains the service-specific methods that can't + * easily be factored into the <ACE_Strategy_Acceptor>. + */ template<class SERVER_LOGGING_HANDLER, class LOG_MESSAGE_RECEIVER, class SCHEDULE_STRATEGY> class ACE_Server_Logging_Acceptor_T : public ACE_Strategy_Acceptor<SERVER_LOGGING_HANDLER, LOGGING_PEER_ACCEPTOR> { - // = TITLE - // Factory that creates <SERVER_LOGGING_HANDLER>s scheduled with - // <SCHEDULE_STRATEGY> and logging records proccessed by a - // <LOG_MESSAGE_RECEIVER> - // - // = DESCRIPTION - // This class contains the service-specific methods that can't - // easily be factored into the <ACE_Strategy_Acceptor>. public: + /// Dynamic linking hook. ACE_Server_Logging_Acceptor_T (void); virtual int init (int argc, ACE_TCHAR *argv[]); - // Dynamic linking hook. protected: + /// Parse svc.conf arguments. int parse_args (int argc, ACE_TCHAR *argv[]); - // Parse svc.conf arguments. + /** + * Factory that creates a new <SERVER_LOGGING_HANDLER>. We need to + * specialize this since the <LOG_MESSAGE_RECEIVER> held by this Acceptor must be + * passed into the <SERVER_LOGGING_HANDLER>. + */ virtual int make_svc_handler (SERVER_LOGGING_HANDLER *&); - // Factory that creates a new <SERVER_LOGGING_HANDLER>. We need to - // specialize this since the <LOG_MESSAGE_RECEIVER> held by this Acceptor must be - // passed into the <SERVER_LOGGING_HANDLER>. private: // At the moment each ACE_Server_Logging_Acceptor_T contains @@ -130,33 +135,37 @@ private: // ACE_Server_Logging_Acceptor_T code. #if !defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) && !defined (__GNUG__) + /** + * Packs a LOG_MESSAGE_RECEIVER and ACE_CString attribute together + * in a optimized fashion. The LOG_MESSAGE_RECEIVER class is often a + * class with no instance data. + */ Base_Optimizer<LOG_MESSAGE_RECEIVER, SCHEDULE_STRATEGY> receiver_; - // Packs a LOG_MESSAGE_RECEIVER and ACE_CString attribute together - // in a optimized fashion. The LOG_MESSAGE_RECEIVER class is often a - // class with no instance data. #else LOG_MESSAGE_RECEIVER receiver_; SCHEDULE_STRATEGY schedule_strategy_; #endif /* ! ACE_HAS_BROKEN_HPUX_TEMPLATES && ! __GNUG__ */ + /// The scheduling strategy for the service. SCHEDULE_STRATEGY &scheduling_strategy (void); - // The scheduling strategy for the service. + /// The receiver of log records LOG_MESSAGE_RECEIVER &receiver (void); - // The receiver of log records }; +/** + * @class ACE_Server_Logging_Handler + * + * @brief Product object created by a + * <ACE_Server_Logging_Acceptor_T<ACE_Server_Logging_Handler> >. An + * <ACE_Server_Logging_Handler> receives, frames. The logging record + * is then processed by the <LOG_MESSAGE_RECEIVER> + * + * All clients are handled in the same thread. + */ template<class LOG_MESSAGE_RECEIVER> class ACE_Server_Logging_Handler : public ACE_Server_Logging_Handler_T<LOGGING_PEER_STREAM, u_long, ACE_NULL_SYNCH, LOG_MESSAGE_RECEIVER> { - // = TITLE - // Product object created by a - // <ACE_Server_Logging_Acceptor_T<ACE_Server_Logging_Handler> >. An - // <ACE_Server_Logging_Handler> receives, frames. The logging record - // is then processed by the <LOG_MESSAGE_RECEIVER> - // - // = DESCRIPTION - // All clients are handled in the same thread. public: ACE_Server_Logging_Handler (ACE_Thread_Manager * = 0); @@ -174,17 +183,19 @@ typedef u_long ACE_LOGGER_COUNTER; #define ACE_LOGGER_SYNCH ACE_NULL_SYNCH #endif /* ACE_HAS_THREADS */ +/** + * @class ACE_Thr_Server_Logging_Handler + * + * @brief Product object created by a + * <ACE_Server_Logging_Acceptor_T<ACE_Thr_Server_Logging_Handler> + * >. An <ACE_Thr_Server_Logging_Handler> receives, frames. The + * logging record is then processed by the <LOG_MESSAGE_RECEIVER> + * + * Each client is handled in its own separate thread. + */ template<class LOG_MESSAGE_RECEIVER> class ACE_Thr_Server_Logging_Handler : public ACE_Server_Logging_Handler_T<LOGGING_PEER_STREAM, ACE_LOGGER_COUNTER, ACE_LOGGER_SYNCH, LOG_MESSAGE_RECEIVER> { - // = TITLE - // Product object created by a - // <ACE_Server_Logging_Acceptor_T<ACE_Thr_Server_Logging_Handler> - // >. An <ACE_Thr_Server_Logging_Handler> receives, frames. The - // logging record is then processed by the <LOG_MESSAGE_RECEIVER> - // - // = DESCRIPTION - // Each client is handled in its own separate thread. public: ACE_Thr_Server_Logging_Handler (ACE_Thread_Manager * = 0); diff --git a/netsvcs/lib/TS_Clerk_Handler.h b/netsvcs/lib/TS_Clerk_Handler.h index 48024ebf193..cfa92bcfc97 100644 --- a/netsvcs/lib/TS_Clerk_Handler.h +++ b/netsvcs/lib/TS_Clerk_Handler.h @@ -1,18 +1,15 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// TS_Clerk_Handler.h -// -// = AUTHOR -// Prashant Jain -// -// ============================================================================ + +//============================================================================= +/** + * @file TS_Clerk_Handler.h + * + * $Id$ + * + * @author Prashant Jain + */ +//============================================================================= + #ifndef ACE_TS_CLERK_HANDLER_H #define ACE_TS_CLERK_HANDLER_H @@ -31,10 +28,13 @@ #include "ace/svc_export.h" #include "ace/os_include/os_dirent.h" +/** + * @class ACE_Time_Info + * + * @brief A simple struct containing delta time and a sequence number. + */ class ACE_Time_Info { - // = TITLE - // A simple struct containing delta time and a sequence number. public: long delta_time_; @@ -48,26 +48,28 @@ class ACE_TS_Clerk_Processor; // forward declaration template class ACE_Svc_Export ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ +/** + * @class ACE_TS_Clerk_Handler + * + * @brief The Clerk Handler provides the interface that is used by the + * Clerk Processor to send time update requests to all the + * servers. It obtains these updates from the servers and passes + * the updates to the Clerk Processor + * + * The Clerk Processor uses send_request() to send a request for + * time update to a server. The Clerk Handler internally computes + * the round trip delay for the reply to come back. Once it gets + * the reply back from the server (handle_input), it adjusts the + * system time using the round trip delay estimate and then + * passes the delta time by reference back to the Clerk + * Processor. + */ class ACE_Svc_Export ACE_TS_Clerk_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> { - // = TITLE - // The Clerk Handler provides the interface that is used by the - // Clerk Processor to send time update requests to all the - // servers. It obtains these updates from the servers and passes - // the updates to the Clerk Processor - // - // = DESCRIPTION - // The Clerk Processor uses send_request() to send a request for - // time update to a server. The Clerk Handler internally computes - // the round trip delay for the reply to come back. Once it gets - // the reply back from the server (handle_input), it adjusts the - // system time using the round trip delay estimate and then - // passes the delta time by reference back to the Clerk - // Processor. public: + /// Default constructor. ACE_TS_Clerk_Handler (ACE_TS_Clerk_Processor *processor = 0, ACE_INET_Addr &addr = (ACE_INET_Addr &) ACE_Addr::sap_any); - // Default constructor. // = Set/get the current state enum State @@ -91,38 +93,38 @@ public: int max_timeout (void); void max_timeout (int); + /// Activate this instance of the <ACE_TS_Clerk_Handler> + /// (called by the <ACE_TS_Clerk_Processor>). virtual int open (void * = 0); - // Activate this instance of the <ACE_TS_Clerk_Handler> - // (called by the <ACE_TS_Clerk_Processor>). + /// Return the handle of the message_fifo_; virtual ACE_HANDLE get_handle (void) const; - // Return the handle of the message_fifo_; + /// Called when object is removed from the ACE_Reactor virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - // Called when object is removed from the ACE_Reactor + /// Receive time update from a server. virtual int handle_input (ACE_HANDLE); - // Receive time update from a server. + /// Restart connection asynchronously when timeout occurs. virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); - // Restart connection asynchronously when timeout occurs. + /// Get/Set remote addr void remote_addr (ACE_INET_Addr &addr); ACE_INET_Addr &remote_addr (void); - // Get/Set remote addr + /// Send request for time update to the server as well as return the + /// current time info by reference. int send_request (ACE_UINT32 sequence_num, ACE_Time_Info &time_info); - // Send request for time update to the server as well as return the - // current time info by reference. protected: + /// Handle SIGPIPE. virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); - // Handle SIGPIPE. static void stderr_output (int = 0); @@ -133,96 +135,98 @@ protected: }; private: + /// Receive a reply from a server containing time update int recv_reply (ACE_Time_Request &reply); - // Receive a reply from a server containing time update + /// Reinitiate connection with the server int reinitiate_connection (void); - // Reinitiate connection with the server + /// The current state of the connection State state_; - // The current state of the connection + /// Amount of time to wait between reconnection attempts int timeout_; - // Amount of time to wait between reconnection attempts + /// Maximum amount of time to wait between reconnection attempts int max_timeout_; - // Maximum amount of time to wait between reconnection attempts + /// Remote Addr used for connecting to the server ACE_INET_Addr remote_addr_; - // Remote Addr used for connecting to the server + /// Instance of Clerk Processor used for re-establishing connections ACE_TS_Clerk_Processor *processor_; - // Instance of Clerk Processor used for re-establishing connections + /// Time at which request was sent (used to compute round trip delay) ACE_UINT32 start_time_; - // Time at which request was sent (used to compute round trip delay) + /// Next sequence number of time request (waiting for this update from + /// the server). ACE_UINT32 cur_sequence_num_; - // Next sequence number of time request (waiting for this update from - // the server). + /// Record of current delta time and current sequence number ACE_Time_Info time_info_; - // Record of current delta time and current sequence number }; +/** + * @class ACE_TS_Clerk_Processor + * + * @brief This class manages all the connections to the servers along + * with querying them periodically for time updates. + * + * The Clerk Processor creates connections to all the servers and + * creates an ACE_TS_Clerk_Handler for each connection to handle + * the requests and replies. It periodically sends a request for + * time update through each of the handlers and uses the replies + * for computing a synchronized system time. + */ class ACE_TS_Clerk_Processor : public ACE_Connector <ACE_TS_Clerk_Handler, ACE_SOCK_CONNECTOR> { - // = TITLE - // This class manages all the connections to the servers along - // with querying them periodically for time updates. - // - // = DESCRIPTION - // The Clerk Processor creates connections to all the servers and - // creates an ACE_TS_Clerk_Handler for each connection to handle - // the requests and replies. It periodically sends a request for - // time update through each of the handlers and uses the replies - // for computing a synchronized system time. public: + /// Default constructor ACE_TS_Clerk_Processor (void); - // Default constructor + /// Query servers for time periodically (timeout value) virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); - // Query servers for time periodically (timeout value) + /// Set up connections to all servers int initiate_connection (ACE_TS_Clerk_Handler *, ACE_Synch_Options &); - // Set up connections to all servers protected: // = Dynamic linking hooks. + /// Called when service is linked. virtual int init (int argc, ACE_TCHAR *argv[]); - // Called when service is linked. + /// Called when service is unlinked. virtual int fini (void); - // Called when service is unlinked. + /// Called to determine info about the service. virtual int info (ACE_TCHAR **strp, size_t length) const; - // Called to determine info about the service. // = Scheduling hooks. virtual int suspend (void); virtual int resume (void); private: + /// Parse svc.conf arguments. int parse_args (int argc, ACE_TCHAR *argv[]); - // Parse svc.conf arguments. + /// Allocate entry in shared memory for system time void alloc (void); - // Allocate entry in shared memory for system time + /// Update delta_time using times obtained from all servers int update_time (); - // Update delta_time using times obtained from all servers + /// Allocator (used for reading/writing system time from/to shared memory) typedef ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> MALLOC; typedef ACE_Allocator_Adapter<MALLOC> ALLOCATOR; ALLOCATOR *shmem_; - // Allocator (used for reading/writing system time from/to shared memory) + /// Set of TS_Clerk_Handlers and iterator over the set. typedef ACE_Unbounded_Set <ACE_TS_Clerk_Handler *> HANDLER_SET; typedef ACE_Unbounded_Set_Iterator <ACE_TS_Clerk_Handler *> HANDLER_SET_ITERATOR; HANDLER_SET handler_set_; - // Set of TS_Clerk_Handlers and iterator over the set. struct System_Time { @@ -230,23 +234,23 @@ private: long *last_local_time_; // Last local time }; + /// Clerk system time containing pointers to entries in shared memory System_Time system_time_; - // Clerk system time containing pointers to entries in shared memory + /// Timer id returned by Reactor long timer_id_; - // Timer id returned by Reactor + /// Time period for updating system time int timeout_; - // Time period for updating system time + /// Pool name for backing store ACE_TCHAR poolname_[MAXNAMLEN + 1]; - // Pool name for backing store + /// Do a blocking/non-blocking connect int blocking_semantics_; - // Do a blocking/non-blocking connect + /// Sequence number of next expected update from servers ACE_UINT32 cur_sequence_num_; - // Sequence number of next expected update from servers }; ACE_SVC_FACTORY_DECLARE (ACE_TS_Clerk_Processor) diff --git a/netsvcs/lib/TS_Server_Handler.h b/netsvcs/lib/TS_Server_Handler.h index 4aee2da517e..142c98ecdc1 100644 --- a/netsvcs/lib/TS_Server_Handler.h +++ b/netsvcs/lib/TS_Server_Handler.h @@ -1,18 +1,15 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// TS_Server_Handler.h -// -// = AUTHOR -// Prashant Jain -// -// ============================================================================ + +//============================================================================= +/** + * @file TS_Server_Handler.h + * + * $Id$ + * + * @author Prashant Jain + */ +//============================================================================= + #ifndef ACE_TS_SERVER_HANDLER_H #define ACE_TS_SERVER_HANDLER_H @@ -32,83 +29,88 @@ template class ACE_Svc_Export ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ +/** + * @class ACE_TS_Server_Handler + * + * @brief Product object created by <ACE_TS_Server_Acceptor>. + * + */ class ACE_Svc_Export ACE_TS_Server_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> { - // = TITLE - // Product object created by <ACE_TS_Server_Acceptor>. - // - // = DESCRIPTION friend class ACE_Shutup_GPlusPlus; // Turn off g++ warning public: // = Initialization and termination. + /// Default constructor. ACE_TS_Server_Handler (ACE_Thread_Manager * = 0); - // Default constructor. + /// Activate this instance of the <ACE_TS_Server_Handler> (called by the + /// <ACE_Strategy_Acceptor>). virtual int open (void * = 0); - // Activate this instance of the <ACE_TS_Server_Handler> (called by the - // <ACE_Strategy_Acceptor>). + /// Must be allocated dynamically. ~ACE_TS_Server_Handler (void); - // Must be allocated dynamically. protected: // = Helper routines for the operations exported to clients. + /// Give up waiting (e.g., when a timeout occurs or a client shuts + /// down unexpectedly). virtual int abandon (void); - // Give up waiting (e.g., when a timeout occurs or a client shuts - // down unexpectedly). // = Low level routines for framing requests, dispatching // operations, and returning replies. + /// Receive, frame, and decode the client's request. virtual int recv_request (void); - // Receive, frame, and decode the client's request. + /// Dispatch the appropriate operation to handle the client's + /// request. virtual int dispatch (void); - // Dispatch the appropriate operation to handle the client's - // request. + /// Special kind of reply virtual int send_request (ACE_Time_Request &); - // Special kind of reply // = Demultiplexing hooks. + /// Return the underlying <ACE_HANDLE>. virtual ACE_HANDLE get_handle (void) const; - // Return the underlying <ACE_HANDLE>. + /// Callback method invoked by the <ACE_Reactor> when client events + /// arrive. virtual int handle_input (ACE_HANDLE); - // Callback method invoked by the <ACE_Reactor> when client events - // arrive. // = Timer hook. + /// Enable clients to limit the amount of time they wait. virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); - // Enable clients to limit the amount of time they wait. private: + /// Cache request from the client. ACE_Time_Request time_request_; - // Cache request from the client. + /// Address of client we are connected with. ACE_INET_Addr addr_; - // Address of client we are connected with. }; +/** + * @class ACE_TS_Server_Acceptor + * + * @brief This class contains the service-specific methods that can't + * easily be factored into the <ACE_Strategy_Acceptor>. + */ class ACE_TS_Server_Acceptor : public ACE_Strategy_Acceptor<ACE_TS_Server_Handler, ACE_SOCK_ACCEPTOR> { - // = TITLE - // This class contains the service-specific methods that can't - // easily be factored into the <ACE_Strategy_Acceptor>. public: + /// Dynamic linking hook. virtual int init (int argc, ACE_TCHAR *argv[]); - // Dynamic linking hook. + /// Parse svc.conf arguments. int parse_args (int argc, ACE_TCHAR *argv[]); - // Parse svc.conf arguments. private: + /// The scheduling strategy is designed for Reactive services. ACE_Schedule_All_Reactive_Strategy<ACE_TS_Server_Handler> scheduling_strategy_; - // The scheduling strategy is designed for Reactive services. }; ACE_SVC_FACTORY_DECLARE (ACE_TS_Server_Acceptor) diff --git a/netsvcs/lib/Token_Handler.h b/netsvcs/lib/Token_Handler.h index 898b71dbb31..1cbb6b3d2ef 100644 --- a/netsvcs/lib/Token_Handler.h +++ b/netsvcs/lib/Token_Handler.h @@ -1,19 +1,15 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ACE -// -// = FILENAME -// Token_Handler.h -// -// = AUTHOR -// Douglas C. Schmidt (schmidt@cs.wustl.edu) -// Tim Harrison (harrison@cs.wustl.edu) -// -// ============================================================================ + +//============================================================================= +/** + * @file Token_Handler.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) Tim Harrison (harrison@cs.wustl.edu) + */ +//============================================================================= + #ifndef ACE_TOKEN_HANDLER_H #define ACE_TOKEN_HANDLER_H @@ -32,111 +28,117 @@ #if defined (ACE_HAS_TOKENS_LIBRARY) +/** + * @class ACE_Token_Handler + * + * @brief Product object created by an <ACE_Token_Acceptor>. A + * <Token_Handler> exchanges messages with a <Token_Proxy> object + * on the client-side. + * + * This class is the main workhorse of the ACE Token service. It + * receives token operation requests from remote clients and turns + * them into calls on local tokens (acquire, release, renew, and + * remove). In OMG CORBA terms, it is an object adapter. It also + * schedules and handles timeouts that are used to support "timed + * waits." Clients used timed waits to bound the amount of time + * they block trying to get a token. + */ class ACE_Svc_Export ACE_Token_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> { - // = TITLE - // Product object created by an <ACE_Token_Acceptor>. A - // <Token_Handler> exchanges messages with a <Token_Proxy> object - // on the client-side. - // - // = DESCRIPTION - // This class is the main workhorse of the ACE Token service. It - // receives token operation requests from remote clients and turns - // them into calls on local tokens (acquire, release, renew, and - // remove). In OMG CORBA terms, it is an object adapter. It also - // schedules and handles timeouts that are used to support "timed - // waits." Clients used timed waits to bound the amount of time - // they block trying to get a token. public: // = Initialization and termination. + /// Default constructor. ACE_Token_Handler (ACE_Thread_Manager * = 0); - // Default constructor. // = Accessor and mutator methods. // = Remote operations "exported" to a client. + /** + * Try to acquire the token. + * Precondition: client *may* hold the token already (i.e., + * supports recursive acquisitions). + */ virtual int acquire (ACE_Token_Proxy *proxy); - // Try to acquire the token. - // Precondition: client *may* hold the token already (i.e., - // supports recursive acquisitions). + /// Try to acquire the token. virtual int try_acquire (ACE_Token_Proxy *proxy); - // Try to acquire the token. + /// Release the token and allow the next client that is waiting to + /// proceed. Preconditions: client must hold the token. virtual int release (ACE_Token_Proxy *proxy); - // Release the token and allow the next client that is waiting to - // proceed. Preconditions: client must hold the token. + /// Yield the token if any clients are waiting, otherwise keep the + /// token. Preconditions: client must hold the token. virtual int renew (ACE_Token_Proxy *proxy); - // Yield the token if any clients are waiting, otherwise keep the - // token. Preconditions: client must hold the token. + /** + * Remove the specified token from the Token_Map. Preconditions: + * ACE_Token must exist. @@ Any other preconditions, e.g., must + * client hold token, must there be no waiters, etc.? + */ virtual int remove (ACE_Token_Proxy *proxy); - // Remove the specified token from the Token_Map. Preconditions: - // ACE_Token must exist. @@ Any other preconditions, e.g., must - // client hold token, must there be no waiters, etc.? + /// Called by TS_[Mutex,RLock,WLock] when we hold the mutex and + /// someone wants it. void sleep_hook (void); - // Called by TS_[Mutex,RLock,WLock] when we hold the mutex and - // someone wants it. + /// Called by TS_[Mutex,RLock,WLock] when we are waiting and acquire + /// the mutex. void token_acquired (ACE_TPQ_Entry *); - // Called by TS_[Mutex,RLock,WLock] when we are waiting and acquire - // the mutex. protected: // = Low level routines for framing requests, dispatching // operations, and returning replies. + /// Our connection has been closed. virtual int abandon (int send_error); - // Our connection has been closed. + /// Receive, frame, and decode the client's request. virtual int recv_request (void); - // Receive, frame, and decode the client's request. + /// Dispatch the appropriate operation to handle the client's + /// request. virtual int dispatch (void); - // Dispatch the appropriate operation to handle the client's - // request. + /// Create and send a reply to the client. virtual int send_reply (ACE_UINT32 errnum); - // Create and send a reply to the client. // = Demultiplexing hooks. + /// Callback method invoked by the <ACE_Reactor> when client events + /// arrive. virtual int handle_input (ACE_HANDLE); - // Callback method invoked by the <ACE_Reactor> when client events - // arrive. // = Timer hook. + /// Enable clients to limit the amount of time they wait for a token. virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); - // Enable clients to limit the amount of time they wait for a token. + /// return a proxy for the calling client_id and token name. ACE_Token_Proxy *get_proxy (void); - // return a proxy for the calling client_id and token name. private: + /// Switches on the type of token_request_ and creates a new + /// Token_Proxy. virtual ACE_Token_Proxy *create_proxy (void); - // Switches on the type of token_request_ and creates a new - // Token_Proxy. + /// Keeps track of the synchronization options (i.e., the timeout + /// interval). ACE_Synch_Options request_options_; - // Keeps track of the synchronization options (i.e., the timeout - // interval). + /// collection of the client's token proxies. ACE_Token_Collection collection_; - // collection of the client's token proxies. + /// ID returned by the Reactor that is used to kill registered timers + /// when a token operation times out. long timeout_id_; - // ID returned by the Reactor that is used to kill registered timers - // when a token operation times out. + /// Cache request from the client. ACE_Token_Request token_request_; - // Cache request from the client. + /// Cache reply to the client. ACE_Token_Reply token_reply_; - // Cache reply to the client. }; // = DESCRIPTION of ACE_TS_* classes: @@ -150,112 +152,130 @@ private: // Since only the Token_Handler uses ACE_TS_Mutex, we've moved // the definition to the .cpp file. +/** + * @class ACE_TS_Mutex + * + * @brief ACE_TS_Mutex -- ACE_*T*oken_*S*erver_Mutex + */ class ACE_TS_Mutex : public ACE_Local_Mutex { - // = TITLE - // ACE_TS_Mutex -- ACE_*T*oken_*S*erver_Mutex public: + /// Creation. ACE_TS_Mutex (const char *name, ACE_Token_Handler *th); - // Creation. protected: + /// Somebody wants our token! virtual void sleep_hook (void); - // Somebody wants our token! + /** + * We've been taken off the waiters list and given the token! Call + * the Token_Handler associated at construction, so it can tell the + * remote client. + */ virtual void token_acquired (ACE_TPQ_Entry *); - // We've been taken off the waiters list and given the token! Call - // the Token_Handler associated at construction, so it can tell the - // remote client. + /// Duplication. ACE_TS_Mutex (const ACE_TS_Mutex &); - // Duplication. + /// Return a deep copy. virtual ACE_Token_Proxy *clone (void) const; - // Return a deep copy. private: + /// The Token Handler associated with this proxy. Set at + /// construction and notified when blocking acquires succeed. ACE_Token_Handler* th_; - // The Token Handler associated with this proxy. Set at - // construction and notified when blocking acquires succeed. }; +/** + * @class ACE_TS_RLock + * + * @brief ACE_TS_RLock -- ACE_*T*oken_*S*erver_RLock + */ class ACE_TS_RLock : public ACE_Local_RLock { - // = TITLE - // ACE_TS_RLock -- ACE_*T*oken_*S*erver_RLock public: + /// Creation. ACE_TS_RLock (const char *name, ACE_Token_Handler *th); - // Creation. protected: + /// Somebody wants our token! virtual void sleep_hook (void); - // Somebody wants our token! + /** + * We've been taken off the waiters list and given the token! Call + * the Token_Handler associated at construction, so it can tell the + * remote client. + */ virtual void token_acquired (ACE_TPQ_Entry *); - // We've been taken off the waiters list and given the token! Call - // the Token_Handler associated at construction, so it can tell the - // remote client. + /// Duplication. ACE_TS_RLock (const ACE_TS_RLock&); - // Duplication. + /// Return a deep copy. virtual ACE_Token_Proxy *clone (void) const; - // Return a deep copy. private: + /// the Token Handler associated with this proxy. Set at + /// construction and notified when blocking acquires succeed. ACE_Token_Handler* th_; - // the Token Handler associated with this proxy. Set at - // construction and notified when blocking acquires succeed. }; +/** + * @class ACE_TS_WLock + * + * @brief ACE_TS_WLock -- ACE_*T*oken_*S*erver_WLock + */ class ACE_TS_WLock : public ACE_Local_WLock { - // = TITLE - // ACE_TS_WLock -- ACE_*T*oken_*S*erver_WLock public: + /// Creation. ACE_TS_WLock (const char *name, ACE_Token_Handler *th); - // Creation. protected: + /// Somebody wants our token! virtual void sleep_hook (void); - // Somebody wants our token! + /** + * We've been taken off the waiters list and given the token! Call + * the Token_Handler associated at construction, so it can tell the + * remote client. + */ virtual void token_acquired (ACE_TPQ_Entry *); - // We've been taken off the waiters list and given the token! Call - // the Token_Handler associated at construction, so it can tell the - // remote client. + /// Duplication. ACE_TS_WLock (const ACE_TS_WLock&); - // Duplication. + /// Return a deep copy. virtual ACE_Token_Proxy *clone (void) const; - // Return a deep copy. private: + /// the Token Handler associated with this proxy. Set at + /// construction and notified when blocking acquires succeed. ACE_Token_Handler* th_; - // the Token Handler associated with this proxy. Set at - // construction and notified when blocking acquires succeed. }; +/** + * @class ACE_Token_Acceptor + * + * @brief This class contains the service-specific methods that can't + * easily be factored into the <ACE_Strategy_Acceptor>. + */ class ACE_Token_Acceptor : public ACE_Strategy_Acceptor<ACE_Token_Handler, ACE_SOCK_ACCEPTOR> { - // = TITLE - // This class contains the service-specific methods that can't - // easily be factored into the <ACE_Strategy_Acceptor>. public: + /// Dynamic linking hook. virtual int init (int argc, char *argv[]); - // Dynamic linking hook. + /// Parse svc.conf arguments. int parse_args (int argc, char *argv[]); - // Parse svc.conf arguments. private: + /// The scheduling strategy is designed for Reactive services. ACE_Schedule_All_Reactive_Strategy<ACE_Token_Handler> scheduling_strategy_; - // The scheduling strategy is designed for Reactive services. }; ACE_SVC_FACTORY_DECLARE (ACE_Token_Acceptor) |