我使用了libosmo-asn1-map中的 C 代码来获得 GSM_MAP 协议的实现。然后我尝试对“发送身份验证信息”消息进行编码。如3GPP TS 29.002中所述,该消息包含一些强制性部分(例如'imsi')和一些可选部分(例如'requestingNodeType')。
/* SendAuthenticationInfoArg */
typedef struct SendAuthenticationInfoArg {
IMSI_t imsi;
NumberOfRequestedVectors_t numberOfRequestedVectors;
NULL_t *segmentationProhibited /* OPTIONAL */;
NULL_t *immediateResponsePreferred /* OPTIONAL */;
struct Re_synchronisationInfo *re_synchronisationInfo /* OPTIONAL */;
struct ExtensionContainer *extensionContainer /* OPTIONAL */;
/*
* This type is extensible,
* possible extensions are below.
*/
RequestingNodeType_t *requestingNodeType /* OPTIONAL */;
PLMN_Id_t *requestingPLMN_Id /* OPTIONAL */;
NumberOfRequestedVectors_t *numberOfRequestedAdditional_Vectors /* OPTIONAL */;
NULL_t *additionalVectorsAreForEPS /* OPTIONAL */;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} SendAuthenticationInfoArg_t;
我使用了以下受osmo-tcap-map项目启发的 C 代码。
SendAuthenticationInfoArg_t ula;
memset(&ula, 0, sizeof(ula));
ASN1Common::OCTET_STRING_fromRevVal(&ula.imsi, 202015604083166);
ula.requestingNodeType = 0;
ula.numberOfRequestedVectors = 5;
xer_fprint(stdout, &asn_DEF_SendAuthenticationInfoArg, &ula);
但是 XER 输出中没有可选部分,而“ requestingNodeType ”已被初始化:
<SendAuthenticationInfoArg>
<imsi>02 02 51 06 04 38 61 F6</imsi>
<numberOfRequestedVectors>5</numberOfRequestedVectors>
</SendAuthenticationInfoArg>
如何启用可选部分(即在消息中添加“requestingNodeType”)?