//APIQA RsslRet sendGenericMsgOnLogin(RsslChannel* chnl) { RsslRet ret = 0; RsslGenericMsg msg = RSSL_INIT_GENERIC_MSG; RsslMap map = RSSL_INIT_MAP; RsslMapEntry mEntry = RSSL_INIT_MAP_ENTRY; RsslElementList rsslElementList = RSSL_INIT_ELEMENT_LIST; RsslBuffer serviceNameBuffer; RsslEncodeIterator encodeIter; RsslElementEntry element = RSSL_INIT_ELEMENT_ENTRY; RsslBuffer* msgBuf; RsslError error; RsslUInt warmStandByMode = 1; serviceNameBuffer.length = 11; serviceNameBuffer.data = "DIRECT_FEED"; /* clear encode iterator */ rsslClearEncodeIterator(&encodeIter); /* set-up message */ msg.msgBase.msgClass = RSSL_MC_GENERIC; msg.msgBase.domainType = RSSL_DMT_LOGIN; msg.msgBase.containerType = RSSL_DT_MAP; msg.msgBase.msgKey.name.length = 24; msg.msgBase.msgKey.name.data = "ConsumerConnectionStatus"; msg.msgBase.msgKey.flags = RSSL_MKF_HAS_NAME; msg.flags = RSSL_GNMF_HAS_MSG_KEY | RSSL_GNMF_MESSAGE_COMPLETE; /* get a buffer for the login request */ msgBuf = rsslGetBuffer(chnl, MAX_MSG_SIZE, RSSL_FALSE, &error); /* StreamId */ msg.msgBase.streamId = LOGIN_STREAM_ID; /* encode message */ if ((ret = rsslSetEncodeIteratorBuffer(&encodeIter, msgBuf)) < RSSL_RET_SUCCESS) { printf("rsslSetEncodeIteratorBuffer() failed with return code: %d\n", ret); return ret; } rsslSetEncodeIteratorRWFVersion(&encodeIter, chnl->majorVersion, chnl->minorVersion); if ((ret = rsslEncodeMsgInit(&encodeIter, (RsslMsg*)&msg, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeMsgInit() failed with return code: %d\n", ret); return ret; } /* encode map */ map.keyPrimitiveType = RSSL_DT_ASCII_STRING; map.containerType = RSSL_DT_ELEMENT_LIST; if ((ret = rsslEncodeMapInit(&encodeIter, &map, 0, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeMapInit() failed with return code: %d\n", ret); return ret; } /* encode map entry */ mEntry.action = RSSL_MPEA_ADD_ENTRY; if ((ret = rsslEncodeMapEntryInit(&encodeIter, &mEntry, &serviceNameBuffer, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeMapEntry() failed with return code: %d\n", ret); return ret; } /* encode the element list */ rsslElementList.flags = RSSL_ELF_HAS_STANDARD_DATA; if ((ret = rsslEncodeElementListInit(&encodeIter, &rsslElementList, 0, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeElementListInit() failed with return code: %d\n", ret); return ret; } /* WarmStandbyMode */ element.dataType = RSSL_DT_UINT; element.name = RSSL_ENAME_WARMSTANDBY_MODE; if ((ret = rsslEncodeElementEntry(&encodeIter, &element, &warmStandByMode)) < RSSL_RET_SUCCESS) { printf("rsslEncodeElementEntry() failed with return code: %d\n", ret); return ret; } /* complete encode element list */ if ((ret = rsslEncodeElementListComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeElementListComplete() failed with return code: %d\n", ret); return ret; } /* complete encode map entry */ if ((ret = rsslEncodeMapEntryComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeMapEntryComplete() failed with return code: %d\n", ret); return ret; } /* complete encode map */ if ((ret = rsslEncodeMapComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeMapComplete() failed with return code: %d\n", ret); return ret; } /* complete encode message */ if ((ret = rsslEncodeMsgComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeMsgComplete() failed with return code: %d\n", ret); return ret; } msgBuf->length = rsslGetEncodedBufferLength(&encodeIter); if (ret != RSSL_RET_SUCCESS) { rsslReleaseBuffer(msgBuf, &error); printf("\nsendGenericMsgOnLogin() failed with return code: %d\n", ret); return ret; } /* send login request */ if (sendMessage(chnl, msgBuf) != RSSL_RET_SUCCESS) return RSSL_RET_FAILURE; return RSSL_RET_SUCCESS; }
/* this function will encode a basic Element list with several primitives embedded in it */ RsslRet exampleEncodeElementList(RsslEncodeIterator *encIter) { /* create a single RsslElementEntry and reuse for each entry */ RsslElementEntry elemEntry = RSSL_INIT_ELEMENT_ENTRY; /* used to store and check return values */ RsslRet retVal; /* create and initialize element list structure */ RsslElementList elementList = RSSL_INIT_ELEMENT_LIST; /* various data types used during encoding */ RsslTime rsslTime = {10, 21, 16, 777}; RsslUInt rsslUInt = 17; RsslInt rsslInt = 13; /* populate element list structure prior to call to rsslEncodeElementListInit */ /* indicate that standard data will be encoded and that elementListNum is included */ elementList.flags = RSSL_ELF_HAS_STANDARD_DATA | RSSL_ELF_HAS_ELEMENT_LIST_INFO; /* populate elementListNum with info needed to cache */ elementList.elementListNum = 5; /* begin encoding of element list - assumes that the RsslEncodeIterator pointed by the encIter pointer is already populated with buffer and version information */ /* Please note: here for simplicity, we did not use success parameter for rsslEncodeElementListInit/rsslEncodeElementListComplete calls. We are just simply displaying an error if it occurs and exit, thus RSSL_TRUE is used in replacement for success parameter */ if ((retVal = rsslEncodeElementListInit(encIter, &elementList, 0, 0)) < RSSL_RET_SUCCESS) { /* print out message with return value string, value, and text */ printf("Error %s (%d) encountered with rsslEncodeElementListInit(). Error Text: %s\n", rsslRetCodeToString(retVal), retVal, rsslRetCodeInfo(retVal)); return retVal; } /* FIRST Element Entry: encode entry from the RsslTime primitive type */ /* populate and encode element entry with name and dataType information for this element */ elemEntry.name.data = (char *)"Element - RsslTime"; elemEntry.name.length = 20; elemEntry.dataType = RSSL_DT_TIME; printf("\tEncoding Element Entry (name: %.*s) \n", elemEntry.name.length, elemEntry.name.data); retVal = rsslEncodeElementEntry(encIter, &elemEntry, &rsslTime); printf("\t\tEncoded RsslTime: %d:%d:%d\n", rsslTime.hour, rsslTime.minute, rsslTime.second); /* SECOND Element Entry: encode entry from the RsslInt primitive type */ /* populate and encode element entry with name and dataType information for this element */ elemEntry.name.data = (char *)"Element - RsslInt"; elemEntry.name.length = 17; elemEntry.dataType = RSSL_DT_INT; printf("\tEncoding Element Entry (name: %.*s) \n", elemEntry.name.length, elemEntry.name.data); retVal = rsslEncodeElementEntry(encIter, &elemEntry, &rsslInt); printf("\t\tEncoded signed Integer: " RTR_LLD "\n", rsslInt); /* THIRD Element Entry: encode entry from the RsslUInt primitive type */ /* populate and encode element entry with name and dataType information for this element */ elemEntry.name.data = (char *)"Element - RsslUInt"; elemEntry.name.length = 18; elemEntry.dataType = RSSL_DT_UINT; printf("\tEncoding Element Entry (name: %.*s) \n", elemEntry.name.length, elemEntry.name.data); retVal = rsslEncodeElementEntry(encIter, &elemEntry, &rsslUInt); printf("\t\tEncoded Unsigned Integer: " RTR_LLU "\n", rsslUInt); /* FOURTH Element Entry: encode entry from the RsslReal primitive type */ /* populate and encode element entry with name and dataType information for this element */ rsslClearElementEntry(&elemEntry); // clear this to ensure a blank field elemEntry.name.data = (char *)"Element - RsslReal - Blank"; elemEntry.name.length = 26; elemEntry.dataType = RSSL_DT_REAL; printf("\tEncoding Element Entry (name: %.*s) \n", elemEntry.name.length, elemEntry.name.data); retVal = rsslEncodeElementEntry(encIter, &elemEntry, NULL); /* this encodes a blank */ printf("\t\tEncoded RsslReal: Blank\n"); /* complete elementList encoding. If success parameter is true, this will finalize encoding. If success parameter is false, this will roll back encoding prior to rsslEncodeElementListInit */ if ((retVal = rsslEncodeElementListComplete(encIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("Error %s (%d) encountered with rsslEncodeElementListComplete(). Error Text: %s\n", rsslRetCodeToString(retVal), retVal, rsslRetCodeInfo(retVal)); return retVal; } printf("\tElementList Encoding Complete\n"); return RSSL_RET_SUCCESS; }
/* * Encodes the batch item request. Returns success if * encoding succeeds or failure if encoding fails. * chnl - The channel to send an item request to * msgBuf - The message buffer to encode the item request into * streamId - The stream id of the item request * isPrivateStream - Flag for private stream request * * This function is only used within the Market Price Handler * and each handler has its own implementation, although much is similar */ static RsslRet encodeBatchItemRequest(RsslChannel* chnl, RsslBuffer* msgBuf, RsslInt32 streamId, RsslBool isPrivateStream) { RsslRet ret = 0; RsslRequestMsg msg = RSSL_INIT_REQUEST_MSG; RsslElementList eList = RSSL_INIT_ELEMENT_LIST; RsslElementEntry eEntry = RSSL_INIT_ELEMENT_ENTRY; RsslArray elementArray = RSSL_INIT_ARRAY; RsslEncodeIterator encodeIter; RsslSourceDirectoryResponseInfo* srcDirRespInfo = 0; RsslBuffer itemName; int i; RsslLoginResponseInfo* loginInfo = getLoginResponseInfo(); if (getSourceDirectoryResponseInfo(getServiceId(), &srcDirRespInfo) != RSSL_RET_SUCCESS) return RSSL_RET_FAILURE; /* clear encode iterator */ rsslClearEncodeIterator(&encodeIter); /* set-up message */ msg.msgBase.msgClass = RSSL_MC_REQUEST; msg.msgBase.streamId = streamId; msg.msgBase.domainType = RSSL_DMT_MARKET_PRICE; msg.msgBase.containerType = RSSL_DT_ELEMENT_LIST; if (snapshotRequest) { msg.flags = RSSL_RQMF_HAS_QOS | RSSL_RQMF_HAS_PRIORITY | RSSL_RQMF_HAS_BATCH; } else { msg.flags = RSSL_RQMF_HAS_QOS | RSSL_RQMF_STREAMING | RSSL_RQMF_HAS_PRIORITY | RSSL_RQMF_HAS_BATCH; } if((loginInfo->SupportViewRequests == RSSL_TRUE) && (viewRequest == RSSL_TRUE)) { msg.flags |= RSSL_RQMF_HAS_VIEW; } if (isPrivateStream) { msg.flags |= RSSL_RQMF_PRIVATE_STREAM; } msg.priorityClass = 1; msg.priorityCount = 1; /* copy the QoS information */ rsslCopyQos(&(msg.qos), &(srcDirRespInfo->ServiceGeneralInfo.QoS[0])); /* specify msgKey members */ msg.msgBase.msgKey.flags = RSSL_MKF_HAS_NAME_TYPE | RSSL_MKF_HAS_SERVICE_ID; msg.msgBase.msgKey.nameType = RDM_INSTRUMENT_NAME_TYPE_RIC; msg.msgBase.msgKey.serviceId = (RsslUInt16)getServiceId(); /* encode message */ if((ret = rsslSetEncodeIteratorBuffer(&encodeIter, msgBuf)) < RSSL_RET_SUCCESS) { printf("rsslSetEncodeIteratorBuffer() failed with return code: %d\n", ret); return ret; } rsslSetEncodeIteratorRWFVersion(&encodeIter, chnl->majorVersion, chnl->minorVersion); /* start the request message encoding */ if ((ret = rsslEncodeMsgInit(&encodeIter, (RsslMsg*)&msg, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeMsg() failed with return code: %d\n", ret); return ret; } /* For Batch requests, the message has a payload of an element list that contains an array of the requested items */ eList.flags = RSSL_ELF_HAS_STANDARD_DATA; if((ret = rsslEncodeElementListInit(&encodeIter, &eList, 0, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeElementListInit() failed with return code: %d\n", ret); return ret; } eEntry.name = RSSL_ENAME_BATCH_ITEM_LIST; eEntry.dataType = RSSL_DT_ARRAY; if((ret = rsslEncodeElementEntryInit(&encodeIter, &eEntry, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeElementEntryInit() failed with return code: %d\n", ret); return ret; } /* Encode the array of requested item names */ elementArray.primitiveType = RSSL_DT_ASCII_STRING; elementArray.itemLength = 0; if((ret = rsslEncodeArrayInit(&encodeIter, &elementArray)) < RSSL_RET_SUCCESS) { printf("rsslEncodeArrayInit() failed with return code: %d\n", ret); return ret; } if (!isPrivateStream) /* non-private stream */ { for(i = 0; i < itemCount; i++) { itemName.data = marketPriceItemInfoList[i].itemname; itemName.length = marketPriceItemInfoList[i].nameLength; marketPriceItemInfoList[i].streamId = ++streamId; if((ret = rsslEncodeArrayEntry(&encodeIter, &itemName, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeArrayEntry() failed with return code: %d\n", ret); return ret; } } } else /* private stream */ { for(i = 0; i < privateStreamItemCount; i++) { itemName.data = marketPricePSItemInfoList[i].itemname; itemName.length = marketPricePSItemInfoList[i].nameLength; marketPricePSItemInfoList[i].streamId = ++streamId; if((ret = rsslEncodeArrayEntry(&encodeIter, &itemName, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeArrayEntry() failed with return code: %d\n", ret); return ret; } } } if((ret = rsslEncodeArrayComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeArrayComplete() failed with return code: %d\n", ret); return ret; } if((ret = rsslEncodeElementEntryComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeElementEntryComplete() failed with return code: %d\n", ret); return ret; } /* * Encode a view request into the list. */ if((loginInfo->SupportViewRequests == RSSL_TRUE) && (viewRequest == RSSL_TRUE) ) encodeViewElementRequest(&encodeIter); if((ret = rsslEncodeElementListComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeElementListComplete() failed with return code: %d\n", ret); return ret; } if((ret = rsslEncodeMsgComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeMessageComplete() failed with return code: %d\n", ret); return ret; } msgBuf->length = rsslGetEncodedBufferLength(&encodeIter); return RSSL_RET_SUCCESS; }
/* * Encodes the batch item close message. Returns success if * encoding succeeds or failure if encoding fails. * chnl - The channel to send a batch item close message to * msgBuf - The message buffer to encode the batch item close msg into * batchCloseStreamId - The stream id of the batch item close message * * This function is only used within the Market Price Handler * and each handler has its own implementation, although much is similar */ static RsslRet encodeBatchItemClose(RsslChannel* chnl, RsslBuffer* msgBuf, RsslInt32 batchCloseStreamId) { RsslRet ret = 0; RsslCloseMsg msg; RsslElementList eList; RsslElementEntry eEntry; RsslArray elementArray; RsslEncodeIterator encodeIter; RsslInt itemStreamId; int i; /* clear encode iterator */ rsslClearEncodeIterator(&encodeIter); /* set-up message */ rsslClearCloseMsg(&msg); msg.msgBase.msgClass = RSSL_MC_CLOSE; msg.msgBase.streamId = batchCloseStreamId; msg.flags = RSSL_CLMF_HAS_BATCH; msg.msgBase.domainType = RSSL_DMT_MARKET_PRICE; msg.msgBase.containerType = RSSL_DT_ELEMENT_LIST; /* encode message */ if((ret = rsslSetEncodeIteratorBuffer(&encodeIter, msgBuf)) < RSSL_RET_SUCCESS) { printf("rsslSetEncodeIteratorBuffer() failed with return code: %d\n", ret); return ret; } rsslSetEncodeIteratorRWFVersion(&encodeIter, chnl->majorVersion, chnl->minorVersion); /* start the batch close message encoding */ if ((ret = rsslEncodeMsgInit(&encodeIter, (RsslMsg*)&msg, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeMsg() failed with return code: %d\n", ret); return ret; } /* For Batch close, the message has a payload of an element list that contains an array of streamIDs in which the client registers interest for close */ rsslClearElementList(&eList); eList.flags = RSSL_ELF_HAS_STANDARD_DATA; if((ret = rsslEncodeElementListInit(&encodeIter, &eList, 0, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeElementListInit() failed with return code: %d\n", ret); return ret; } rsslClearElementEntry(&eEntry); eEntry.name = RSSL_ENAME_BATCH_STREAMID_LIST; eEntry.dataType = RSSL_DT_ARRAY; if((ret = rsslEncodeElementEntryInit(&encodeIter, &eEntry, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeelementEntryEntryInit() failed with return code: %d\n", ret); return ret; } /* Encode the array of streamIDs in which the client registers interest for close */ rsslClearArray(&elementArray); elementArray.primitiveType = RSSL_DT_INT; elementArray.itemLength = 0; /* Array will have variable length entries */ if((ret = rsslEncodeArrayInit(&encodeIter, &elementArray)) < RSSL_RET_SUCCESS) { printf("rsslEncodeArrayInit() failed with return code: %d\n", ret); return ret; } /* encode payload with streamId list */ for(i = 0; i < itemCount; i++) { itemStreamId = i + MARKETPRICE_STREAM_ID_START; /* we only want to close a stream if it was not already closed (e.g. rejected by provider, closed via refresh or status, or redirected) */ if (!rsslIsFinalState(&marketPriceItemInfoList[i].itemState)) { if((ret = rsslEncodeArrayEntry(&encodeIter, 0, (void*)(&itemStreamId))) < RSSL_RET_SUCCESS) { printf("rsslEncodeArrayEntry() failed with return code: %d\n", ret); return ret; } } } for(i = 0; i < privateStreamItemCount; i++) { itemStreamId = i + MARKETPRICE_PRIVATE_STREAM_ID_START; /* we only want to close a stream if it was not already closed (e.g. rejected by provider, closed via refresh or status, or redirected) */ if (!rsslIsFinalState(&marketPricePSItemInfoList[i].itemState)) { if((ret = rsslEncodeArrayEntry(&encodeIter, 0, (void*)(&itemStreamId))) < RSSL_RET_SUCCESS) { printf("rsslEncodeArrayEntry() failed with return code: %d\n", ret); return ret; } } } if((ret = rsslEncodeArrayComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeArrayComplete() failed with return code: %d\n", ret); return ret; } if((ret = rsslEncodeElementEntryComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeelementEntryEntryComplete() failed with return code: %d\n", ret); return ret; } if((ret = rsslEncodeElementListComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeElementListComplete() failed with return code: %d\n", ret); return ret; } if((ret = rsslEncodeMsgComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeMessageComplete() failed with return code: %d\n", ret); return ret; } msgBuf->length = rsslGetEncodedBufferLength(&encodeIter); return RSSL_RET_SUCCESS; }
/* * Encodes the item request. Returns success if * encoding succeeds or failure if encoding fails. * chnl - The channel to send an item request to * msgBuf - The message buffer to encode the item request into * streamId - The stream id of the item request * isPrivateStream - Flag for private stream request * * This function is only used within the Market Price Handler * and each handler has its own implementation, although much is similar */ static RsslRet encodeItemRequest(RsslChannel* chnl, RsslBuffer* msgBuf, RsslInt32 streamId, RsslBool isPrivateStream) { RsslRet ret = 0; RsslRequestMsg msg = RSSL_INIT_REQUEST_MSG; RsslEncodeIterator encodeIter; RsslElementList eList = RSSL_INIT_ELEMENT_LIST; RsslLoginResponseInfo* loginInfo = getLoginResponseInfo(); RsslSourceDirectoryResponseInfo* srcDirRespInfo = 0; RsslUInt32 listIndex; if (getSourceDirectoryResponseInfo(getServiceId(), &srcDirRespInfo) != RSSL_RET_SUCCESS) return RSSL_RET_FAILURE; /* clear encode iterator */ rsslClearEncodeIterator(&encodeIter); /* set-up message */ msg.msgBase.msgClass = RSSL_MC_REQUEST; msg.msgBase.streamId = streamId; msg.msgBase.domainType = RSSL_DMT_MARKET_PRICE; if((viewRequest == RSSL_TRUE) && (loginInfo->SupportViewRequests == RSSL_TRUE)) msg.msgBase.containerType = RSSL_DT_ELEMENT_LIST; else msg.msgBase.containerType = RSSL_DT_NO_DATA; if (snapshotRequest) { msg.flags = RSSL_RQMF_HAS_QOS | RSSL_RQMF_HAS_PRIORITY; } else { msg.flags = RSSL_RQMF_HAS_QOS | RSSL_RQMF_STREAMING | RSSL_RQMF_HAS_PRIORITY; } if (isPrivateStream) { msg.flags |= RSSL_RQMF_PRIVATE_STREAM; } if((loginInfo->SupportViewRequests == RSSL_TRUE) && (viewRequest == RSSL_TRUE)) msg.flags |= RSSL_RQMF_HAS_VIEW; msg.priorityClass = 1; msg.priorityCount = 1; /* copy the QoS information */ rsslCopyQos(&(msg.qos), &(srcDirRespInfo->ServiceGeneralInfo.QoS[0])); /* specify msgKey members */ msg.msgBase.msgKey.flags = RSSL_MKF_HAS_NAME_TYPE | RSSL_MKF_HAS_NAME | RSSL_MKF_HAS_SERVICE_ID; msg.msgBase.msgKey.nameType = RDM_INSTRUMENT_NAME_TYPE_RIC; if (!isPrivateStream) /* non-private stream */ { listIndex = streamId - MARKETPRICE_STREAM_ID_START; msg.msgBase.msgKey.name.data = marketPriceItemInfoList[listIndex].itemname; msg.msgBase.msgKey.name.length = marketPriceItemInfoList[listIndex].nameLength; } else /* private stream */ { listIndex = streamId - MARKETPRICE_PRIVATE_STREAM_ID_START; msg.msgBase.msgKey.name.data = marketPricePSItemInfoList[listIndex].itemname; msg.msgBase.msgKey.name.length = marketPricePSItemInfoList[listIndex].nameLength; } msg.msgBase.msgKey.serviceId = (RsslUInt16)getServiceId(); /* encode message */ if((ret = rsslSetEncodeIteratorBuffer(&encodeIter, msgBuf)) < RSSL_RET_SUCCESS) { printf("rsslSetEncodeIteratorBuffer() failed with return code: %d\n", ret); return ret; } rsslSetEncodeIteratorRWFVersion(&encodeIter, chnl->majorVersion, chnl->minorVersion); if ((ret = rsslEncodeMsgInit(&encodeIter, (RsslMsg*)&msg, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeMsgInit() failed with return code: %d\n", ret); return ret; } if(viewRequest == RSSL_TRUE) { if (loginInfo->SupportViewRequests == RSSL_TRUE) { eList.flags = RSSL_ELF_HAS_STANDARD_DATA; if ((ret = rsslEncodeElementListInit(&encodeIter, &eList, 0, 0)) < RSSL_RET_SUCCESS) { printf("rsslEncodeElementListInit() failed with return code: %d\n", ret); return ret; } encodeViewElementRequest(&encodeIter); if ((ret = rsslEncodeElementListComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeElementListComplete() failed with return code: %d\n", ret); return ret; } } else { printf("\nConnected Provider does not support Dynamic View requests. Disabling View functionality.\n"); viewRequest = RSSL_FALSE; } } if ((ret = rsslEncodeMsgComplete(&encodeIter, RSSL_TRUE)) < RSSL_RET_SUCCESS) { printf("rsslEncodeMsgComplete() failed with return code: %d\n", ret); return ret; } msgBuf->length = rsslGetEncodedBufferLength(&encodeIter); if (!isPrivateStream) marketPriceItemInfoList[listIndex].streamId = streamId; else marketPricePSItemInfoList[listIndex].streamId = streamId; return RSSL_RET_SUCCESS; }