HttpServer.h
Go to the documentation of this file.
/* -*- C++ -*- */
/****************************************************************************
** Copyright (c) 2001-2014
**
** This file is part of the QuickFIX FIX Engine
**
** This file may be distributed under the terms of the quickfixengine.org
** license as defined by quickfixengine.org and appearing in the file
** LICENSE included in the packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.quickfixengine.org/LICENSE for licensing information.
**
** Contact ask@quickfixengine.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifndef FIX_HTTPSERVER_H
#define FIX_HTTPSERVER_H
#ifdef _MSC_VER
#pragma warning( disable : 4503 4355 4786 4290 )
#endif
#include "SocketServer.h"
#include "SessionSettings.h"
#include "Exceptions.h"
#include "Mutex.h"
namespace FIX
{
class HttpServer : public SocketServer::Strategy
{
public:
HttpServer( const SessionSettings& ) throw( ConfigError );
static void startGlobal( const SessionSettings& ) throw ( ConfigError, RuntimeError );
static void stopGlobal();
void start() throw ( ConfigError, RuntimeError );
void stop();
private:
void onConfigure( const SessionSettings& ) throw ( ConfigError );
void onInitialize( const SessionSettings& ) throw ( RuntimeError );
void onStart();
bool onPoll();
void onStop();
void onConnect( SocketServer&, int, int );
void onWrite( SocketServer&, int );
bool onData( SocketServer&, int );
void onDisconnect( SocketServer&, int );
void onError( SocketServer& );
void onTimeout( SocketServer& );
static THREAD_PROC startThread( void* p );
SocketServer* m_pServer;
SessionSettings m_settings;
thread_id m_threadid;
int m_port;
bool m_stop;
static Mutex s_mutex;
static int s_count;
static HttpServer* s_pServer;
};
}
#endif //FIX_HTTPSERVER_H
Exceptions.h
Mutex.h
SessionSettings.h
SocketServer.h
THREAD_PROC
#define THREAD_PROC
Definition Utility.h:184
FIX::HttpServer
Basic HTTP Server.
Definition HttpServer.h:38
FIX::HttpServer::startGlobal
static void startGlobal(const SessionSettings &)
Definition HttpServer.cpp:37
FIX::HttpServer::stopGlobal
static void stopGlobal()
Definition HttpServer.cpp:53
FIX::HttpServer::m_stop
bool m_stop
Definition HttpServer.h:69
FIX::HttpServer::onStop
void onStop()
Definition HttpServer.cpp:131
FIX::HttpServer::onData
bool onData(SocketServer &, int)
Definition HttpServer.cpp:147
FIX::HttpServer::onError
void onError(SocketServer &)
Definition HttpServer.cpp:156
FIX::HttpServer::m_port
int m_port
Definition HttpServer.h:68
FIX::HttpServer::onWrite
void onWrite(SocketServer &, int)
Definition HttpServer.cpp:143
FIX::HttpServer::s_count
static int s_count
Definition HttpServer.h:72
FIX::HttpServer::onConfigure
void onConfigure(const SessionSettings &)
Definition HttpServer.cpp:69
FIX::HttpServer::onInitialize
void onInitialize(const SessionSettings &)
Definition HttpServer.cpp:75
FIX::HttpServer::s_pServer
static HttpServer * s_pServer
Definition HttpServer.h:73
FIX::HttpServer::s_mutex
static Mutex s_mutex
Definition HttpServer.h:71
FIX::HttpServer::m_settings
SessionSettings m_settings
Definition HttpServer.h:66
FIX::HttpServer::startThread
static THREAD_PROC startThread(void *p)
Definition HttpServer.cpp:162
FIX::HttpServer::onTimeout
void onTimeout(SocketServer &)
Definition HttpServer.cpp:158
FIX::HttpServer::onDisconnect
void onDisconnect(SocketServer &, int)
Definition HttpServer.cpp:152
FIX::HttpServer::m_pServer
SocketServer * m_pServer
Definition HttpServer.h:65
FIX::HttpServer::stop
void stop()
Definition HttpServer.cpp:99
FIX::HttpServer::onPoll
bool onPoll()
Definition HttpServer.cpp:122
FIX::HttpServer::m_threadid
thread_id m_threadid
Definition HttpServer.h:67
FIX::HttpServer::start
void start()
Definition HttpServer.cpp:89
FIX::HttpServer::onConnect
void onConnect(SocketServer &, int, int)
Definition HttpServer.cpp:135
FIX::HttpServer::onStart
void onStart()
Definition HttpServer.cpp:110
FIX::Mutex
Portable implementation of a mutex.
Definition Mutex.h:31
FIX::SessionSettings
Container for setting dictionaries mapped to sessions.
Definition SessionSettings.h:221
FIX::SocketServer::Strategy
Definition SocketServer.h:87
FIX::SocketServer
Listens for and accepts incoming socket connections on a port.
Definition SocketServer.h:57
FIX
Definition Acceptor.cpp:35
FIX::thread_id
pthread_t thread_id
Definition Utility.h:190
FIX::ConfigError
Application is not configured correctly
Definition Exceptions.h:88
FIX::RuntimeError
Application encountered serious error during runtime
Definition Exceptions.h:95