Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / netsvcs / lib / TS_Server_Handler.h
blob7d9e89371466aeb20d035601b3052d09541d5fd9
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file TS_Server_Handler.h
7 * @author Prashant Jain
8 */
9 //=============================================================================
12 #ifndef ACE_TS_SERVER_HANDLER_H
13 #define ACE_TS_SERVER_HANDLER_H
15 #include "ace/Acceptor.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ace/SOCK_Acceptor.h"
22 #include "ace/Svc_Handler.h"
23 #include "ace/svc_export.h"
25 #include "Time_Request_Reply.h"
27 #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
28 template class ACE_Svc_Export ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>;
29 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
31 /**
32 * @class ACE_TS_Server_Handler
34 * @brief Product object created by <ACE_TS_Server_Acceptor>.
36 class ACE_Svc_Export ACE_TS_Server_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
38 public:
39 /// Default constructor.
40 ACE_TS_Server_Handler (ACE_Thread_Manager * = 0);
42 /// Activate this instance of the <ACE_TS_Server_Handler> (called by the
43 /// <ACE_Strategy_Acceptor>).
44 virtual int open (void * = 0);
46 protected:
47 /// Must be allocated dynamically.
48 ~ACE_TS_Server_Handler ();
50 // = Helper routines for the operations exported to clients.
52 /// Give up waiting (e.g., when a timeout occurs or a client shuts
53 /// down unexpectedly).
54 virtual int abandon ();
56 // = Low level routines for framing requests, dispatching
57 // operations, and returning replies.
59 /// Receive, frame, and decode the client's request.
60 virtual int recv_request ();
62 /// Dispatch the appropriate operation to handle the client's
63 /// request.
64 virtual int dispatch ();
66 /// Special kind of reply
67 virtual int send_request (ACE_Time_Request &);
69 // = Demultiplexing hooks.
70 /// Return the underlying <ACE_HANDLE>.
71 virtual ACE_HANDLE get_handle () const;
73 /// Callback method invoked by the <ACE_Reactor> when client events
74 /// arrive.
75 virtual int handle_input (ACE_HANDLE);
77 // = Timer hook.
78 /// Enable clients to limit the amount of time they wait.
79 virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg);
81 private:
82 /// Cache request from the client.
83 ACE_Time_Request time_request_;
85 /// Address of client we are connected with.
86 ACE_INET_Addr addr_;
89 /**
90 * @class ACE_TS_Server_Acceptor
92 * @brief This class contains the service-specific methods that can't
93 * easily be factored into the <ACE_Strategy_Acceptor>.
95 class ACE_TS_Server_Acceptor : public ACE_Strategy_Acceptor<ACE_TS_Server_Handler, ACE_SOCK_ACCEPTOR>
97 public:
98 /// Dynamic linking hook.
99 virtual int init (int argc, ACE_TCHAR *argv[]);
101 /// Parse svc.conf arguments.
102 int parse_args (int argc, ACE_TCHAR *argv[]);
104 private:
105 /// The scheduling strategy is designed for Reactive services.
106 ACE_Schedule_All_Reactive_Strategy<ACE_TS_Server_Handler> scheduling_strategy_;
109 ACE_SVC_FACTORY_DECLARE (ACE_TS_Server_Acceptor)
111 #endif /* ACE_TS_SERVER_HANDLER_H */