OW_NAMESPACE::HTTPServer Class Reference

#include <OW_HTTPServer.hpp>

Inheritance diagram for OW_NAMESPACE::HTTPServer:

Inheritance graph
[legend]
Collaboration diagram for OW_NAMESPACE::HTTPServer:

Collaboration graph
[legend]
List of all members.

Public Types

enum  EAuthenticationChallengeMethod { E_DIGEST, E_BASIC, E_OWLOCAL }

Public Member Functions

 HTTPServer ()
virtual ~HTTPServer ()
virtual String getName () const
 Every service may have a name.
virtual StringArray getDependencies () const
 Get the list of services this service depends on.
virtual void init (const ServiceEnvironmentIFCRef &env)
 init() will be called to give the derived class an opportunity to initialize itself.
virtual void start ()
 In start(), a service should start doing whatever it does, such as starting a new thread or adding selectables to the environment.
virtual void shutdown ()
 Shutdown the http server.
bool isShuttingDown ()
 Is the server in the process of shutting down?
Array< URLgetURLs () const
 Get the URLs associated with this http server.
ServiceEnvironmentIFCRef getEnvironment () const
void addURL (const URL &url)
 Add a new url (to be returned by getURLs()).
SocketAddress getLocalHTTPAddress ()
SocketAddress getLocalHTTPSAddress ()

Private Member Functions

bool authenticate (HTTPSvrConnection *pconn, String &userName, const String &info, OperationContext &context, const Socket &socket)
bool isAllowedUser (const String &user) const

Private Attributes

Mutex m_guard
Options m_options
IntrusiveReference< UnnamedPipem_upipe
Array< URLm_urls
IntrusiveReference< ServerSocketm_pHttpServerSocket
IntrusiveReference< ServerSocketm_pHttpsServerSocket
IntrusiveReference< ServerSocketm_pUDSServerSocket
IntrusiveReference< DigestAuthenticationm_digestAuthentication
IntrusiveReference< LocalAuthenticationm_localAuthentication
Mutex m_authGuard
IntrusiveReference< ThreadPoolm_threadPool
SortedVectorSet< Stringm_allowedUsers
bool m_allowAllUsers
SSLServerCtxRef m_sslCtx
Mutex m_shutdownGuard
bool m_shuttingDown
SSLOpts m_sslopts
SSLTrustStoreRef m_trustStore

Friends

class HTTPSvrConnection
class HTTPListener
class IPCConnectionHandler
class HTTPServerSelectableCallback

Classes

struct  Options

Detailed Description

Definition at line 56 of file OW_HTTPServer.hpp.


Member Enumeration Documentation

enum OW_NAMESPACE::HTTPServer::EAuthenticationChallengeMethod
 

Enumerator:
E_DIGEST 
E_BASIC 
E_OWLOCAL 

Definition at line 93 of file OW_HTTPServer.hpp.


Constructor & Destructor Documentation

OW_NAMESPACE::HTTPServer::HTTPServer  ) 
 

Definition at line 100 of file OW_HTTPServer.cpp.

References OW_NAMESPACE::UnnamedPipe::E_NONBLOCKING.

OW_NAMESPACE::HTTPServer::~HTTPServer  )  [virtual]
 

Definition at line 120 of file OW_HTTPServer.cpp.


Member Function Documentation

void OW_NAMESPACE::HTTPServer::addURL const URL url  ) 
 

Add a new url (to be returned by getURLs()).

Parameters:
url the URL to be added

Definition at line 707 of file OW_HTTPServer.cpp.

References m_urls, and OW_NAMESPACE::Array< T >::push_back().

Referenced by start().

bool OW_NAMESPACE::HTTPServer::authenticate HTTPSvrConnection pconn,
String userName,
const String info,
OperationContext context,
const Socket socket
[private]
 

Definition at line 150 of file OW_HTTPServer.cpp.

References OW_NAMESPACE::String::empty(), m_authGuard, OW_NAMESPACE::String::tokenize(), and OW_NAMESPACE::String::toLowerCase().

Referenced by OW_NAMESPACE::HTTPSvrConnection::performAuthentication().

StringArray OW_NAMESPACE::HTTPServer::getDependencies  )  const [virtual]
 

Get the list of services this service depends on.

The returned services will be started before and shutdown after this service. It is an error to return the name of a non-existent service, and the cimom startup will fail. The default is to have no dependencies.

Reimplemented from OW_NAMESPACE::ServiceIFC.

Definition at line 134 of file OW_HTTPServer.cpp.

References OW_NAMESPACE::ServiceIFCNames::AuthManager, OW_NAMESPACE::ServiceIFCNames::CIMServer, and OW_NAMESPACE::Array< T >::push_back().

ServiceEnvironmentIFCRef OW_NAMESPACE::HTTPServer::getEnvironment  )  const [inline]
 

Definition at line 84 of file OW_HTTPServer.hpp.

SocketAddress OW_NAMESPACE::HTTPServer::getLocalHTTPAddress  ) 
 

Definition at line 719 of file OW_HTTPServer.cpp.

References OW_NAMESPACE::SocketAddress::allocEmptyAddress(), and OW_NAMESPACE::SocketAddress::INET.

SocketAddress OW_NAMESPACE::HTTPServer::getLocalHTTPSAddress  ) 
 

Definition at line 732 of file OW_HTTPServer.cpp.

References OW_NAMESPACE::SocketAddress::allocEmptyAddress(), OW_NAMESPACE::SocketAddress::INET, and m_pHttpsServerSocket.

String OW_NAMESPACE::HTTPServer::getName  )  const [virtual]
 

Every service may have a name.

The name is used to calculate dependencies, other services can return the name from getDependencies(), to instruct the cimom about which order to start and shutdown all the services. The default is to have no name, in that case, no other service can depend on it.

Reimplemented from OW_NAMESPACE::ServiceIFC.

Definition at line 127 of file OW_HTTPServer.cpp.

References OW_NAMESPACE::ServiceIFCNames::HTTPServer.

Array< URL > OW_NAMESPACE::HTTPServer::getURLs  )  const
 

Get the URLs associated with this http server.

This is used by slp discovery.

Returns:
an array of URLs representing all urls that can be used to access the HTTP server.

Definition at line 713 of file OW_HTTPServer.cpp.

References m_urls.

void OW_NAMESPACE::HTTPServer::init const ServiceEnvironmentIFCRef env  )  [virtual]
 

init() will be called to give the derived class an opportunity to initialize itself.

Do not create threads which interact with the environment until start() is called. During the loading/initializing phase, the environment is single-threaded.

Parameters:
env The service's interface to it's environment. A copy of this may be saved and re-used. All copies of env or objects obtained by calling member functions of env should be set to 0 in shutdown() to prevent circular reference counts.

Implements OW_NAMESPACE::ServiceIFC.

Definition at line 308 of file OW_HTTPServer.cpp.

References OW_NAMESPACE::ConfigOpts::ALLOW_ANONYMOUS_opt, OW_NAMESPACE::HTTPServer::Options::allowAnonymous, OW_NAMESPACE::HTTPServer::Options::allowBasicAuthentication, OW_NAMESPACE::HTTPServer::Options::allowDigestAuthentication, OW_NAMESPACE::ConfigOpts::ALLOWED_USERS_opt, OW_NAMESPACE::HTTPServer::Options::allowLocalAuthentication, OW_NAMESPACE::COMPONENT_NAME, OW_NAMESPACE::HTTPServer::Options::defaultAuthChallenge, OW_NAMESPACE::HTTPServer::Options::defaultContentLanguage, OW_NAMESPACE::ConfigOpts::DUMP_SOCKET_IO_opt, OW_NAMESPACE::ThreadPool::DYNAMIC_SIZE, E_BASIC, E_DIGEST, OW_NAMESPACE::String::empty(), OW_NAMESPACE::HTTPServer::Options::enableDeflate, OW_NAMESPACE::HTTPServer::Options::env, env, OW_NAMESPACE::String::equalsIgnoreCase(), OW_NAMESPACE::ConfigOpts::HTTP_SERVER_ALLOW_LOCAL_AUTHENTICATION_opt, OW_NAMESPACE::ConfigOpts::HTTP_SERVER_DEFAULT_CONTENT_LANGUAGE_opt, OW_NAMESPACE::ConfigOpts::HTTP_SERVER_DIGEST_PASSWORD_FILE_opt, OW_NAMESPACE::ConfigOpts::HTTP_SERVER_ENABLE_DEFLATE_opt, OW_NAMESPACE::ConfigOpts::HTTP_SERVER_HTTP_PORT_opt, OW_NAMESPACE::ConfigOpts::HTTP_SERVER_HTTPS_PORT_opt, OW_NAMESPACE::ConfigOpts::HTTP_SERVER_MAX_CONNECTIONS_opt, OW_NAMESPACE::ConfigOpts::HTTP_SERVER_REUSE_ADDR_opt, OW_NAMESPACE::ConfigOpts::HTTP_SERVER_SINGLE_THREAD_opt, OW_NAMESPACE::ConfigOpts::HTTP_SERVER_TIMEOUT_opt, OW_NAMESPACE::ConfigOpts::HTTP_SERVER_UDS_FILENAME_opt, OW_NAMESPACE::ConfigOpts::HTTP_SERVER_USE_DIGEST_opt, OW_NAMESPACE::ConfigOpts::HTTP_SERVER_USE_UDS_opt, OW_NAMESPACE::HTTPServer::Options::httpPort, OW_NAMESPACE::HTTPServer::Options::httpsPort, OW_NAMESPACE::HTTPServer::Options::isSepThread, m_allowAllUsers, m_digestAuthentication, m_localAuthentication, m_options, m_threadPool, OW_NAMESPACE::HTTPServer::Options::maxConnections, OW_DEFAULT_ALLOW_ANONYMOUS, OW_DEFAULT_ALLOWED_USERS, OW_DEFAULT_HTTP_SERVER_ALLOW_LOCAL_AUTHENTICATION, OW_DEFAULT_HTTP_SERVER_DEFAULT_CONTENT_LANGUAGE, OW_DEFAULT_HTTP_SERVER_DIGEST_PASSWORD_FILE, OW_DEFAULT_HTTP_SERVER_ENABLE_DEFLATE, OW_DEFAULT_HTTP_SERVER_HTTP_PORT, OW_DEFAULT_HTTP_SERVER_HTTPS_PORT, OW_DEFAULT_HTTP_SERVER_MAX_CONNECTIONS, OW_DEFAULT_HTTP_SERVER_REUSE_ADDR, OW_DEFAULT_HTTP_SERVER_SINGLE_THREAD, OW_DEFAULT_HTTP_SERVER_TIMEOUT, OW_DEFAULT_HTTP_SERVER_UDS_FILENAME, OW_DEFAULT_HTTP_SERVER_USE_DIGEST, OW_DEFAULT_HTTP_SERVER_USE_UDS, OW_THROW, OW_NAMESPACE::HTTPServer::Options::reuseAddr, OW_NAMESPACE::SocketBaseImpl::setDumpFiles(), OW_NAMESPACE::Array< T >::size(), OW_NAMESPACE::HTTPServer::Options::timeout, OW_NAMESPACE::String::toInt32(), OW_NAMESPACE::HTTPServer::Options::UDSFilename, and OW_NAMESPACE::HTTPServer::Options::useUDS.

