コード例 #1
0
void processCommandLineOptions( int argc, char* argv[] )
{
	int iargs = 1;
	authenticationToken.clear();
	newauthenticationToken.clear();
	authenticationExtended.clear();

	while ( iargs < argc )
	{
		if ( 0 == strcmp( "-?", argv[iargs] ) )
		{
			printUsage();
		}
		else if ( strcmp( "-at", argv[iargs] ) == 0 )
		{
			++iargs; if ( iargs == argc ) printUsage();

			authenticationToken.set(argv[iargs++]);
		}
		else if ( strcmp( "-newat", argv[iargs] ) == 0 )
		{
			++iargs; if ( iargs == argc ) printUsage();

			newauthenticationToken.set(argv[iargs++]);
		}
		else if ( strcmp( "-aid", argv[iargs] ) == 0 )
		{
			++iargs; if ( iargs == argc ) printUsage();

			appId.set(argv[iargs++]);
		}
		else if (strcmp("-ax", argv[iargs]) == 0)
		{
			++iargs; if (iargs == argc) printUsage();

			authenticationExtended.set(argv[iargs++]);
		}
		else
		{
			cout << "Invalid argument: " << argv[iargs] << endl;

			printUsage();
		}

		if (authenticationToken.empty())
		{
			cout << "Missing Authentication Token." << endl;

			printUsage();
		}
	}
}
コード例 #2
0
ファイル: Consumer.cpp プロジェクト: HaroldWoods/Elektron-SDK
int main( int argc, char* argv[] )
{
	try { 
		AppClient client;
		OmmConsumer consumer( OmmConsumerConfig().host( "localhost:14002" ).username( "user" ) );
		ReqMsg reqMsg;
		EmaString itemName;
		for ( UInt32 idx = 0; idx < 1000; ++idx )
		{
			itemName.set( "RTR", 3 ).append( idx ).append( ".N" );
			reqMsg.serviceName( "DIRECT_FEED" ).name( itemName );
			consumer.registerClient( reqMsg, client );
			reqMsg.clear();
		}
		for ( UInt32 idx = 0; idx < 300; ++idx )
		{
			sleep( 1000 );
			cout << "total refresh count: " << refreshCount << "\ttotal status count: " << statusCount << "\tupdate rate (per sec): " << updateCount << endl;
			updateCount = 0;
		}
	} catch ( const OmmException& excp ) {
		cout << excp << endl;
	}
	return 0;
}
コード例 #3
0
ファイル: AckMsg.cpp プロジェクト: n1msr/Elektron-SDK
const EmaString& getNCodeAsString( UInt16 nCode )
{
	switch ( nCode )
	{
	case AckMsg::NoneEnum :
		return NoneString;
	case AckMsg::AccessDeniedEnum:
		return AccessDeniedString;
	case AckMsg::DeniedBySourceEnum:
		return DeniedBySourceString;
	case AckMsg::SourceDownEnum:
		return SourceDownString;
	case AckMsg::SourceUnknownEnum:
		return SourceUnknownString;
	case AckMsg::NoResourcesEnum:
		return NoResourcesString;
	case AckMsg::NoResponseEnum:
		return NoResponseString;
	case AckMsg::GatewayDownEnum :
		return GatewayDownString;
	case AckMsg::SymbolUnknownEnum:
		return SymbolUnknownString;
	case AckMsg::NotOpenEnum:
		return NotOpenString;
	case AckMsg::InvalidContentEnum :
		return InvalidContentString;
	default :
		return TempNCString.set( "Unknown NackCode value " ).append( nCode );
	}
}
コード例 #4
0
DataDictionaryImpl::FieldNameToIdHash* DataDictionaryImpl::fieldNameToIdMap() const
{
	if ( _loadedFieldDictionary )
	{
		if ( _pfieldNameToIdHash == 0 )
		{
			_pfieldNameToIdHash = new FieldNameToIdHash(_pRsslDataDictionary->numberOfEntries);
		}

		if ( _pfieldNameToIdHash->empty() )
		{
			RsslDictionaryEntry* rsslDictionaryEntry = 0;
			EmaString fieldName;

			for (Int32 index = _pRsslDataDictionary->minFid; index <= _pRsslDataDictionary->maxFid; index++)
			{
				rsslDictionaryEntry = *(_pRsslDataDictionary->entriesArray + index);

				if (rsslDictionaryEntry)
				{
					fieldName.set(rsslDictionaryEntry->acronym.data, rsslDictionaryEntry->acronym.length);
					_pfieldNameToIdHash->insert(fieldName, rsslDictionaryEntry->fid);
				}
			}
		}
	}

	return _pfieldNameToIdHash;
}
コード例 #5
0
ファイル: OmmError.cpp プロジェクト: HaroldWoods/Elektron-SDK
const EmaString& OmmError::getErrorCodeAsString() const
{
	switch ( getErrorCode() )
	{
	case NoErrorEnum :
		return NoErrorString;
	case NoDictionaryEnum :
		return NoDictionaryString;
	case FieldIdNotFoundEnum :
		return FieldIdNotFoundString;
	case IteratorOverrunEnum :
		return IteratorOverrunString;
	case IteratorSetFailureEnum :
		return IteratorSetFailureString;
	case IncompleteDataEnum :
		return IncompleteDataString;
	case NoSetDefinitionEnum :
		return NoSetDefinitionString;
	case UnsupportedDataTypeEnum :
		return UnsupportedDataTypeString;
	case UnknownErrorEnum :
		return UnknownErrorString;
	default :
		return TempErrorCodeString.set( "Unrecognized ErrorCode value " ).append( (Int64)getErrorCode() );
	}
}
コード例 #6
0
ファイル: Data.cpp プロジェクト: HaroldWoods/Elektron-SDK
const EmaString& Data::getCodeAsString() const
{
	switch ( getCode() )
	{
	case NoCodeEnum :
		return NoCodeString;
	case BlankEnum :
		return BlankString;
	default :
		return TempDCString.set( "Unknown DataCode value " ).append( (Int64)getCode() );
	}
}
コード例 #7
0
ファイル: OmmQos.cpp プロジェクト: HaroldWoods/Elektron-SDK
const EmaString& OmmQos::getTimelinessAsString() const
{
	switch ( getTimeliness() )
	{
	case RealTimeEnum :
		return RealTimeTimelinessName;
	case InexactDelayedEnum :
		return InexactDelayedTimelinessName;
	default :
		return UnknownQosTimelinessName.set( "Timeliness: " ).append( (UInt64)getTimeliness() );
	}
}
コード例 #8
0
ファイル: OmmQos.cpp プロジェクト: HaroldWoods/Elektron-SDK
const EmaString& OmmQos::getRateAsString() const
{
	switch ( getRate() )
	{
	case TickByTickEnum :
		return TickByTickRateName;
	case JustInTimeConflatedEnum :
		return JustInTimeConflatedRateName;
	default :
		return UnknownQosRateName.set( "Rate: " ).append( (UInt64)getRate() );
	}
}
コード例 #9
0
const EmaString& getFActionAsString( FilterEntry::FilterAction action )
{
	switch ( action )
	{
	case FilterEntry::SetEnum :
		return SetString;
	case FilterEntry::UpdateEnum :
		return UpdateString;
	case FilterEntry::ClearEnum :
		return ClearString;
	default :
		{
			TempFAString.set( "Unknown FilterAction value " );
			TempFAString.append( (Int64)action );
		}
		return TempFAString;
	}
}
コード例 #10
0
const EmaString& getVActionAsString( VectorEntry::VectorAction vAction )
{
	switch ( vAction )
	{
	case VectorEntry::SetEnum :
		return SetString;
	case VectorEntry::UpdateEnum :
		return UpdateString;
	case VectorEntry::ClearEnum:
		return ClearString;
	case VectorEntry::InsertEnum:
		return InsertString;
	case VectorEntry::DeleteEnum :
		return DeleteString;
	default :
		return TempVAString.set( "Unknown VectorAction value " ).append( (Int64)vAction );
	}
}
コード例 #11
0
ファイル: EmaString.cpp プロジェクト: MandalaLab/Elektron-SDK
EmaString EmaString::substr ( UInt32 index, UInt32 length ) const
{
    if ( length != EmaString::npos &&
            ( index > _length ||
              index + length > _length )
       )
    {
        EmaString text ( "Attempt to access out of range position in EmaString::substr( UInt32 , UInt32 ) const. Passed in index is " );
        text.append ( index ).append ( " and passed in length is " ).append ( length ).append ( " while length is " ).append ( _length ).append ( "." );
        throwOorException ( text );
        return EmaString();
    }

    EmaString retVal;

    retVal.set ( _pString + index, length );

    return retVal;
}
コード例 #12
0
int main( int argc, char* argv[] )
{ 
	try { 
		AppClient client;
		Map configDb;
		OmmConsumerConfig config;
		ServiceEndpointDiscovery serviceDiscovery;

		for ( int i = 1; i < argc; i++ )
		{
			if ( strcmp( argv[i], "-?" ) == 0 )
			{
				printHelp();
				return false;
			}
			else if ( strcmp( argv[i], "-username" ) == 0 )
			{
				if ( i < ( argc - 1 ) ) userName.set( argv[++i] );
			}
			else if ( strcmp( argv[i] , "-password" ) == 0 )
			{
				if ( i < ( argc - 1 ) ) password.set( argv[++i] );
			}
			else if ( strcmp( argv[i], "-location" ) == 0 )
			{
				if ( i < ( argc - 1) ) location.set( argv[++i] );
			}
			else if ( strcmp( argv[i], "-clientId" ) == 0 )
			{
				if ( i < ( argc - 1 ) ) clientId.set( argv[++i] );
			}
			else if ( strcmp( argv[i], "-ph" ) == 0 )
			{
				if ( i < ( argc - 1 ) ) proxyHostName.set( argv[++i] );
			}
			else if ( strcmp( argv[i], "-pp") == 0 )
			{
				if ( i < ( argc - 1 ) ) proxyPort.set( argv[++i] );
			}
			else if ( strcmp( argv[i], "-plogin" ) == 0 )
			{
				if ( i < ( argc - 1 ) ) proxyUserName.set( argv[++i] );
			}
			else if ( strcmp( argv[i], "-ppasswd" ) == 0 )
			{
				if ( i < ( argc - 1 ) ) proxyPasswd.set( argv[++i] );
			}
			else if (strcmp(argv[i], "-pdomain" ) == 0)
			{
				if ( i < ( argc - 1 ) ) proxyDomain.set( argv[++i] );
			}
		}

		if ( !userName.length() || !password.length() )
		{
			cout << "Both username and password must be specified on the command line. Exiting...";
			printHelp();
			return -1;
		}

		// Query endpoints from EDP-RT service discovery for the TCP protocol
		serviceDiscovery.registerClient( ServiceEndpointDiscoveryOption().username( userName ).password( password )
			.clientId( clientId ).transprot( ServiceEndpointDiscoveryOption::TcpEnum )
			.proxyHostName( proxyHostName ).proxyPort( proxyPort ).proxyUserName( proxyUserName ).proxyPassword( proxyPasswd )
			.proxyDomain( proxyDomain ), client );

		if ( !host.length() || !port.length() )
		{
			cout << "Both hostname and port are not avaiable for establishing a connection with ERT in cloud. Exiting..." << endl;
			return -1;
		}

		createProgramaticConfig( configDb );

		OmmConsumer consumer( OmmConsumerConfig().consumerName( "Consumer_1" ).username( userName ).password( password )
			.clientId( clientId ).config( configDb ).tunnelingProxyHostName( proxyHostName ).tunnelingProxyPort( proxyPort )
			.proxyUserName( proxyUserName ).proxyPasswd( proxyPasswd ).proxyDomain( proxyDomain ) );

		consumer.registerClient( ReqMsg().serviceName( "ELEKTRON_DD" ).name( "IBM.N" ), client );
		sleep( 900000 );			// API calls onRefreshMsg(), onUpdateMsg(), or onStatusMsg()
	} catch ( const OmmException& excp ) {
		cout << excp << endl;
	}

	return 0;
}
コード例 #13
0
ファイル: Data.cpp プロジェクト: HaroldWoods/Elektron-SDK
const EmaString& getDTypeAsString( DataType::DataTypeEnum dType )
{
	switch ( dType )
	{
	case DataType::ReqMsgEnum :
		return ReqMsgString;
	case DataType::RefreshMsgEnum :
		return RefreshMsgString;
	case DataType::StatusMsgEnum :
		return StatusMsgString;
	case DataType::UpdateMsgEnum :
		return UpdateMsgString;
	case DataType::PostMsgEnum :
		return PostMsgString;
	case DataType::AckMsgEnum :
		return AckMsgString;
	case DataType::GenericMsgEnum :
		return GenericMsgString;
	case DataType::FieldListEnum :
		return FieldListString;
	case DataType::ElementListEnum :
		return ElementListString;
	case DataType::MapEnum :
		return MapString;
	case DataType::VectorEnum :
		return VectorString;
	case DataType::SeriesEnum :
		return SeriesString;
	case DataType::FilterListEnum :
		return FilterListString;
	case DataType::OpaqueEnum :
		return OpaqueString;
	case DataType::XmlEnum :
		return XmlString;
	case DataType::AnsiPageEnum :
		return AnsiPageString;
	case DataType::ArrayEnum :
		return OmmArrayString;
	case DataType::IntEnum :
		return IntString;
	case DataType::UIntEnum :
		return UIntString;
	case DataType::RealEnum :
		return RealString;
	case DataType::FloatEnum :
		return FloatString;
	case DataType::DoubleEnum :
		return DoubleString;
	case DataType::DateEnum :
		return DateString;
	case DataType::TimeEnum :
		return TimeString;
	case DataType::DateTimeEnum :
		return DateTimeString;
	case DataType::QosEnum :
		return QosString;
	case DataType::StateEnum :
		return StateString;
	case DataType::EnumEnum :
		return EnumString;
	case DataType::BufferEnum :
		return BufferString;
	case DataType::AsciiEnum :
		return AsciiString;
	case DataType::Utf8Enum :
		return Utf8String;
	case DataType::RmtesEnum :
		return RmtesString;
	case DataType::NoDataEnum :
		return NoDataString;
	case DataType::ErrorEnum :
		return ErrorString;
	default :
		return TempDTString.set( "Unknown DataType value " ).append( (UInt64)dType );
	}
}
コード例 #14
0
void  ChannelCallbackClient::channelParametersToString (ChannelConfig *pChannelCfg, EmaString& strChannelParams)
{
	bool bValidChType = true;
	EmaString strConnectionType;
	EmaString cfgParameters;
	EmaString compType;
	switch ( pChannelCfg->compressionType )
	{
	case RSSL_COMP_ZLIB :
		compType.set( "ZLib" );
		break;
	case RSSL_COMP_LZ4 :
		compType.set( "LZ4" );
		break;
	case RSSL_COMP_NONE :
		compType.set( "None" );
		break;
	default :
		compType.set( "Unknown Compression Type" );
		break;
	}
	switch(pChannelCfg->connectionType)
	{
		case RSSL_CONN_TYPE_SOCKET:
		{
			SocketChannelConfig  *pTempChannelCfg = static_cast<SocketChannelConfig*> (pChannelCfg);
			strConnectionType = "RSSL_CONN_TYPE_SOCKET";
			cfgParameters.append( "hostName " ).append( pTempChannelCfg->hostName ).append( CR )
				.append( "port " ).append( pTempChannelCfg->serviceName ).append( CR )
				.append( "CompressionType " ).append( compType ).append( CR )
				.append( "tcpNodelay " ).append( (pTempChannelCfg->tcpNodelay ? "true" : "false" ) ).append( CR );
			break;
		}
		case RSSL_CONN_TYPE_HTTP:
		{
			HttpChannelConfig  *pTempChannelCfg = static_cast<HttpChannelConfig*> (pChannelCfg);
			strConnectionType = "RSSL_CONN_TYPE_HTTP";
			cfgParameters.append( "hostName " ).append( pTempChannelCfg->hostName ).append( CR )
				.append( "port " ).append( pTempChannelCfg->serviceName ).append( CR )
				.append( "CompressionType " ).append( compType ).append( CR )
				.append( "tcpNodelay " ).append( (pTempChannelCfg->tcpNodelay ? "true" : "false" ) ).append( CR )
				.append("ObjectName ").append(pTempChannelCfg->objectName).append( CR );
			break;
		}
		case RSSL_CONN_TYPE_ENCRYPTED:
		{
			EncryptedChannelConfig  *pTempChannelCfg = static_cast<EncryptedChannelConfig*> (pChannelCfg);
			strConnectionType = "RSSL_CONN_TYPE_ENCRYPTED";
			cfgParameters.append( "hostName " ).append( pTempChannelCfg->hostName ).append( CR )
				.append( "port " ).append( pTempChannelCfg->serviceName ).append( CR )
				.append( "CompressionType " ).append( compType ).append( CR )
				.append( "tcpNodelay " ).append( (pTempChannelCfg->tcpNodelay ? "true" : "false" ) ).append( CR )
				.append("ObjectName ").append(pTempChannelCfg->objectName).append( CR );
			break;
		}
		case RSSL_CONN_TYPE_RELIABLE_MCAST:
		{
			ReliableMcastChannelConfig  *pTempChannelCfg = static_cast<ReliableMcastChannelConfig*> (pChannelCfg);
			strConnectionType = "RSSL_CONN_TYPE_MCAST";
			cfgParameters.append( "RecvAddress " ).append( pTempChannelCfg->recvAddress ).append( CR )
				.append( "RecvPort " ).append( pTempChannelCfg->recvServiceName ).append( CR )
				.append( "SendAddress " ).append( pTempChannelCfg->sendAddress ).append( CR )
				.append( "SendPort " ).append( pTempChannelCfg->sendServiceName ).append( CR )
				.append("UnicastPort ").append( pTempChannelCfg->unicastServiceName).append( CR )
				.append("HsmInterface ").append( pTempChannelCfg->hsmInterface).append( CR )
				.append("HsmMultAddress ").append( pTempChannelCfg->hsmMultAddress).append( CR )
				.append("HsmPort ").append( pTempChannelCfg->hsmPort).append( CR )
				.append("HsmInterval ").append( pTempChannelCfg->hsmInterval).append( CR )
				.append("tcpControlPort ").append( pTempChannelCfg->tcpControlPort).append( CR )
				.append( "DisconnectOnGap " ).append( ( pTempChannelCfg->disconnectOnGap ? "true" : "false" ) ).append( CR )
				.append("PacketTTL ").append( pTempChannelCfg->packetTTL).append( CR )
				.append( "ndata " ).append( pTempChannelCfg->ndata ).append( CR )
				.append( "nmissing " ).append( pTempChannelCfg->nmissing ).append( CR )
				.append( "nrreq " ).append( pTempChannelCfg->nrreq ).append( CR )
				.append( "tdata " ).append( pTempChannelCfg->tdata ).append( CR )
				.append( "trreq " ).append( pTempChannelCfg->trreq ).append( CR )
				.append( "twait " ).append( pTempChannelCfg->twait ).append( CR )
				.append( "tbchold " ).append( pTempChannelCfg->tbchold ).append( CR )
				.append( "tpphold " ).append( pTempChannelCfg->tpphold ).append( CR )
				.append( "pktPoolLimitHigh " ).append( pTempChannelCfg->pktPoolLimitHigh ).append( CR )
				.append( "pktPoolLimitLow " ).append( pTempChannelCfg->pktPoolLimitLow ).append( CR )
				.append( "userQLimit " ).append( pTempChannelCfg->userQLimit ).append( CR );

			break;
		}
		default:
		{
			strConnectionType = "Invalid ChannelType: ";
			strConnectionType.append(pChannelCfg->connectionType)
				.append(" ");
			bValidChType = false;
			break;
		}
	}
	
	strChannelParams.append( strConnectionType ).append( CR )
		.append( "Channel name ").append( pChannelCfg->name ).append( CR )
		.append( "Consumer Name " ).append( _ommConsImpl.getConsumerName() ).append( CR );

	if(bValidChType)
	{
		strChannelParams.append( "RsslReactor " ).append( ptrToStringAsHex( _pRsslReactor ) ).append( CR )
			.append( "InterfaceName " ).append( pChannelCfg->interfaceName ).append( CR )
			.append( cfgParameters)
			.append( "reconnectAttemptLimit " ).append( pChannelCfg->reconnectAttemptLimit ).append( CR )
			.append( "reconnectMinDelay " ).append( pChannelCfg->reconnectMinDelay ).append( " msec" ).append( CR )
			.append( "reconnectMaxDelay " ).append( pChannelCfg->reconnectMaxDelay).append( " msec" ).append( CR )					
			.append( "connectionPingTimeout " ).append( pChannelCfg->connectionPingTimeout ).append( " msec" ).append( CR );
	}
}