How to use a pre-encoded ElementList in a message Payload?

I have entire ElementList pre-encoded in a buffer. How that buffer should be used to populate the list in a message payload?

RsslBuffer listBuffer; // a buffer with encoded element list in it, 160 bytes
RsslElementList list;
rsslClearElementList(&list);
list.flags = RSSL_ELF_HAS_STANDARD_DATA;
list.encEntries = *preencodedListBuf;

// when I try to encode the list in a message, the list is always empty
rsslEncodeElementListInit(&iter, &list, 0, 0);
rsslEncodeElementListComplete(&iter, RSSL_TRUE);
// rsslGetEncodedBufferLength(&iter) == 51 – list is not populated

Unfortunately, I was not able to find much info of how to use encEntries neither for ElementList nor for FieldList.

Is this the right way to populate msg payload with pre-encoded ElementList? If not – what is the right one? If yes - what am I possibly doing wrong?

Best Answer

  • Ripley79
    Answer ✓

    Set the RsslMsg::encDataBody member directly to the buffer that contains your pre-encoded ElementList, e.g.

    msg.msgBase.encDataBody.data = "";


    msg.msgBase.encDataBody.length = listBuffer.length;

    Or, just:

    msg.msgBase.encDataBody = listBuffer;

    When you call rsslEncodeMsg() the buffer contents will be encoded as the payload.