1 karl 1.28 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.2 //
|
3 karl 1.23 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.21 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.23 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.25 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.28 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.2 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
15 kumpf 1.11 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
18 mike 1.2 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
|
21 kumpf 1.11 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
22 mike 1.2 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
24 kumpf 1.11 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
27 mike 1.2 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
34 #ifndef Pegasus_HTTPAcceptor_h
35 #define Pegasus_HTTPAcceptor_h
36
37 #include <Pegasus/Common/Config.h>
|
38 kumpf 1.10 #include <Pegasus/Common/MessageQueue.h>
|
39 mday 1.18 #include <Pegasus/Common/HTTPConnection.h>
|
40 mike 1.2 #include <Pegasus/Common/Monitor.h>
41 #include <Pegasus/Common/String.h>
42 #include <Pegasus/Common/TLS.h>
|
43 kumpf 1.9 #include <Pegasus/Common/SSLContext.h>
|
44 kumpf 1.13 #include <Pegasus/Common/Linkage.h>
45
|
46 mike 1.2 PEGASUS_NAMESPACE_BEGIN
47
|
48 kumpf 1.16 class HTTPAcceptorRep;
|
49 mday 1.17 class Monitor;
|
50 mike 1.2 /** Instances of this class listen on a port and accept conections.
51 */
|
52 mday 1.8 class PEGASUS_COMMON_LINKAGE HTTPAcceptor : public MessageQueue
|
53 mike 1.2 {
|
54 kumpf 1.34 public:
55 typedef MessageQueue Base;
|
56 kumpf 1.35
|
57 kumpf 1.34 /** Constructor.
58 @param monitor pointer to monitor object which this class uses to
59 solicit SocketMessages on the server port (socket).
60 @param outputMessageQueue output message queue for connections
61 created by this acceptor.
62 @param localConnection Boolean indicating whether this acceptor is
63 only for local connections. If true, the portNumber argument is
64 ignored.
65 @param portNumber Specifies which port number this acceptor is to
66 listen on. If this value is 0 then a port is automatically selected
67 by bind(). In this case, the actual port number used can be retrieved
68 using getPortNumber().
69 @param sslcontext If null, this acceptor does not create SSL
70 connections. If non-null, the argument specifies an SSL context to
71 use for connections established by this acceptor.
72 */
73 HTTPAcceptor(
74 Monitor* monitor,
75 MessageQueue* outputMessageQueue,
76 Boolean localConnection,
77 Uint32 portNumber,
78 kumpf 1.34 SSLContext * sslcontext,
79 ReadWriteSem* sslContextObjectLock = 0);
80
81 /** Destructor. */
82 ~HTTPAcceptor();
83
84 /** This method is called whenever a SocketMessage is enqueued
85 on the input queue of the HTTPAcceptor object.
|
86 kumpf 1.35 */
|
87 mday 1.5
|
88 kumpf 1.34 virtual void handleEnqueue(Message *);
|
89 kumpf 1.35
|
90 kumpf 1.34 virtual void handleEnqueue();
|
91 mday 1.5
|
92 kumpf 1.34 /** Bind the specified listen socket.
93 @exception throws BindFailedException if unable to bind (either
94 because the listen socket is invalid or the socket is in use).
95 */
96 void bind();
|
97 mday 1.5
|
98 kumpf 1.34 /** Unbind from the given port.
99 */
100 void unbind();
|
101 mday 1.5
|
102 kumpf 1.34 /** Close the connection socket.
103 */
104 void closeConnectionSocket();
|
105 mday 1.5
|
106 kumpf 1.34 /** Reopen the connection socket.
107 */
108 void reopenConnectionSocket();
|
109 mday 1.5
|
110 kumpf 1.34 /** Destroys all the connections created by this acceptor. */
111 void destroyConnections();
|
112 mday 1.5
|
113 kumpf 1.34 /** Close and Reopen the connection socket.
114 */
115 void reconnectConnectionSocket();
|
116 thilo.boehm 1.33
|
117 kumpf 1.34 /** Returns the number of outstanding requests
118 */
119 Uint32 getOutstandingRequestCount() const;
|
120 david.dillard 1.27
|
121 kumpf 1.34 /** Returns the port number used for the connection. If the number
122 is 0 that means that the socket is not bound.
123 */
124 Uint32 getPortNumber() const;
|
125 mike 1.2
|
126 kumpf 1.34 void setSocketWriteTimeout(Uint32 socketWriteTimeout);
|
127 marek 1.30
|
128 kumpf 1.34 private:
|
129 mike 1.2
|
130 kumpf 1.34 void _acceptConnection();
131 void _bind();
|
132 mday 1.17
|
133 kumpf 1.34 cimom *_meta_dispatcher;
134
135 Monitor* _monitor;
136 MessageQueue* _outputMessageQueue;
137 HTTPAcceptorRep* _rep;
138
139 int _entry_index;
|
140 mday 1.4
|
141 kumpf 1.34 Boolean _localConnection;
142 Uint32 _portNumber;
143 SSLContext* _sslcontext;
144 ReadWriteSem* _sslContextObjectLock;
145 Uint32 _socketWriteTimeout;
|
146 mday 1.18 };
147
|
148 mike 1.2 PEGASUS_NAMESPACE_END
149
150 #endif /* Pegasus_HTTPAcceptor_h */
|