Re: [Quickfix-developers] Custom Logon Message
Brought to you by:
orenmnero
From: Scott K. <sc...@la...> - 2010-07-22 14:05:00
|
Actually, I believe cracking works fine, another way to do this would be: void MyApplication::toAdmin(FIX::Message& message, const FIX::SessionID& sessionID) { crack( message, sessionID ); } void MyApplication::onMessage( FIX42::Logon& message, const FIX::SessionID& sessionid ) { message.set(FIX::Username("myusername")); message.set(FIX::Password("mypassword")); } where the MyApplication class extends FIX::Appliaction and FIX::MessageCracker This is how to use crack, but I just realized this specific example won't work because the username and password fields aren't defined for logon messages by default. (at least in FIX42). This would be the other way: http://www.quickfixengine.org/quickfix/doc/html/user_defined.html On Tue, Jul 20, 2010 at 8:33 AM, Kenny Stone <ks...@co...> wrote: > QuickFIX Documentation: > http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html > > > Hi Arup, > > You shouldn't the the 'crack' method call. That is for receiving messages. > > The way I code this would look something like: > > void FixApp::toAdmin(FIX::Message& msg, const FIX::SessionID& sessionID ) > { > FIX::MsgType msgType; > msg.getHeader().getField(msgType); > > // if logon > if( msgType.getValue() == FIX::MsgType_LOGON ) > { > FIX::Password pw( _my_password ); > msg.setField( pw ); > FIX::Username user( _my_username ); > msg.setField( user ); > } > } > > > -- > Kenny Stone > Connamara Systems, LLC > > > On Mon, Jul 19, 2010 at 11:48 PM, Sarkar, Arup <sar...@gm...>wrote: > >> QuickFIX Documentation: >> http://www.quickfixengine.org/quickfix/doc/html/index.html >> QuickFIX Support: http://www.quickfixengine.org/services.html >> >> >> Hi: >> >> I am very new to FIX and QuickFix in c++ engine. I am trying to build a >> custom logon messsage since "Username" and "Password" is required by the >> exchange. I am doing the following, basically overriding the toAdmin method. >> >> >> Can someone please help me in stating if this is correct? >> >> void Application::toAdmin(FIX::Message& message, const FIX::SessionID& >> sessionID) >> { >> std::string sLogon = "A"; >> crack( message, sessionID ); >> std::cout << "In toAdmin" << std::endl; >> std::cout << message << std::endl; >> try >> { >> if(sLogon.compare(message.getHeader().getField(35)) == 0 ) >> { >> std::cout<< " Setting username and password." << std::endl; >> message.getHeader().setField(553, "XXXXXXXXX"); >> message.getHeader().setField(554, "XXXXXXX"); >> } >> } >> catch(FIX::FieldNotFound& eFieldNotFound) >> { >> std::cout<< eFieldNotFound.detail << std::endl; >> } >> } >> >> -- >> Regards, >> Arup >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Sprint >> What will you do first with EVO, the first 4G phone? >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >> _______________________________________________ >> Quickfix-developers mailing list >> Qui...@li... >> https://lists.sourceforge.net/lists/listinfo/quickfix-developers >> > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > |