2

我使用了osmocom asn1c 编译器(aper-prefix 分支)来获得 GSM_MAP 和 TCAP 协议的实现。每个协议都已成功编译。但是在一个项目中同时使用两者时,会出现以下错误:

src/tcap/src/ErrorCode.c:35:20: error: ‘union ErrorCode_u’ has no member named ‘nationaler’
  { ATF_NOFLAGS, 0, offsetof(struct ErrorCode, choice.nationaler),
                    ^
src/tcap/src/ErrorCode.c:44:20: error: ‘union ErrorCode_u’ has no member named ‘privateer’
  { ATF_NOFLAGS, 0, offsetof(struct ErrorCode, choice.privateer),

我建议问题是 C 语言中的文件名冲突,因为在两个不同的 C 文件中有相同的名称结构和不同的定义(例如ErrorCode.h,在两种协议中都使用)

/* ErrorCode structure which is defined in GSM_MAP protocol*/
#ifndef _ErrorCode_H_
#define _ErrorCode_H_
......
typedef struct ErrorCode {
    ErrorCode_PR present;
    union ErrorCode_u {
        long     localValue;
        OBJECT_IDENTIFIER_t  globalValue;
    } choice;

    /* Context for parsing across buffer boundaries */
    asn_struct_ctx_t _asn_ctx;
} ErrorCode_t;
.....
#endif  /* _ErrorCode_H_ */


/* ErrorCode structure which is defined in TCAP protocol*/
#ifndef _ErrorCode_H_
#define _ErrorCode_H_
.......
typedef struct ErrorCode {
    ErrorCode_PR present;
    union ErrorCode_u {
        long     nationaler;
        long     privateer;
    } choice;

    /* Context for parsing across buffer boundaries */
    asn_struct_ctx_t _asn_ctx;
} ErrorCode_t;
......
#endif  /* _ErrorCode_H_ */

所以尝试解决问题,使用osmocom PREFIX功能:

ASN1C_PREFIX="TCAP_" asn1c -fcompound-names DialoguePDUs.asn tcap.asn UnidialoguePDUs.asn

但是,编译器会报告以下语法错误:

FATAL: Cannot dereference dialogueRequest at line 13
FATAL: Cannot compile "TCAP_DialoguePDU" (21:1) at line 13
FATAL: Cannot compile "TCAP_DialoguePDU" (21:1) at line 13

有人知道这个问题和可能的解决方案吗?

4

0 回答 0