Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ISO 8583 c库解包消息_C_Iso8583 - Fatal编程技术网

ISO 8583 c库解包消息

ISO 8583 c库解包消息,c,iso8583,C,Iso8583,我想知道如何使用oscarsanderson编写的(C语言)解包ISO 8583消息? 例如,如果我有这样的消息:这是我的代码 #include "dl_iso8583.h" #include "dl_iso8583_defs_1993.h" #include "dl_output.h" // for 'DL_OUTPUT_Hex' #define ISOHEADER 4 #define ISOHEADERSTR "%04d" int main ( void ) { DL_ISO85

我想知道如何使用oscarsanderson编写的(C语言)解包ISO 8583消息?
例如,如果我有这样的消息:这是我的代码

#include "dl_iso8583.h"
#include "dl_iso8583_defs_1993.h"
#include "dl_output.h" // for 'DL_OUTPUT_Hex'

#define ISOHEADER 4
#define ISOHEADERSTR "%04d"

int main ( void )
{
    DL_ISO8583_HANDLER isoHandler;
    DL_ISO8583_MSG     isoMsg;
    DL_UINT8           packBuf[1000];
    DL_UINT16          packedSize;
    char msg[]="0210323A40010A4180103800000000000000000420050805011392120805042004225132072000001000000115604000800411 163011511463331563GBAAASDD ERRR 1300101B54391001000017654350000000000090300000268410000000300000000000000898100009431000000000000000000 000000000000000036000299";

    unsigned short iso_req_size,iso_resp_size;
    char iso_header[ISOHEADER+1];
     char iso_req_buf[10000];
     char iso_resp_buf[10000];

    /* get ISO-8583 1993 handler */
    DL_ISO8583_DEFS_1993_GetHandler(&isoHandler);
    DL_ISO8583_MSG_Init(NULL,0,&isoMsg);

    // Unpack message
    DL_ISO8583_MSG_Init(NULL,0,&isoMsg);

    (void)DL_ISO8583_MSG_Unpack(&isoHandler,msg,strlen(msg),&isoMsg);
    DL_ISO8583_MSG_Dump(stdout,NULL,&isoHandler,&isoMsg);
    DL_ISO8583_MSG_Free(&isoMsg);

    return 0;

}
我想在解压缩邮件时检索这些字段:

[000]: 210 [003]: 380000 [004]: 000000000000 [007]: 0420050805 [011]: 011392 [012]: 120805 [013]: 0420 [015]: 0422 [018]: 5132 [039]: 00 [049]: 000 [000]: 210 [003]: 380000 [004]: 000000000000 [007]: 0420050805 [011]: 011392 [012]: 120805 [013]: 0420 [015]: 0422 [018]: 5132 [039]: 00 [049]: 000
据我所知,由oscarsanderson编写的DL iso 8583库不适用于十六进制位图。因此,首先需要将十六进制位图转换为二进制,然后需要了解iso结构字段的属性(即元素类型(数字、二进制、字母数字、ascii等)、长度、长度类型(固定长度或可变长度)).知道这一点后,您可以检索
字段

您必须将消息从十六进制格式转换为二进制格式。 像这样

binMsg[0]=0x02
binMsg[1]=0x10
binMsg[2]=0x32
binMsg[3]=0x3A
binMsg[4]=0x40
把最后一口咬下去

和使用:

(void)DL_ISO8583_MSG_Unpack(&isoHandler,binMsg,strlen(msg)/2,&isoMsg);

到目前为止你试过什么?它是如何工作的?它怎么不起作用?有没有什么特别的东西让你无法理解?我也建议你阅读和阅读。您可能还想学习如何创建。我可能没有正确格式化
msg
。@MikeSherrill'CatRecall'-不,没关系您的
char msg[]
不是有效的ISO8583消息。我想你的意思是“
charmsg[]”“\x02\x10\x03”
。不要使用strlen,这不是字符串。你是对的,Matt McNabb我的消息不对,但我的问题是如何在套接字中发送\00,因为一旦我写入“\x02\x00\x03”并通过套接字发送,我将接收\5c00而不是\00。知道吗?我使用的是来自摩洛哥的m2m开关