bool OW_NAMESPACE::HTTPServer::isAllowedUser const String user  )  const [private]
 

Definition at line 143 of file OW_HTTPServer.cpp.

References OW_NAMESPACE::SortedVectorSet< T, Compare >::count(), m_allowAllUsers, and m_allowedUsers.

bool OW_NAMESPACE::HTTPServer::isShuttingDown  ) 
 

Is the server in the process of shutting down?

Returns:
true if shutting down

Definition at line 745 of file OW_HTTPServer.cpp.

References m_shutdownGuard, and m_shuttingDown.

void OW_NAMESPACE::HTTPServer::shutdown  )  [virtual]
 

Shutdown the http server.

This function does not return untill all connections have been terminated, and cleaned up.

Implements OW_NAMESPACE::ServiceIFC.

Definition at line 752 of file OW_HTTPServer.cpp.

References OW_NAMESPACE::HTTPServer::Options::env, m_options, m_pHttpsServerSocket, m_pUDSServerSocket, m_shutdownGuard, m_shuttingDown, m_upipe, OW_LOG_DEBUG, OW_THROW, and OW_THROW_ERRNO_MSG.

void OW_NAMESPACE::HTTPServer::start  )  [virtual]
 

In start(), a service should start doing whatever it does, such as starting a new thread or adding selectables to the environment.

A service can't rely on the order of initalization, so if it needs to communicate with another one, that works hould be done in started() start() should not return until the service is actually started, but it must return.

Reimplemented from OW_NAMESPACE::ServiceIFC.

Definition at line 523 of file OW_HTTPServer.cpp.

References addURL(), OW_NAMESPACE::Array< T >::empty(), OW_NAMESPACE::HTTPServer::Options::env, env, OW_NAMESPACE::ConfigOpts::HTTP_SERVER_LISTEN_ADDRESSES_opt, OW_NAMESPACE::HTTPServer::Options::httpPort, HTTPServerSelectableCallback, OW_NAMESPACE::HTTPServer::Options::httpsPort, m_options, m_pUDSServerSocket, OW_DEFAULT_HTTP_SERVER_LISTEN_ADDRESSES, OW_LOG_DEBUG, OW_LOG_ERROR, OW_LOG_INFO, OW_THROW, OW_NAMESPACE::HTTPServer::Options::reuseAddr, OW_NAMESPACE::HTTPServer::Options::UDSFilename, and OW_NAMESPACE::HTTPServer::Options::useUDS.


