(file) Return to HTTPAcceptor.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 martin 1.40 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.41 //
  3 martin 1.40 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.41 //
 10 martin 1.40 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.41 //
 17 martin 1.40 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.41 //
 20 martin 1.40 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.41 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.40 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.41 //
 28 martin 1.40 //////////////////////////////////////////////////////////////////////////
 29 mike   1.2  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             #ifndef Pegasus_HTTPAcceptor_h
 33             #define Pegasus_HTTPAcceptor_h
 34             
 35             #include <Pegasus/Common/Config.h>
 36 kumpf  1.10 #include <Pegasus/Common/MessageQueue.h>
 37 mday   1.18 #include <Pegasus/Common/HTTPConnection.h>
 38 mike   1.2  #include <Pegasus/Common/Monitor.h>
 39             #include <Pegasus/Common/String.h>
 40             #include <Pegasus/Common/TLS.h>
 41 kumpf  1.9  #include <Pegasus/Common/SSLContext.h>
 42 kumpf  1.13 #include <Pegasus/Common/Linkage.h>
 43             
 44 mike   1.2  PEGASUS_NAMESPACE_BEGIN
 45             
 46 kumpf  1.16 class HTTPAcceptorRep;
 47 mday   1.17 class Monitor;
 48 mike   1.2  /** Instances of this class listen on a port and accept conections.
 49             */
 50 mday   1.8  class PEGASUS_COMMON_LINKAGE HTTPAcceptor : public MessageQueue
 51 mike   1.2  {
 52 kumpf  1.34 public:
 53 dave.sudlik 1.36     // Connection types.
 54                      enum { LOCAL_CONNECTION, IPV4_CONNECTION, IPV6_CONNECTION };
 55                  
 56 kumpf       1.34     typedef MessageQueue Base;
 57 kumpf       1.35 
 58 kumpf       1.34     /** Constructor.
 59                          @param monitor pointer to monitor object which this class uses to
 60                          solicit SocketMessages on the server port (socket).
 61                          @param outputMessageQueue output message queue for connections
 62                          created by this acceptor.
 63 kumpf       1.42         @param connectionType indicating the type of connection for
 64 dave.sudlik 1.36         this acceptor. connectionType can be any one of  LOCAL_CONNECTION,
 65                          IPV4_CONNECTION and IPV6_CONNECTION. If connectionType is
 66                          LOCAL_CONNECTION portNumber is ignored.
 67 kumpf       1.34         @param portNumber Specifies which port number this acceptor is to
 68                          listen on.  If this value is 0 then a port is automatically selected
 69                          by bind().  In this case, the actual port number used can be retrieved
 70                          using getPortNumber().
 71                          @param sslcontext If null, this acceptor does not create SSL
 72                          connections.  If non-null, the argument specifies an SSL context to
 73                          use for connections established by this acceptor.
 74                      */
 75                      HTTPAcceptor(
 76                          Monitor* monitor,
 77                          MessageQueue* outputMessageQueue,
 78 dave.sudlik 1.36         Uint16 connectionType,
 79 kumpf       1.34         Uint32 portNumber,
 80                          SSLContext * sslcontext,
 81                          ReadWriteSem* sslContextObjectLock = 0);
 82                  
 83                      /** Destructor. */
 84                      ~HTTPAcceptor();
 85                  
 86                      /** This method is called whenever a SocketMessage is enqueued
 87                          on the input queue of the HTTPAcceptor object.
 88 kumpf       1.35     */
 89 mday        1.5  
 90 kumpf       1.34     virtual void handleEnqueue(Message *);
 91 kumpf       1.35 
 92 kumpf       1.34     virtual void handleEnqueue();
 93 mday        1.5  
 94 kumpf       1.34     /** Bind the specified listen socket.
 95                          @exception throws BindFailedException if unable to bind (either
 96                          because the listen socket is invalid or the socket is in use).
 97                      */
 98                      void bind();
 99 mday        1.5  
100 kumpf       1.34     /** Unbind from the given port.
101                      */
102                      void unbind();
103 mday        1.5  
104 kumpf       1.34     /** Close the connection socket.
105                      */
106                      void closeConnectionSocket();
107 mday        1.5  
108 kumpf       1.34     /** Reopen the connection socket.
109                      */
110                      void reopenConnectionSocket();
111 mday        1.5  
112 kumpf       1.34     /** Destroys all the connections created by this acceptor. */
113                      void destroyConnections();
114 mday        1.5  
115 kumpf       1.34     /** Close and Reopen the connection socket.
116                      */
117                      void reconnectConnectionSocket();
118 thilo.boehm 1.33 
119 kumpf       1.38     /** Returns the number of outstanding requests for connections created by
120                          this Acceptor.
121 kumpf       1.34     */
122                      Uint32 getOutstandingRequestCount() const;
123 david.dillard 1.27 
124 kumpf         1.34     /** Returns the port number used for the connection.  If the number
125                            is 0 that means that the socket is not bound.
126                        */
127                        Uint32 getPortNumber() const;
128 mike          1.2  
129 kavita.gupta  1.39     static void setSocketWriteTimeout(Uint32 socketWriteTimeout);
130 marek         1.30 
131 kumpf         1.34 private:
132 mike          1.2  
133 kumpf         1.34     void _acceptConnection();
134                        void _bind();
135 mday          1.17 
136 kumpf         1.34     cimom *_meta_dispatcher;
137                    
138                        Monitor* _monitor;
139                        MessageQueue* _outputMessageQueue;
140                        HTTPAcceptorRep* _rep;
141                    
142                        int _entry_index;
143 mday          1.4  
144 dave.sudlik   1.36     Uint16 _connectionType;
145 kumpf         1.34     Uint32 _portNumber;
146                        SSLContext* _sslcontext;
147                        ReadWriteSem*  _sslContextObjectLock;
148 kavita.gupta  1.39     static Uint32 _socketWriteTimeout;
149                    #ifndef PEGASUS_INTEGERS_BOUNDARY_ALIGNED
150                        static Mutex _socketWriteTimeoutMutex;
151                    #endif
152 mday          1.18 };
153                    
154 mike          1.2  PEGASUS_NAMESPACE_END
155                    
156                    #endif /* Pegasus_HTTPAcceptor_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2