如何使用Oscar Anderson的ISO8583库来获取消息长度?

时间:2017-06-26 12:59:41

标签: c iso8583

如何使用Oscar Anderson的C库来确定我的isomsg的长度  假设我有这个:

enter code here

DL_ISO8583_HANDLER isoHandler;
DL_ISO8583_MSG     isoMsg;
DL_UINT8           buf[MAX_DATASIZ];
DL_UINT16          bufSize;

DL_ISO8583_DEFS_1987_GetHandler(&isoHandler);

/* initialise ISO message */
DL_ISO8583_MSG_Init(NULL,0,&isoMsg);


(void)DL_ISO8583_MSG_SetField_Str(0,"0320",&isoMsg);
(void)DL_ISO8583_MSG_SetField_Str(2,"4401410145200145",&isoMsg); 
(void)DL_ISO8583_MSG_SetField_Str(3,"310000",&isoMsg);
(void)DL_ISO8583_MSG_SetField_Str(4,"000000001045",&isoMsg);
(void)DL_ISO8583_MSG_SetField_Str(11,"000015",&isoMsg);

(void)DL_ISO8583_MSG_Pack(&isoHandler,&isoMsg,&buf[7],&bufSize);

如何获得我的isoMsg长度?

1 个答案:

答案 0 :(得分:0)

从我在这里看到的是DL_ISO8583_MSG

的定义
struct DL_ISO8583_MSG_S
{
    /* static memory details */
    DL_UINT8 *sPtrNext; /* next static point - NULL if dynamic mode  */
    DL_UINT8 *sPtrEnd;  /* end of the static buffer (if static mode) */

    /* NB bitmap is not stored, it is implied if the field is set */

    /* fields */
DL_ISO8583_MSG_FIELD field[1+kDL_ISO8583_MAX_FIELD_IDX];
};
typedef struct DL_ISO8583_MSG_S DL_ISO8583_MSG;

只需解析DL_UINT8 pointers并将计数存储到变量中。