ThreadedSocketConnection.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_THREADEDSOCKETCONNECTION_H
23#define FIX_THREADEDSOCKETCONNECTION_H
24
25#ifdef _MSC_VER
26#pragma warning( disable : 4503 4355 4786 4290 )
27#endif
28
29#include "Parser.h"
30#include "Responder.h"
31#include "SessionID.h"
32#include <set>
33#include <map>
34
35namespace FIX
36{
37class ThreadedSocketAcceptor;
38class ThreadedSocketInitiator;
39class Session;
40class Application;
41class Log;
42
45{
46public:
47 typedef std::set<SessionID> Sessions;
48
49 ThreadedSocketConnection( int s, Sessions sessions, Log* pLog );
50 ThreadedSocketConnection( const SessionID&, int s,
51 const std::string& address, short port,
52 Log* pLog,
53 const std::string& sourceAddress = "", short sourcePort = 0);
55
56 Session* getSession() const { return m_pSession; }
57 int getSocket() const { return m_socket; }
58 bool connect();
59 void disconnect();
60 bool read();
61
62private:
63 bool readMessage( std::string& msg ) throw( SocketRecvFailed );
64 void processStream();
65 bool send( const std::string& );
66 bool setSession( const std::string& msg );
67
69 char m_buffer[BUFSIZ];
70
71 std::string m_address;
72 int m_port;
73 std::string m_sourceAddress;
75
81 fd_set m_fds;
82};
83}
84
85#endif //FIX_THREADEDSOCKETCONNECTION_H
This interface must be implemented to log messages and events.
Definition Log.h:82
Parses FIX messages off an input stream.
Definition Parser.h:37
Interface implements sending on and disconnecting a transport.
Definition Responder.h:35
Maintains the state and implements the logic of a FIX session.
Definition Session.h:46
Unique session id consists of BeginString, SenderCompID and TargetCompID.
Definition SessionID.h:31
Encapsulates a socket file descriptor (multi-threaded).
bool setSession(const std::string &msg)
Socket recv operation failed.
Definition Exceptions.h:279

Generated on Fri Sep 27 2024 13:45:21 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001