HttpServer.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 
3 /****************************************************************************
4 ** Copyright (c) 2001-2014
5 **
6 ** This file is part of the QuickFIX FIX Engine
7 **
8 ** This file may be distributed under the terms of the quickfixengine.org
9 ** license as defined by quickfixengine.org and appearing in the file
10 ** LICENSE included in the packaging of this file.
11 **
12 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 **
15 ** See http://www.quickfixengine.org/LICENSE for licensing information.
16 **
17 ** Contact ask@quickfixengine.org if any conditions of this licensing are
18 ** not clear to you.
19 **
20 ****************************************************************************/
21 
22 #ifndef FIX_HTTPSERVER_H
23 #define FIX_HTTPSERVER_H
24 
25 #ifdef _MSC_VER
26 #pragma warning( disable : 4503 4355 4786 4290 )
27 #endif
28 
29 #include "SocketServer.h"
30 #include "SessionSettings.h"
31 #include "Exceptions.h"
32 #include "Mutex.h"
33 
34 namespace FIX
35 {
38 {
39 public:
40  HttpServer( const SessionSettings& ) throw( ConfigError );
41 
42  static void startGlobal( const SessionSettings& ) throw ( ConfigError, RuntimeError );
43  static void stopGlobal();
44 
45  void start() throw ( ConfigError, RuntimeError );
46  void stop();
47 
48 private:
49  void onConfigure( const SessionSettings& ) throw ( ConfigError );
50  void onInitialize( const SessionSettings& ) throw ( RuntimeError );
51 
52  void onStart();
53  bool onPoll();
54  void onStop();
55 
56  void onConnect( SocketServer&, int, int );
57  void onWrite( SocketServer&, int );
58  bool onData( SocketServer&, int );
59  void onDisconnect( SocketServer&, int );
60  void onError( SocketServer& );
61  void onTimeout( SocketServer& );
62 
63  static THREAD_PROC startThread( void* p );
64 
68  int m_port;
69  bool m_stop;
70 
71  static Mutex s_mutex;
72  static int s_count;
74 };
76 }
77 
78 #endif //FIX_HTTPSERVER_H
static void startGlobal(const SessionSettings &)
Definition: HttpServer.cpp:37
#define THREAD_PROC
HttpServer(const SessionSettings &)
Definition: HttpServer.cpp:66
void onTimeout(SocketServer &)
Definition: HttpServer.cpp:158
thread_id m_threadid
Definition: HttpServer.h:67
SocketServer * m_pServer
Definition: HttpServer.h:65
Definition: Acceptor.cpp:34
static THREAD_PROC startThread(void *p)
Definition: HttpServer.cpp:162
void onDisconnect(SocketServer &, int)
Definition: HttpServer.cpp:152
Application encountered serious error during runtime
Definition: Exceptions.h:94
Application is not configured correctly
Definition: Exceptions.h:87
static Mutex s_mutex
Definition: HttpServer.h:71
Container for setting dictionaries mapped to sessions.
void onConfigure(const SessionSettings &)
Definition: HttpServer.cpp:69
Portable implementation of a mutex.
Definition: Mutex.h:30
void onInitialize(const SessionSettings &)
Definition: HttpServer.cpp:75
static int s_count
Definition: HttpServer.h:72
static void stopGlobal()
Definition: HttpServer.cpp:53
pthread_t thread_id
Definition: Utility.h:190
SessionSettings m_settings
Definition: HttpServer.h:66
void onWrite(SocketServer &, int)
Definition: HttpServer.cpp:143
static HttpServer * s_pServer
Definition: HttpServer.h:73
bool onData(SocketServer &, int)
Definition: HttpServer.cpp:147
Listens for and accepts incoming socket connections on a port.
Definition: SocketServer.h:56
void onConnect(SocketServer &, int, int)
Definition: HttpServer.cpp:135
void onError(SocketServer &)
Definition: HttpServer.cpp:156
Basic HTTP Server.
Definition: HttpServer.h:37

Generated on Sun Apr 15 2018 21:44:00 for QuickFIX by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2001