Friends And Related Function Documentation

friend class HTTPListener [friend]
 

Definition at line 161 of file OW_HTTPServer.hpp.

friend class HTTPServerSelectableCallback [friend]
 

Definition at line 163 of file OW_HTTPServer.hpp.

Referenced by start().

friend class HTTPSvrConnection [friend]
 

Definition at line 160 of file OW_HTTPServer.hpp.

friend class IPCConnectionHandler [friend]
 

Definition at line 162 of file OW_HTTPServer.hpp.


Member Data Documentation

bool OW_NAMESPACE::HTTPServer::m_allowAllUsers [private]
 

Definition at line 147 of file OW_HTTPServer.hpp.

Referenced by init(), and isAllowedUser().

SortedVectorSet<String> OW_NAMESPACE::HTTPServer::m_allowedUsers [private]
 

Definition at line 146 of file OW_HTTPServer.hpp.

Referenced by isAllowedUser().

Mutex OW_NAMESPACE::HTTPServer::m_authGuard [private]
 

Definition at line 144 of file OW_HTTPServer.hpp.

Referenced by authenticate().

IntrusiveReference<DigestAuthentication> OW_NAMESPACE::HTTPServer::m_digestAuthentication [private]
 

Definition at line 139 of file OW_HTTPServer.hpp.

Referenced by init().

Mutex OW_NAMESPACE::HTTPServer::m_guard [private]
 

Definition at line 125 of file OW_HTTPServer.hpp.

IntrusiveReference<LocalAuthentication> OW_NAMESPACE::HTTPServer::m_localAuthentication [private]
 

Definition at line 142 of file OW_HTTPServer.hpp.

Referenced by init().

Options OW_NAMESPACE::HTTPServer::m_options [private]
 

Definition at line 126 of file OW_HTTPServer.hpp.

Referenced by OW_NAMESPACE::HTTPServerSelectableCallback::doSelected(), init(), shutdown(), and start().

IntrusiveReference<ServerSocket> OW_NAMESPACE::HTTPServer::m_pHttpServerSocket [private]
 

Definition at line 135 of file OW_HTTPServer.hpp.

Referenced by OW_NAMESPACE::HTTPServerSelectableCallback::doSelected().

IntrusiveReference<ServerSocket> OW_NAMESPACE::HTTPServer::m_pHttpsServerSocket [private]
 

Definition at line 136 of file OW_HTTPServer.hpp.

Referenced by OW_NAMESPACE::HTTPServerSelectableCallback::doSelected(), getLocalHTTPSAddress(), and shutdown().

IntrusiveReference<ServerSocket> OW_NAMESPACE::HTTPServer::m_pUDSServerSocket [private]
 

Definition at line 137 of file OW_HTTPServer.hpp.

Referenced by OW_NAMESPACE::HTTPServerSelectableCallback::doSelected(), shutdown(), and start().

Mutex OW_NAMESPACE::HTTPServer::m_shutdownGuard [private]
 

Definition at line 149 of file OW_HTTPServer.hpp.

Referenced by isShuttingDown(), and shutdown().

bool OW_NAMESPACE::HTTPServer::m_shuttingDown [private]
 

Definition at line 150 of file OW_HTTPServer.hpp.

Referenced by isShuttingDown(), and shutdown().

SSLServerCtxRef OW_NAMESPACE::HTTPServer::m_sslCtx [private]
 

Definition at line 148 of file OW_HTTPServer.hpp.

SSLOpts OW_NAMESPACE::HTTPServer::m_sslopts [private]
 

Definition at line 152 of file OW_HTTPServer.hpp.

IntrusiveReference<ThreadPool> OW_NAMESPACE::HTTPServer::m_threadPool [private]
 

Definition at line 145 of file OW_HTTPServer.hpp.

Referenced by OW_NAMESPACE::HTTPServerSelectableCallback::doSelected(), and init().

SSLTrustStoreRef OW_NAMESPACE::HTTPServer::m_trustStore [private]
 

Definition at line 153 of file OW_HTTPServer.hpp.

IntrusiveReference<UnnamedPipe> OW_NAMESPACE::HTTPServer::m_upipe [private]
 

Definition at line 132 of file OW_HTTPServer.hpp.

Referenced by OW_NAMESPACE::HTTPServerSelectableCallback::doSelected(), and shutdown().

Array<URL> OW_NAMESPACE::HTTPServer::m_urls [private]
 

Definition at line 134 of file OW_HTTPServer.hpp.

Referenced by addURL(), and getURLs().


The documentation for this class was generated from the following files:
Generated on Thu Feb 9 09:16:51 2006 for openwbem by  doxygen 1.4.6