Closed jeick2008 closed 5 years ago
1.0.0 release was a mistake. Please use the current vlm_master
branch (the default), as it's the only branch that gets updates and fixes (and it provides the most capabilities). I doubt you can make 1.0.0 work properly with s1ap-f40.asn
.
Regarding parsing IEs, I don't really know - but AFAIK it should be possible to tell the code to parse a single PDU. Now, if that PDU is comprised of several IEs - I doubt you can tell it to stop mid-way after the IE you're interested in was parsed, but I'll let @brchiu and @velichkov to weigh in on this.
@mouse07410
vlm_master branch can generate the codes, but something is wrong.
the cmdline asn1c -pdu=S1AP-PDU -pdu=all -fcompound-names -findirect-choice -fno-include-deps -flink-skeletons -no-gen-OER - gen-PER ../36413/s1ap-f40.asn ../36331/lte-rrc-f40.asn
lte-rrc-f40.zip
s1ap-f40.zip
then execute make -f converter-example.mk
,
cc -DASN_DISABLE_OER_SUPPORT -DPDU=S1AP_PDU -DASN_PDU_COLLECTION -I. -o S1AP-PDU.o -c S1AP-PDU.c cc -DASN_DISABLE_OER_SUPPORT -DPDU=S1AP_PDU -DASN_PDU_COLLECTION -I. -o InitiatingMessage.o -c InitiatingMessage.c InitiatingMessage.c:138:39: error: ‘asn_DEF_HandoverCommand’ undeclared here (not in a function) { "&SuccessfulOutcome", aioc__type, &asn_DEF_HandoverCommand }, ^ InitiatingMessage.c:252:39: error: ‘asn_DEF_Paging’ undeclared here (not in a function) { "&InitiatingMessage", aioc__type, &asn_DEF_Paging }, ^ make: *** [InitiatingMessage.o] Error 1
Within brchiu's repo , the same cmdline works well.
https://github.com/brchiu/asn1c/tree/velichkov_s1ap_plus_option_group
.................................................
the difference is asnDEF(S1AP_PDU_Contens)HandoverCommand, details likes bellow:
@jeick2008, to avoid name clash from ASN.1 modules, it is practically not recommended to combine ASN.1 of two different protocols.
@brchiu thank you so much
@jeick2008, I forgot mentioning that , at application level, if a program indeed has to include the header files generated from two different protocols, thus name clash becomes inevitible. One trick is setting environment variable ASN1C_PREFIX=LTE_
and ASN1C_PREFIX=S1AP_
when create C files, then the types created will be appended with specified prefixes.
@brchiu thank you,
@brchiu @mouse07410 @velichkov the S1AP message's datastruct in rencently repo is defined as :(for example struct InitiatingMessage->HandoverRequired)
typedef struct S1AP_InitiatingMessage {
S1AP_ProcedureCode_t procedureCode;
S1AP_Criticality_t criticality;
struct S1AP_InitiatingMessage__value {
S1AP_InitiatingMessage__value_PR present;
union S1AP_InitiatingMessage__S1AP_value_u {
S1AP_HandoverRequired_t HandoverRequired; -------------------------
S1AP_HandoverRequest_t HandoverRequest;
...........
} choice;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} value;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_InitiatingMessage_t;
And two years ago(maybe) ,the data struct was defined as
typedef struct InitiatingMessage {
ProcedureCode_t procedureCode;
Criticality_t criticality;
ANY_t value; --------------
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} InitiatingMessage_t;
Within old version(two years ago)parsing the InitiatingMessage_t->ANY_t value,
HandoverRequired_t *handover_require = NULL;
ANY_to_type_aper(value, &asn_DEF_HandoverRequired, (void**)&handover_require)
ASN_STRUCT_FREE(asn_DEF_HandoverRequired, handover_require);
In this way, if the procedureCode is concerned, invoking ANY_to_type_aper manually. It is more efficient than the current approach. Is there any way to make the data struct in asn1c generate code like ANY_t value not choice? Thank you so much.
@jeick2008 , you can do it on your own.
I don't think we can do anything about this - I suggest @jeick2008 to follow what @brchiu recommended.
Closing this issue - if you need more help with it, please feel free to re-open.
@mouse07410 @velichkov @brchiu The asn data file was copied from 36413 vsersion f40,like bellow: s1ap-f40.zip The cmdline:
asn1c -pdu=S1AP-PDU -pdu=all -fcompound-names -findirect-choice -fno-include-deps -flink-skeletons -gen-PER ../36413/s1ap-f40.asn
Within v1.0.0 (https://github.com/mouse07410/asn1c/releases) it works wrong, for details:(I adjust the integer(bit64) from 18446744073709551615 to 922337203685477580, line 4758 and line 4759 in s1ap-f40.asn) asn1c_gen_code.zip the v1.0.0 works well within asn data (https://github.com/ikarso/3GPPTS36.413_AuthenticEshkinKot/tree/master/ASN)The latest repo works well within s1ap-f40.asn. But latest repo decoder the packet recurively, after aper_decode(), everything will be parsed. But I just wanna parse the IEs I care about or all of IEs, this leads to performance issue (700Mbps). In v1.0.0, IEs were parsed by ANY_to_type_aper, in this way , I can ignore the IEs donot care about. How to make the v1.0.0 work properly within s1ap-f40.asn. Or, How to keep the latest version from recursive parsing IEs? Thanks so much.