HttpConnection.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (c) 2001-2014
3 **
4 ** This file is part of the QuickFIX FIX Engine
5 **
6 ** This file may be distributed under the terms of the quickfixengine.org
7 ** license as defined by quickfixengine.org and appearing in the file
8 ** LICENSE included in the packaging of this file.
9 **
10 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 **
13 ** See http://www.quickfixengine.org/LICENSE for licensing information.
14 **
15 ** Contact ask@quickfixengine.org if any conditions of this licensing are
16 ** not clear to you.
17 **
18 ****************************************************************************/
19 
20 #ifdef _MSC_VER
21 #include "stdafx.h"
22 #else
23 #include "config.h"
24 #endif
25 
26 #include "HttpConnection.h"
27 #include "HttpMessage.h"
28 #include "HtmlBuilder.h"
29 #include "Session.h"
30 #include "Utility.h"
31 
32 using namespace HTML;
33 
34 namespace FIX
35 {
36 HttpConnection::HttpConnection( int s )
37 : m_socket( s )
38 {
39  FD_ZERO( &m_fds );
40  FD_SET( m_socket, &m_fds );
41 }
42 
43 bool HttpConnection::send( const std::string& msg )
44 {
45  return socket_send( m_socket, msg.c_str(), msg.length() ) >= 0;
46 }
47 
48 void HttpConnection::disconnect( int error )
49 {
50  if( error > 0 )
52 
54 }
55 
57 {
58  struct timeval timeout = { 2, 0 };
59  fd_set readset = m_fds;
60 
61  try
62  {
63  // Wait for input (1 second timeout)
64  int result = select( 1 + m_socket, &readset, 0, 0, &timeout );
65 
66  if( result > 0 ) // Something to read
67  {
68  // We can read without blocking
69  ssize_t size = socket_recv( m_socket, m_buffer, sizeof(m_buffer) );
70  if ( size <= 0 ) { throw SocketRecvFailed( size ); }
71  m_parser.addToStream( m_buffer, size );
72  }
73  else if( result == 0 ) // Timeout
74  {
75  disconnect( 408 );
76  return false;
77  }
78  else if( result < 0 ) // Error
79  {
80  throw SocketRecvFailed( result );
81  }
82 
83  processStream();
84  return true;
85  }
86  catch ( SocketRecvFailed& )
87  {
88  disconnect();
89  return false;
90  }
91 }
92 
93 bool HttpConnection::readMessage( std::string& msg )
94 throw( SocketRecvFailed )
95 {
96  try
97  {
98  return m_parser.readHttpMessage( msg );
99  }
100  catch ( MessageParseError& )
101  {
102  disconnect( 400 );
103  }
104  return true;
105 }
106 
108 {
109  std::string msg;
110  try
111  {
112  if( !readMessage(msg) )
113  return;
114  HttpMessage request( msg );
115  processRequest( request );
116  }
117  catch( InvalidMessage& )
118  {
119  disconnect( 400 );
120  return;
121  }
122 
123  return;
124 }
125 
127 {
128  int error = 200;
129  std::stringstream h;
130  std::stringstream b;
131  std::string titleString = "QuickFIX Engine Web Interface";
132 
133  { HEAD head(h); head.text();
134  { CENTER center(h); center.text();
135  { TITLE title(h); title.text(titleString); }
136  { H1 h1(h); h1.text(titleString); }
137  }
138  { CENTER center(h); center.text();
139  { A a(h); a.href("/").text("HOME"); }
140  h << NBSP;
141  { A a(h); a.href(request.toString()).text("RELOAD"); }
142  }
143  HR hr(h); hr.text();
144  }
145 
146  BODY body(b); body.text();
147 
148  try
149  {
150  if( request.getRootString() == "/" )
151  processRoot( request, h, b );
152  else if( request.getRootString() == "/resetSessions" )
153  processResetSessions( request, h, b );
154  else if( request.getRootString() == "/refreshSessions" )
155  processRefreshSessions( request, h, b );
156  else if( request.getRootString() == "/enableSessions" )
157  processEnableSessions( request, h, b );
158  else if( request.getRootString() == "/disableSessions" )
159  processDisableSessions( request, h, b );
160  else if( request.getRootString() == "/session" )
161  processSession( request, h, b );
162  else if( request.getRootString() == "/resetSession" )
163  processResetSession( request, h, b );
164  else if( request.getRootString() == "/refreshSession" )
165  processRefreshSession( request, h, b );
166  else
167  error = 404;
168  }
169  catch( std::exception& e )
170  {
171  error = 400;
172  b << e.what();
173  }
174 
175  std::string response = "<HTML>" + h.str() + b.str() + "</HTML>";
176  send( HttpMessage::createResponse(error, error == 200 ? response : "") );
177 
178  disconnect();
179 }
180 
182 ( const HttpMessage& request, std::stringstream& h, std::stringstream& b )
183 {
184  TABLE table(b); table.border(1).cellspacing(2).width(100).text();
185 
186  { CAPTION caption(b); caption.text();
187  EM em(b); em.text();
188  b << Session::numSessions() << " Sessions managed by QuickFIX";
189  { HR hr(b); hr.text(); }
190  { b << NBSP; A a(b); a.href("/resetSessions" + request.getParameterString()).text("RESET"); }
191  { b << NBSP; A a(b); a.href("/refreshSessions" + request.getParameterString()).text("REFRESH"); }
192  { b << NBSP; A a(b); a.href("/enableSessions" + request.getParameterString()).text("ENABLE"); }
193  { b << NBSP; A a(b); a.href("/disableSessions" + request.getParameterString()).text("DISABLE"); }
194  }
195 
196  { TR tr(b); tr.text();
197  { TD td(b); td.align("center").text("Session"); }
198  { TD td(b); td.align("center").text("ConnectionType"); }
199  { TD td(b); td.align("center").text("Enabled"); }
200  { TD td(b); td.align("center").text("Session Time"); }
201  { TD td(b); td.align("center").text("Logged On"); }
202  { TD td(b); td.align("center").text("Next Incoming"); }
203  { TD td(b); td.align("center").text("Next Outgoing"); }
204  }
205 
206  std::set<SessionID> sessions = Session::getSessions();
207  std::set<SessionID>::iterator i;
208  for( i = sessions.begin(); i != sessions.end(); ++i )
209  {
210  Session* pSession = Session::lookupSession( *i );
211  if( !pSession ) continue;
212 
213  { TR tr(b); tr.text();
214  { TD td(b); td.text();
215  std::string href = "/session?BeginString=" + i->getBeginString().getValue() +
216  "&SenderCompID=" + i->getSenderCompID().getValue() +
217  "&TargetCompID=" + i->getTargetCompID().getValue();
218  if( i->getSessionQualifier().size() )
219  href += "&SessionQualifier=" + i->getSessionQualifier();
220 
221  A a(b); a.href(href).text(i->toString());
222  }
223  { TD td(b); td.text(pSession->isInitiator() ? "initiator" : "acceptor"); }
224  { TD td(b); td.text(pSession->isEnabled() ? "yes" : "no"); }
225  { TD td(b); td.text(pSession->isSessionTime(UtcTimeStamp()) ? "yes" : "no"); }
226  { TD td(b); td.text(pSession->isLoggedOn() ? "yes" : "no"); }
227  { TD td(b); td.text(pSession->getExpectedTargetNum()); }
228  { TD td(b); td.text(pSession->getExpectedSenderNum()); }
229  }
230  }
231 }
232 
234 ( const HttpMessage& request, std::stringstream& h, std::stringstream& b )
235 {
236  try
237  {
238  HttpMessage copy = request;
239 
240  bool confirm = false;
241  if( copy.hasParameter("confirm") && copy.getParameter("confirm") != "0" )
242  {
243  confirm = true;
244  std::set<SessionID> sessions = Session::getSessions();
245  std::set<SessionID>::iterator session;
246  for( session = sessions.begin(); session != sessions.end(); ++session )
247  Session::lookupSession( *session )->reset();
248  copy.removeParameter("confirm");
249  }
250 
251  if( confirm )
252  {
253  h << "<META http-equiv='refresh' content=2;URL='" << "/'>";
254  CENTER center(b); center.text();
255  H2 h2(b); h2.text();
256  { A a(b); a.href("/").text("Sessions"); }
257  b << " have been reset";
258  }
259  else
260  {
261  { CENTER center(b); center.text();
262  H2 h2(b); h2.text();
263  b << "Are you sure you want to reset all sessions ?";
264  }
265  { CENTER center(b); center.text();
266  b << "[";
267  { A a(b); a.href(request.toString() + "?confirm=1").text("YES, reset sessions"); }
268  b << "]" << NBSP << "[";
269  { A a(b); a.href("/").text("NO, do not reset sessions"); }
270  b << "]";
271  }
272  }
273  }
274  catch( std::exception& e )
275  {
276  b << e.what();
277  }
278 }
279 
281 ( const HttpMessage& request, std::stringstream& h, std::stringstream& b )
282 {
283  try
284  {
285  HttpMessage copy = request;
286 
287  bool confirm = false;
288  if( copy.hasParameter("confirm") && copy.getParameter("confirm") != "0" )
289  {
290  confirm = true;
291  std::set<SessionID> sessions = Session::getSessions();
292  std::set<SessionID>::iterator session;
293  for( session = sessions.begin(); session != sessions.end(); ++session )
294  Session::lookupSession( *session )->refresh();
295  copy.removeParameter("confirm");
296  }
297 
298  if( confirm )
299  {
300  h << "<META http-equiv='refresh' content=2;URL='" << "/'>";
301  CENTER center(b); center.text();
302  H2 h2(b); h2.text();
303  { A a(b); a.href("/").text("Sessions"); }
304  b << " have been refreshed";
305  }
306  else
307  {
308  { CENTER center(b); center.text();
309  H2 h2(b); h2.text();
310  b << "Are you sure you want to refresh all sessions ?";
311  }
312  { CENTER center(b); center.text();
313  b << "[";
314  { A a(b); a.href(request.toString() + "?confirm=1").text("YES, refresh sessions"); }
315  b << "]" << NBSP << "[";
316  { A a(b); a.href("/").text("NO, do not refresh sessions"); }
317  b << "]";
318  }
319  }
320  }
321  catch( std::exception& e )
322  {
323  b << e.what();
324  }
325 }
326 
328 ( const HttpMessage& request, std::stringstream& h, std::stringstream& b )
329 {
330  try
331  {
332  HttpMessage copy = request;
333 
334  bool confirm = false;
335  if( copy.hasParameter("confirm") && copy.getParameter("confirm") != "0" )
336  {
337  confirm = true;
338  std::set<SessionID> sessions = Session::getSessions();
339  std::set<SessionID>::iterator session;
340  for( session = sessions.begin(); session != sessions.end(); ++session )
341  Session::lookupSession( *session )->logon();
342  copy.removeParameter("confirm");
343  }
344 
345  if( confirm )
346  {
347  h << "<META http-equiv='refresh' content=2;URL='" << "/'>";
348  CENTER center(b); center.text();
349  H2 h2(b); h2.text();
350  { A a(b); a.href("/").text("Sessions"); }
351  b << " have been enabled";
352  }
353  else
354  {
355  { CENTER center(b); center.text();
356  H2 h2(b); h2.text();
357  b << "Are you sure you want to enable all sessions ?";
358  }
359  { CENTER center(b); center.text();
360  b << "[";
361  { A a(b); a.href(request.toString() + "?confirm=1").text("YES, enable sessions"); }
362  b << "]" << NBSP << "[";
363  { A a(b); a.href("/").text("NO, do not enable sessions"); }
364  b << "]";
365  }
366  }
367  }
368  catch( std::exception& e )
369  {
370  b << e.what();
371  }
372 }
373 
375 ( const HttpMessage& request, std::stringstream& h, std::stringstream& b )
376 {
377  try
378  {
379  HttpMessage copy = request;
380 
381  bool confirm = false;
382  if( copy.hasParameter("confirm") && copy.getParameter("confirm") != "0" )
383  {
384  confirm = true;
385  std::set<SessionID> sessions = Session::getSessions();
386  std::set<SessionID>::iterator session;
387  for( session = sessions.begin(); session != sessions.end(); ++session )
388  Session::lookupSession( *session )->logout();
389  copy.removeParameter("confirm");
390  }
391 
392  if( confirm )
393  {
394  h << "<META http-equiv='refresh' content=2;URL='" << "/'>";
395  CENTER center(b); center.text();
396  H2 h2(b); h2.text();
397  { A a(b); a.href("/").text("Sessions"); }
398  b << " have been disabled";
399  }
400  else
401  {
402  { CENTER center(b); center.text();
403  H2 h2(b); h2.text();
404  b << "Are you sure you want to disable all sessions ?";
405  }
406  { CENTER center(b); center.text();
407  b << "[";
408  { A a(b); a.href(request.toString() + "?confirm=1").text("YES, disable sessions"); }
409  b << "]" << NBSP << "[";
410  { A a(b); a.href("/").text("NO, do not disable sessions"); }
411  b << "]";
412  }
413  }
414  }
415  catch( std::exception& e )
416  {
417  b << e.what();
418  }
419 }
420 
422 ( const HttpMessage& request, std::stringstream& h, std::stringstream& b )
423 {
424  try
425  {
426  HttpMessage copy = request;
427  std::string url = request.toString();
428  std::string beginString = copy.getParameter( "BeginString" );
429  std::string senderCompID = copy.getParameter( "SenderCompID" );
430  std::string targetCompID = copy.getParameter( "TargetCompID" );
431  std::string sessionQualifier;
432  if( copy.hasParameter("SessionQualifier") )
433  sessionQualifier = copy.getParameter( "SessionQualifier" );
434 
435  SessionID sessionID( beginString, senderCompID, targetCompID, sessionQualifier );
436  Session* pSession = Session::lookupSession( sessionID );
437  if( pSession == 0 ) throw SessionNotFound();
438 
439  if( copy.hasParameter("Enabled") )
440  {
441  copy.getParameter("Enabled") == "0" ? pSession->logout() : pSession->logon();
442  copy.removeParameter("Enabled");
443  }
444  if( copy.hasParameter("Next%20Incoming") )
445  {
446  int value = IntConvertor::convert( copy.getParameter("Next%20Incoming") );
447  pSession->setNextTargetMsgSeqNum( value <= 0 ? 1 : value );
448  copy.removeParameter("Next%20Incoming");
449  }
450  if( copy.hasParameter("Next%20Outgoing") )
451  {
452  int value = IntConvertor::convert( copy.getParameter("Next%20Outgoing") );
453  pSession->setNextSenderMsgSeqNum( value <= 0 ? 1 : value );
454  copy.removeParameter("Next%20Outgoing");
455  }
457  {
460  }
461  if( copy.hasParameter(CHECK_COMPID) )
462  {
463  pSession->setCheckCompId( copy.getParameter(CHECK_COMPID) != "0" );
465  }
466  if( copy.hasParameter(CHECK_LATENCY) )
467  {
468  pSession->setCheckLatency( copy.getParameter(CHECK_LATENCY) != "0" );
470  }
471  if( copy.hasParameter(MAX_LATENCY) )
472  {
473  int value = IntConvertor::convert( copy.getParameter(MAX_LATENCY) );
474  pSession->setMaxLatency( value <= 0 ? 1 : value );
476  }
477  if( copy.hasParameter(LOGON_TIMEOUT) )
478  {
479  int value = IntConvertor::convert( copy.getParameter(LOGON_TIMEOUT) );
480  pSession->setLogonTimeout( value <= 0 ? 1 : value );
482  }
483  if( copy.hasParameter(LOGOUT_TIMEOUT) )
484  {
486  pSession->setLogoutTimeout( value <= 0 ? 1 : value );
488  }
489  if( copy.hasParameter(RESET_ON_LOGON) )
490  {
491  pSession->setResetOnLogon( copy.getParameter(RESET_ON_LOGON) != "0" );
493  }
494  if( copy.hasParameter(RESET_ON_LOGOUT) )
495  {
496  pSession->setResetOnLogout( copy.getParameter(RESET_ON_LOGOUT) != "0" );
498  }
500  {
501  pSession->setResetOnDisconnect( copy.getParameter(RESET_ON_DISCONNECT) != "0" );
503  }
504  if( copy.hasParameter(REFRESH_ON_LOGON) )
505  {
506  pSession->setRefreshOnLogon( copy.getParameter(REFRESH_ON_LOGON) != "0" );
508  }
510  {
513  }
514  if( copy.hasParameter(PERSIST_MESSAGES) )
515  {
516  pSession->setPersistMessages( copy.getParameter(PERSIST_MESSAGES) != "0" );
518  }
519 
520  if( url != copy.toString() )
521  h << "<META http-equiv='refresh' content=0;URL='" << copy.toString() << "'>";
522 
523  TABLE table(b); table.border(1).cellspacing(2).width(100).text();
524 
525  { CAPTION caption(b); caption.text();
526  EM em(b); em.text();
527  b << sessionID;
528  { HR hr(b); hr.text(); }
529  { b << NBSP; A a(b); a.href("/resetSession" + copy.getParameterString()).text("RESET"); }
530  { b << NBSP; A a(b); a.href("/refreshSession" + copy.getParameterString()).text("REFRESH"); }
531  }
532 
533  showRow( b, "Enabled", pSession->isEnabled(), url );
534  showRow( b, "ConnectionType", std::string(pSession->isInitiator() ?"initiator" : "acceptor") );
535  showRow( b, "SessionTime", pSession->isSessionTime(UtcTimeStamp()) );
536  showRow( b, "Logged On", pSession->isLoggedOn() );
537  showRow( b, "Next Incoming", (int)pSession->getExpectedTargetNum(), url );
538  showRow( b, "Next Outgoing", (int)pSession->getExpectedSenderNum(), url );
539  showRow( b, SEND_REDUNDANT_RESENDREQUESTS, pSession->getSendRedundantResendRequests(), url );
540  showRow( b, CHECK_COMPID, pSession->getCheckCompId(), url );
541  showRow( b, CHECK_LATENCY, pSession->getCheckLatency(), url );
542  showRow( b, MAX_LATENCY, pSession->getMaxLatency(), url );
543  showRow( b, LOGON_TIMEOUT, pSession->getLogonTimeout(), url );
544  showRow( b, LOGOUT_TIMEOUT, pSession->getLogoutTimeout(), url );
545  showRow( b, RESET_ON_LOGON, pSession->getResetOnLogon(), url );
546  showRow( b, RESET_ON_LOGOUT, pSession->getResetOnLogout(), url );
547  showRow( b, RESET_ON_DISCONNECT, pSession->getResetOnDisconnect(), url );
548  showRow( b, REFRESH_ON_LOGON, pSession->getRefreshOnLogon(), url );
549  showRow( b, MILLISECONDS_IN_TIMESTAMP, pSession->getMillisecondsInTimeStamp(), url );
550  showRow( b, PERSIST_MESSAGES, pSession->getPersistMessages(), url );
551  }
552  catch( std::exception& e )
553  {
554  b << e.what();
555  }
556 }
557 
559 ( const HttpMessage& request, std::stringstream& h, std::stringstream& b )
560 {
561  try
562  {
563  HttpMessage copy = request;
564  std::string beginString = request.getParameter( "BeginString" );
565  std::string senderCompID = request.getParameter( "SenderCompID" );
566  std::string targetCompID = request.getParameter( "TargetCompID" );
567  std::string sessionQualifier;
568  if( copy.hasParameter("SessionQualifier") )
569  sessionQualifier = copy.getParameter( "SessionQualifier" );
570 
571  SessionID sessionID( beginString, senderCompID, targetCompID, sessionQualifier );
572  Session* pSession = Session::lookupSession( sessionID );
573  if( pSession == 0 ) throw SessionNotFound();
574 
575  std::string sessionUrl = "/session" + request.getParameterString();
576 
577  bool confirm = false;
578  if( copy.hasParameter("confirm") && copy.getParameter("confirm") != "0" )
579  {
580  confirm = true;
581  pSession->reset();
582  copy.removeParameter("confirm");
583  }
584 
585  if( confirm )
586  {
587  h << "<META http-equiv='refresh' content=2;URL='" << "/session" << copy.getParameterString() << "'>";
588  CENTER center(b); center.text();
589  H2 h2(b); h2.text();
590  { A a(b); a.href("/session" + copy.getParameterString()).text(sessionID.toString()); }
591  b << " has been reset";
592  }
593  else
594  {
595  { CENTER center(b); center.text();
596  H2 h2(b); h2.text();
597  b << "Are you sure you want to reset session ";
598  { A a(b); a.href(sessionUrl + request.getParameterString()).text(sessionID.toString()); }
599  b << "?";
600  }
601  { CENTER center(b); center.text();
602  b << "[";
603  { A a(b); a.href(request.toString() + "&confirm=1").text("YES, reset session"); }
604  b << "]" << NBSP << "[";
605  { A a(b); a.href(sessionUrl).text("NO, do not reset session"); }
606  b << "]";
607  }
608  }
609  }
610  catch( std::exception& e )
611  {
612  b << e.what();
613  }
614 }
615 
617 ( const HttpMessage& request, std::stringstream& h, std::stringstream& b )
618 {
619  try
620  {
621  HttpMessage copy = request;
622  std::string beginString = request.getParameter( "BeginString" );
623  std::string senderCompID = request.getParameter( "SenderCompID" );
624  std::string targetCompID = request.getParameter( "TargetCompID" );
625  std::string sessionQualifier;
626  if( copy.hasParameter("SessionQualifier") )
627  sessionQualifier = copy.getParameter( "SessionQualifier" );
628 
629  SessionID sessionID( beginString, senderCompID, targetCompID, sessionQualifier );
630  Session* pSession = Session::lookupSession( sessionID );
631  if( pSession == 0 ) throw SessionNotFound();
632 
633  std::string sessionUrl = "/session" + request.getParameterString();
634 
635  bool confirm = false;
636  if( copy.hasParameter("confirm") && copy.getParameter("confirm") != "0" )
637  {
638  confirm = true;
639  pSession->refresh();
640  copy.removeParameter("confirm");
641  }
642 
643  if( confirm )
644  {
645  h << "<META http-equiv='refresh' content=2;URL='" << "/session" << copy.getParameterString() << "'>";
646  CENTER center(b); center.text();
647  H2 h2(b); h2.text();
648  { A a(b); a.href("/session" + copy.getParameterString()).text(sessionID.toString()); }
649  b << " has been refreshed";
650  }
651  else
652  {
653  { CENTER center(b); center.text();
654  H2 h2(b); h2.text();
655  b << "Are you sure you want to refresh session ";
656  { A a(b); a.href(sessionUrl + request.getParameterString()).text(sessionID.toString()); }
657  b << "?";
658  }
659  { CENTER center(b); center.text();
660  b << "[";
661  { A a(b); a.href(request.toString() + "&confirm=1").text("YES, refresh session"); }
662  b << "]" << NBSP << "[";
663  { A a(b); a.href(sessionUrl).text("NO, do not refresh session"); }
664  b << "]";
665  }
666  }
667  }
668  catch( std::exception& e )
669  {
670  b << e.what();
671  }
672 }
673 
675 ( std::stringstream& s, const std::string& name, bool value, const std::string& url )
676 {
677  { TR tr(s); tr.text();
678  { TD td(s); td.text(name); }
679  { TD td(s); td.text(value ? "yes" : "no"); }
680  { TD td(s); td.text();
681  CENTER center(s); center.text();
682  if( url.size() )
683  {
684  std::stringstream href;
685  href << url << "&" << name << "=" << !value;
686  A a(s); a.href(href.str()).text("toggle");
687  }
688  }
689  }
690 }
691 
693 ( std::stringstream& s, const std::string& name, const std::string& value, const std::string& url )
694 {
695  { TR tr(s); tr.text();
696  { TD td(s); td.text(name); }
697  { TD td(s); td.text(value); }
698  { TD td(s); td.text();
699  CENTER center(s); center.text();
700  }
701  }
702 }
703 
705 ( std::stringstream& s, const std::string& name, int value, const std::string& url )
706 {
707  { TR tr(s); tr.text();
708  { TD td(s); td.text(name); }
709  { TD td(s); td.text(value); }
710  { TD td(s); td.text();
711  CENTER center(s); center.text();
712  {
713  std::stringstream href;
714  href << url << "&" << name << "=" << value - 10;
715  A a(s); a.href(href.str()).text("<<");
716  }
717  s << NBSP;
718  {
719  std::stringstream href;
720  href << url << "&" << name << "=" << value - 1;
721  A a(s); a.href(href.str()).text("<");
722  }
723  s << NBSP << "|" << NBSP;
724  {
725  std::stringstream href;
726  href << url << "&" << name << "=" << value + 1;
727  A a(s); a.href(href.str()).text(">");
728  }
729  s << NBSP;
730  {
731  std::stringstream href;
732  href << url << "&" << name << "=" << value + 10;
733  A a(s); a.href(href.str()).text(">>");
734  }
735  }
736  }
737 }
738 
739 } // namespace FIX
HTML::TR
Definition: HtmlBuilder.h:195
FIX::RESET_ON_LOGOUT
const char RESET_ON_LOGOUT[]
Definition: SessionSettings.h:143
FIX::RESET_ON_LOGON
const char RESET_ON_LOGON[]
Definition: SessionSettings.h:142
FIX::LOGOUT_TIMEOUT
const char LOGOUT_TIMEOUT[]
Definition: SessionSettings.h:96
FIX::LOGON_TIMEOUT
const char LOGON_TIMEOUT[]
Definition: SessionSettings.h:95
FIX::Session::setMaxLatency
void setMaxLatency(int value)
Definition: Session.h:183
FIX::HttpConnection::processRefreshSessions
void processRefreshSessions(const HttpMessage &, std::stringstream &h, std::stringstream &b)
Definition: HttpConnection.cpp:281
FIX::Session::lookupSession
static Session * lookupSession(const SessionID &)
Definition: Session.cpp:1513
HTML::HR
Definition: HtmlBuilder.h:155
FIX::Session::getCheckCompId
bool getCheckCompId()
Definition: Session.h:171
FIX::HttpConnection::send
bool send(const std::string &)
Definition: HttpConnection.cpp:43
FIX::HttpMessage::createResponse
static std::string createResponse(int error=0, const std::string &text="")
Definition: HttpMessage.cpp:103
HTML::NBSP
const char * NBSP
Definition: HtmlBuilder.h:162
FIX::UtcTimeStamp
Date and Time represented in UTC.
Definition: FieldTypes.h:599
FIX::Session::getExpectedTargetNum
int getExpectedTargetNum()
Definition: Session.h:259
HTML::TAG::text
TAG & text()
Definition: HtmlBuilder.h:82
FIX::PERSIST_MESSAGES
const char PERSIST_MESSAGES[]
Definition: SessionSettings.h:149
HTML::TABLE::border
TABLE & border(int value)
Definition: HtmlBuilder.h:170
HTML::HEAD
Definition: HtmlBuilder.h:148
FIX::Session::setNextTargetMsgSeqNum
void setNextTargetMsgSeqNum(int num)
Definition: Session.h:106
FIX::HttpConnection::processResetSession
void processResetSession(const HttpMessage &, std::stringstream &h, std::stringstream &b)
Definition: HttpConnection.cpp:559
HTML::A::href
A & href(const std::string &value)
Definition: HtmlBuilder.h:95
FIX::Session::getPersistMessages
bool getPersistMessages()
Definition: Session.h:234
FIX::Session::reset
void reset()
Definition: Session.h:100
FIX::Session::getLogoutTimeout
int getLogoutTimeout()
Definition: Session.h:191
FIX::Session::refresh
void refresh()
Definition: Session.h:102
FIX::Session::getSendRedundantResendRequests
bool getSendRedundantResendRequests()
Definition: Session.h:166
FIX::Session::setResetOnLogout
void setResetOnLogout(bool value)
Definition: Session.h:203
FIX::Session::isSessionTime
bool isSessionTime(const UtcTimeStamp &time)
Definition: Session.h:142
HTML::TABLE::cellspacing
TABLE & cellspacing(int value)
Definition: HtmlBuilder.h:172
HTML::H2
Definition: HtmlBuilder.h:141
FIX::Session::getMillisecondsInTimeStamp
bool getMillisecondsInTimeStamp()
Definition: Session.h:216
FIX::Session::getSessions
static std::set< SessionID > getSessions()
Definition: Session.cpp:1502
FIX::HttpMessage::removeParameter
void removeParameter(const std::string &key)
Definition: HttpMessage.h:145
FIX::Session::numSessions
static size_t numSessions()
Definition: Session.cpp:1570
FIX::CHECK_LATENCY
const char CHECK_LATENCY[]
Definition: SessionSettings.h:76
FIX::SessionID
Unique session id consists of BeginString, SenderCompID and TargetCompID.
Definition: SessionID.h:47
FIX::Session::setCheckLatency
void setCheckLatency(bool value)
Definition: Session.h:178
FIX::socket_recv
ssize_t socket_recv(int s, char *buf, size_t length)
Definition: Utility.cpp:187
FIX::HttpMessage
HTTP Message that implemented GET functionality.
Definition: HttpMessage.h:54
HttpConnection.h
FIX::HttpConnection::processSession
void processSession(const HttpMessage &, std::stringstream &h, std::stringstream &b)
Definition: HttpConnection.cpp:422
FIX::SEND_REDUNDANT_RESENDREQUESTS
const char SEND_REDUNDANT_RESENDREQUESTS[]
Definition: SessionSettings.h:62
FIX::IntConvertor::convert
static std::string convert(signed_int value)
Definition: FieldConvertors.h:170
FIX::HttpConnection::m_parser
HttpParser m_parser
Definition: HttpConnection.h:90
HTML::H1
Definition: HtmlBuilder.h:134
FIX::HttpConnection::showRow
void showRow(std::stringstream &s, const std::string &name, bool value, const std::string &url="")
Definition: HttpConnection.cpp:675
FIX::MAX_LATENCY
const char MAX_LATENCY[]
Definition: SessionSettings.h:77
FIX::HttpConnection::processEnableSessions
void processEnableSessions(const HttpMessage &, std::stringstream &h, std::stringstream &b)
Definition: HttpConnection.cpp:328
FIX::Session::setResetOnDisconnect
void setResetOnDisconnect(bool value)
Definition: Session.h:208
HTML
Definition: HtmlBuilder.h:31
FIX::MILLISECONDS_IN_TIMESTAMP
const char MILLISECONDS_IN_TIMESTAMP[]
Definition: SessionSettings.h:146
HTML::TABLE::width
TABLE & width(int value)
Definition: HtmlBuilder.h:174
FIX::HttpConnection::processStream
void processStream()
Definition: HttpConnection.cpp:107
FIX::socket_send
ssize_t socket_send(int s, const char *msg, size_t length)
Definition: Utility.cpp:192
FIX::Session::getRefreshOnLogon
bool getRefreshOnLogon()
Definition: Session.h:211
FIX::HttpConnection::processRefreshSession
void processRefreshSession(const HttpMessage &, std::stringstream &h, std::stringstream &b)
Definition: HttpConnection.cpp:617
FIX::HttpMessage::getParameterString
const std::string getParameterString() const
Definition: HttpMessage.h:110
FIX::HttpConnection::read
bool read()
Definition: HttpConnection.cpp:56
FIX::Session::setLogoutTimeout
void setLogoutTimeout(int value)
Definition: Session.h:193
HTML::CENTER
Definition: HtmlBuilder.h:120
FIX::Session::getMaxLatency
int getMaxLatency()
Definition: Session.h:181
FIX::Session::isLoggedOn
bool isLoggedOn()
Definition: Session.h:99
FIX::Session::setPersistMessages
void setPersistMessages(bool value)
Definition: Session.h:236
FIX::Session::getLogonTimeout
int getLogonTimeout()
Definition: Session.h:186
FIX::HttpMessage::getParameter
const std::string & getParameter(const std::string &key) const
Definition: HttpMessage.h:131
FIX::HttpConnection::processDisableSessions
void processDisableSessions(const HttpMessage &, std::stringstream &h, std::stringstream &b)
Definition: HttpConnection.cpp:375
FIX::SessionNotFound
Session cannot be found for specified action.
Definition: Exceptions.h:248
FIX::HttpConnection::processResetSessions
void processResetSessions(const HttpMessage &, std::stringstream &h, std::stringstream &b)
Definition: HttpConnection.cpp:234
FIX::Session::isInitiator
bool isInitiator()
Definition: Session.h:146
FIX::HttpConnection::m_buffer
char m_buffer[BUFSIZ]
Definition: HttpConnection.h:88
HTML::EM
Definition: HtmlBuilder.h:127
FIX::Session::getExpectedSenderNum
int getExpectedSenderNum()
Definition: Session.h:258
FIX::Session::isEnabled
bool isEnabled()
Definition: Session.h:93
HTML::TD
Definition: HtmlBuilder.h:178
HTML::BODY
Definition: HtmlBuilder.h:99
FIX
Definition: Acceptor.cpp:34
FIX::HttpConnection::m_socket
int m_socket
Definition: HttpConnection.h:87
FIX::CHECK_COMPID
const char CHECK_COMPID[]
Definition: SessionSettings.h:75
FIX::MessageParseError
Unable to parse message.
Definition: Exceptions.h:90
FIX::HttpMessage::toString
std::string toString() const
Get a string representation of the message.
Definition: HttpMessage.cpp:59
FIX::HttpConnection::readMessage
bool readMessage(std::string &msg)
Definition: HttpConnection.cpp:93
FIX::Session::setResetOnLogon
void setResetOnLogon(bool value)
Definition: Session.h:198
FIX::REFRESH_ON_LOGON
const char REFRESH_ON_LOGON[]
Definition: SessionSettings.h:145
FIX::Session::setNextSenderMsgSeqNum
void setNextSenderMsgSeqNum(int num)
Definition: Session.h:104
Session.h
FIX::socket_close
void socket_close(int s)
Definition: Utility.cpp:197
FIX::SessionID::toString
std::string toString() const
Get a string representation of the SessionID.
Definition: SessionID.h:99
FIX::RESET_ON_DISCONNECT
const char RESET_ON_DISCONNECT[]
Definition: SessionSettings.h:144
FIX::HttpMessage::hasParameter
bool hasParameter(const std::string &key) const
Definition: HttpMessage.h:125
FIX::Session::getResetOnDisconnect
bool getResetOnDisconnect()
Definition: Session.h:206
FIX::Session::logon
void logon()
Definition: Session.h:89
FIX::Session::setCheckCompId
void setCheckCompId(bool value)
Definition: Session.h:173
FIX::Session::setMillisecondsInTimeStamp
void setMillisecondsInTimeStamp(bool value)
Definition: Session.h:218
HTML::CAPTION
Definition: HtmlBuilder.h:113
FIX::HttpConnection::processRoot
void processRoot(const HttpMessage &, std::stringstream &h, std::stringstream &b)
Definition: HttpConnection.cpp:182
FIX::SocketRecvFailed
Socket recv operation failed.
Definition: Exceptions.h:295
FIX::HttpConnection::processRequest
void processRequest(const HttpMessage &)
Definition: HttpConnection.cpp:126
FIX::Session::logout
void logout(const std::string &reason="")
Definition: Session.h:91
FIX::InvalidMessage
Not a recognizable message.
Definition: Exceptions.h:97
FIX::HttpConnection::disconnect
void disconnect(int error=0)
Definition: HttpConnection.cpp:48
HtmlBuilder.h
HTML::TITLE
Definition: HtmlBuilder.h:188
HTML::A
Definition: HtmlBuilder.h:89
HttpMessage.h
FIX::Session::setRefreshOnLogon
void setRefreshOnLogon(bool value)
Definition: Session.h:213
FIX::Session::setSendRedundantResendRequests
void setSendRedundantResendRequests(bool value)
Definition: Session.h:168
FIX::HttpConnection::m_fds
fd_set m_fds
Definition: HttpConnection.h:91
Utility.h
FIX::HttpMessage::getRootString
const std::string & getRootString() const
Definition: HttpMessage.h:107
FIX::Session::getCheckLatency
bool getCheckLatency()
Definition: Session.h:176
FIX::HttpParser::addToStream
void addToStream(const char *str, size_t len)
Definition: HttpParser.h:79
FIX::Session::getResetOnLogout
bool getResetOnLogout()
Definition: Session.h:201
HTML::TD::align
TD & align(const std::string &value)
Definition: HtmlBuilder.h:184
FIX::Session::setLogonTimeout
void setLogonTimeout(int value)
Definition: Session.h:188
FIX::Session
Maintains the state and implements the logic of a FIX session.
Definition: Session.h:62
HTML::TABLE
Definition: HtmlBuilder.h:164
FIX::Session::getResetOnLogon
bool getResetOnLogon()
Definition: Session.h:196

Generated on Wed Apr 29 2020 19:41:30 for QuickFIX by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2001