Index Source Files Annotated Class List Alphabetical Class List Class Hierarchy Graphical Class Hierarchy

# HttpConnection.h

Go to the documentation of this file.

    00001 /* -*- C++ -*- */
    00002
    00003 /****************************************************************************
    00004 ** Copyright (c) quickfixengine.org  All rights reserved.
    00005 **
    00006 ** This file is part of the QuickFIX FIX Engine
    00007 **
    00008 ** This file may be distributed under the terms of the quickfixengine.org
    00009 ** license as defined by quickfixengine.org and appearing in the file
    00010 ** LICENSE included in the packaging of this file.
    00011 **
    00012 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
    00013 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    00014 **
    00015 ** See http://www.quickfixengine.org/LICENSE for licensing information.
    00016 **
    00017 ** Contact ask@quickfixengine.org if any conditions of this licensing are
    00018 ** not clear to you.
    00019 **
    00020 ****************************************************************************/
    00021
    00022 #ifndef FIX_HTTPCONNECTION_H
    00023 #define FIX_HTTPCONNECTION_H
    00024
    00025 #ifdef _MSC_VER
    00026 #pragma warning( disable : 4503 4355 4786 4290 )
    00027 #endif
    00028
    00029 #include "HttpParser.h"
    00030 #include <stdio.h>
    00031
    00032 namespace FIX
    00033 {
    00034 class HttpMessage;
    00035
    00037 class HttpConnection
    00038 {
    00039 public:
    00040   HttpConnection( int s );
    00041
    00042   int getSocket() const { return m_socket; }
    00043   bool read();
    00044
    00045 private:
    00046   bool readMessage( std::string& msg ) throw( SocketRecvFailed );
    00047   void processStream();
    00048   void processRequest( const HttpMessage& );
    00049   void processRoot( const HttpMessage&, std::stringstream& h, std::stringstream& b );
    00050   void processResetSessions( const HttpMessage&, std::stringstream& h, std::stringstream& b );
    00051   void processRefreshSessions( const HttpMessage&, std::stringstream& h, std::stringstream& b );
    00052   void processEnableSessions( const HttpMessage&, std::stringstream& h, std::stringstream& b );
    00053   void processDisableSessions( const HttpMessage&, std::stringstream& h, std::stringstream& b );
    00054   void processSession( const HttpMessage&, std::stringstream& h, std::stringstream& b );
    00055   void processResetSession( const HttpMessage&, std::stringstream& h, std::stringstream& b );
    00056   void processRefreshSession( const HttpMessage&, std::stringstream& h, std::stringstream& b );
    00057
    00058  void showToggle
    00059     ( std::stringstream& s, const std::string& name, bool value, const std::string& url );
    00060   void showRow
    00061     ( std::stringstream& s, const std::string& name, bool value, const std::string& url = "" );
    00062   void showRow
    00063     ( std::stringstream& s, const std::string& name, const std::string& value, const std::string& url = "" );
    00064   void showRow
    00065     ( std::stringstream& s, const std::string& name, int value, const std::string& url = "" );
    00066
    00067   bool send( const std::string& );
    00068   void disconnect( int error = 0 );
    00069
    00070   int m_socket;
    00071   char m_buffer[BUFSIZ];
    00072
    00073   HttpParser m_parser;
    00074   fd_set m_fds;
    00075 };
    00076 }
    00077
    00078 #endif