intermediate

This commit is contained in:
Sukchan Lee 2017-02-04 23:47:16 +09:00
parent 9513e495b8
commit 696a2fec27
9 changed files with 559 additions and 1250 deletions

View File

@ -9,7 +9,7 @@ libasn_la_SOURCES = \
nodist_libasn_la_SOURCES = \
s1ap_common.c \
s1ap_encoder.c s1ap_decoder.c s1ap_xer_print.c \
s1ap_ies_encoder.c s1ap_ies_decoder.c s1ap_ies_xer_print.c \
s1ap_mme_encoder.c s1ap_mme_decoder.c
libasn_la_DEPENDENCIES = \

View File

@ -37,7 +37,7 @@
#endif
int asn_debug = 0;
int asn1_xer_print = 1;
int asn1_xer_print = 0;
void free_wrapper(void *ptr)
{

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@
/*******************************************************************************
* This file had been created by asn1tostruct.py script v1.0.2
* Please do not modify this file but regenerate it via script.
* Created on: 2017-02-04 15:10:49.551397 by acetcom
* Created on: 2017-02-04 23:11:39.374543 by acetcom
* from ['S1AP-PDU.asn']
******************************************************************************/
#include "s1ap_common.h"

View File

@ -30,7 +30,7 @@
/*******************************************************************************
* This file had been created by asn1tostruct.py script v1.0.2
* Please do not modify this file but regenerate it via script.
* Created on: 2017-02-04 15:10:49.579571 by acetcom
* Created on: 2017-02-04 23:11:39.421820 by acetcom
* from ['S1AP-PDU.asn']
******************************************************************************/
#include "s1ap_common.h"

View File

@ -30,7 +30,7 @@
/*******************************************************************************
* This file had been created by asn1tostruct.py script v1.0.2
* Please do not modify this file but regenerate it via script.
* Created on: 2017-02-04 15:10:49.590143 by acetcom
* Created on: 2017-02-04 23:11:39.444144 by acetcom
* from ['S1AP-PDU.asn']
******************************************************************************/
#include <stdlib.h>

View File

@ -58,8 +58,8 @@ s1ap_mme_decode_initiating (
#endif
d_assert(initiating_p != NULL, return -1, "Null param");
message_string = calloc (10000, sizeof (char));
#if 0
s1ap_string_total_size = 0;
#if 0
message->procedureCode = initiating_p->procedureCode;
message->criticality = initiating_p->criticality;
#endif
@ -77,6 +77,7 @@ s1ap_mme_decode_initiating (
case S1ap_ProcedureCode_id_S1Setup: {
ret = s1ap_decode_s1ap_s1setuprequesties (&message->msg.s1ap_S1SetupRequestIEs, &initiating_p->value);
s1ap_xer_print_s1ap_s1setuprequest (s1ap_xer__print2sp, message_string, message);
printf("%s\n", message_string);
#if 0
message_id = S1AP_S1_SETUP_LOG;
#endif
@ -86,6 +87,7 @@ s1ap_mme_decode_initiating (
case S1ap_ProcedureCode_id_initialUEMessage: {
ret = s1ap_decode_s1ap_initialuemessage_ies (&message->msg.s1ap_InitialUEMessage_IEs, &initiating_p->value);
s1ap_xer_print_s1ap_initialuemessage (s1ap_xer__print2sp, message_string, message);
printf("%s\n", message_string);
#if 0
message_id = S1AP_INITIAL_UE_MESSAGE_LOG;
#endif
@ -152,8 +154,8 @@ s1ap_mme_decode_successfull_outcome (
#endif
d_assert(successfullOutcome_p != NULL, return -1, "Null param");
message_string = calloc (10000, sizeof (char));
#if 0
s1ap_string_total_size = 0;
#if 0
message->procedureCode = successfullOutcome_p->procedureCode;
message->criticality = successfullOutcome_p->criticality;
#endif
@ -162,6 +164,7 @@ s1ap_mme_decode_successfull_outcome (
case S1ap_ProcedureCode_id_InitialContextSetup: {
ret = s1ap_decode_s1ap_initialcontextsetupresponseies (&message->msg.s1ap_InitialContextSetupResponseIEs, &successfullOutcome_p->value);
s1ap_xer_print_s1ap_initialcontextsetupresponse (s1ap_xer__print2sp, message_string, message);
printf("%s\n", message_string);
#if 0
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
#endif
@ -209,8 +212,8 @@ s1ap_mme_decode_unsuccessfull_outcome (
#endif
d_assert(unSuccessfulOutcome_p != NULL, return -1, "Null param");
message_string = calloc (10000, sizeof (char));
#if 0
s1ap_string_total_size = 0;
#if 0
message->procedureCode = unSuccessfulOutcome_p->procedureCode;
message->criticality = unSuccessfulOutcome_p->criticality;
#endif

View File

@ -350,9 +350,9 @@ f.write("extern size_t %s_string_total_size;\n\n" % (fileprefix.lower()))
f.write("#endif /* %s_IES_DEFS_H_ */\n\n" % (fileprefix.upper()))
#Generate Decode functions
f = open(outdir + fileprefix + '_decoder.c', 'w')
f = open(outdir + fileprefix + '_ies_decoder.c', 'w')
outputHeaderToFile(f, filename)
f.write("#define TRACE_MODULE s1ap_decoder\n#include \"%s_common.h\"\n#include \"%s_ies_defs.h\"\n#include \"core_debug.h\"\n\n" % (fileprefix, fileprefix))
f.write("#define TRACE_MODULE ies_decoder\n#include \"%s_common.h\"\n#include \"%s_ies_defs.h\"\n#include \"core_debug.h\"\n\n" % (fileprefix, fileprefix))
for key in iesDefs:
if key in ieofielist.values():
continue
@ -418,8 +418,6 @@ for key in iesDefs:
f.write(" return -1;\n")
f.write(" }\n")
f.write(" decoded += tempDecoded;\n")
f.write(" if (asn1_xer_print)\n")
f.write(" xer_fprint(stdout, &asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
if ie[2] in ieofielist.keys():
f.write(" if (%s_decode_%s(&%s->%s, %s_p) < 0) {\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienameunderscore, lowerFirstCamelWord(ietypesubst)))
f.write(" d_error(\"Decoding of encapsulated IE %s failed\\n\");\n" % (lowerFirstCamelWord(ietypesubst)))
@ -470,8 +468,6 @@ for key in iesDefs:
f.write(" return -1;\n")
f.write(" }\n")
f.write(" decoded += tempDecoded;\n")
f.write(" if (asn1_xer_print)\n")
f.write(" xer_fprint(stdout, &asn_DEF_%s, %s_p);\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" ASN_SEQUENCE_ADD(&%sIEs->%s, %s_p);\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname)),
re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" } break;\n")
@ -485,7 +481,7 @@ for key in iesDefs:
#Generate IES Encode functions
f = open(outdir + fileprefix + '_encoder.c', 'w')
f = open(outdir + fileprefix + '_ies_encoder.c', 'w')
outputHeaderToFile(f,filename)
f.write("#include \"%s_common.h\"\n" % (fileprefix))
f.write("#include \"%s_ies_defs.h\"\n\n" % (fileprefix))
@ -602,7 +598,7 @@ for (key, value) in iesDefs.items():
f.write("}\n\n")
#Generate xer print functions
f = open(outdir + fileprefix + '_xer_print.c', 'w')
f = open(outdir + fileprefix + '_ies_xer_print.c', 'w')
outputHeaderToFile(f, filename)
f.write("#include <stdlib.h>\n")
f.write("#include <stdio.h>\n\n")

View File

@ -19,6 +19,7 @@ static void s1ap_test1(abts_case *tc, void *data)
s1ap_message message;
int result;
memset(&message, 0, sizeof(s1ap_message));
result = s1ap_mme_decode_pdu(&message, (unsigned char*)buffer[0], 49);
ABTS_INT_EQUAL(tc, 0, result);
}
@ -32,6 +33,7 @@ static void s1ap_test2(abts_case *tc, void *data)
s1ap_message message;
int result;
memset(&message, 0, sizeof(s1ap_message));
result = s1ap_mme_decode_pdu(&message, (unsigned char*)buffer[0], 115);
ABTS_INT_EQUAL(tc, 0, result);
}
@ -45,6 +47,7 @@ static void s1ap_test3(abts_case *tc, void *data)
s1ap_message message;
int result;
memset(&message, 0, sizeof(s1ap_message));
result = s1ap_mme_decode_pdu(&message, (unsigned char*)buffer[0], 41);
ABTS_INT_EQUAL(tc, 0, result);
}
@ -54,6 +57,7 @@ abts_suite *test_s1ap(abts_suite *suite)
suite = ADD_SUITE(suite)
abts_run_test(suite, s1ap_test1, NULL);
abts_run_test(suite, s1ap_test2, NULL);
abts_run_test(suite, s1ap_test3, NULL);
return suite;