Commit 3582e3bf authored by Robert Schmidt's avatar Robert Schmidt

test program

parent 0accb601
...@@ -50,8 +50,8 @@ ...@@ -50,8 +50,8 @@
*/ */
#if TRACE_ASN1C_ENC_DEC #if TRACE_ASN1C_ENC_DEC
#include "common/utils/LOG/log.h" #include "stdbool.h"
#define ASN_DEBUG(x...) do{ LOG_I(ASN1,x);LOG_I(ASN1,"\n"); } while(false) #define ASN_DEBUG(x...) do{ printf(x);printf("\n"); } while(false)
#else #else
#define ASN_DEBUG(x...) #define ASN_DEBUG(x...)
#endif #endif
......
...@@ -6,3 +6,6 @@ if(ENABLE_TESTS) ...@@ -6,3 +6,6 @@ if(ENABLE_TESTS)
add_dependencies(tests f1ap_ids_test) add_dependencies(tests f1ap_ids_test)
add_test(NAME F1AP_ID_test COMMAND f1ap_ids_test) add_test(NAME F1AP_ID_test COMMAND f1ap_ids_test)
endif() endif()
add_executable(f1ap_debug f1ap_debug.c)
target_link_libraries(f1ap_debug asn1_f1ap)
#include <stdint.h>
#include <stdbool.h>
#include "config.h"
#include "F1AP_F1AP-PDU.h"
#include "assert.h"
F1AP_F1AP_PDU_t *f1ap_decode_pdu(const uint8_t *const buffer, uint32_t length)
{
assert(buffer != NULL);
asn_codec_ctx_t st = {.max_stack_size = 100 * 1000};
F1AP_F1AP_PDU_t *pdu = NULL;
asn_dec_rval_t dec_ret = aper_decode(&st, &asn_DEF_F1AP_F1AP_PDU, (void **)&pdu, buffer, length, 0, 0);
return dec_ret.code == RC_OK ? pdu : NULL;
}
#define LITEON
int main()
{
#ifdef LITEON
uint8_t buf[] = {
0x00, 0x01, 0x00, 0x66, 0x00, 0x00, 0x05, 0x00, 0x4e, 0x00, 0x02, 0x00, 0x02, 0x00, 0x2a, 0x00, 0x02, 0x00,
0x01, 0x00, 0x2d, 0x00, 0x09, 0x03, 0x00, 0x67, 0x6e, 0x62, 0x30, 0x31, 0x64, 0x75, 0x00, 0x2c, 0x00, 0x38,
0x00, 0x00, 0x00, 0x2b, 0x00, 0x32, 0x08, 0x00, 0x02, 0xf8, 0x99, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
0x00, 0x00, 0x01, 0x08, 0x02, 0xf8, 0x99, 0x00, 0x00, 0x00, 0x83, 0x40, 0x0c, 0x00, 0x01, 0x40, 0x20, 0x00,
0x00, 0x00, 0x40, 0x20, 0x03, 0x06, 0x0a, 0x41, 0x00, 0x09, 0xd4, 0x70, 0x00, 0x00, 0x4d, 0x00, 0x2e, 0x00,
0x01, 0x00, 0x00, 0xab, 0x00, 0x0a, 0x80, 0x00, 0x00, 0x00, 0xc7, 0x00, 0x03, 0x0f, 0x05, 0x01,
};
#else
uint8_t buf[] = {
0x00, 0x01, 0x00, 0x80, 0xcb, 0x00, 0x00, 0x05, 0x00, 0x4e, 0x00, 0x02, 0x00, 0x01, 0x00, 0x2a, 0x00, 0x02, 0x00, 0x00, 0x00,
0x2d, 0x40, 0x10, 0x06, 0x80, 0x67, 0x4e, 0x42, 0x2d, 0x45, 0x75, 0x72, 0x65, 0x63, 0x6f, 0x6d, 0x2d, 0x44, 0x55, 0x00, 0x2c,
0x00, 0x80, 0x9e, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x80, 0x97, 0x48, 0x00, 0x02, 0xf8, 0x59, 0x00, 0x0b, 0xc6, 0x14, 0xe0, 0x00,
0x00, 0x00, 0x00, 0x01, 0x08, 0x02, 0xf8, 0x59, 0x00, 0x00, 0x00, 0x83, 0x40, 0x05, 0x00, 0x01, 0x00, 0x40, 0x08, 0x41, 0x00,
0x09, 0xc4, 0x08, 0x00, 0x00, 0x4d, 0x00, 0x27, 0x00, 0x01, 0x30, 0x00, 0x03, 0x01, 0x06, 0x06, 0x66, 0x92, 0x00, 0x28, 0x08,
0x24, 0x10, 0x95, 0x00, 0x00, 0x01, 0x00, 0x0b, 0xc6, 0x14, 0xea, 0x42, 0x13, 0x41, 0x58, 0x00, 0x00, 0x9a, 0x59, 0xc3, 0x2c,
0xd7, 0xf8, 0x16, 0xe0, 0x80, 0x40, 0x00, 0x01, 0x01, 0x06, 0xe1, 0x00, 0x40, 0x00, 0x01, 0x01, 0x06, 0xe1, 0x80, 0x40, 0x00,
0x01, 0x01, 0x00, 0x01, 0x84, 0x0d, 0x21, 0x40, 0xd8, 0x72, 0x1d, 0x33, 0x00, 0x00, 0x80, 0x00, 0x09, 0xa7, 0x27, 0x38, 0x65,
0x99, 0x51, 0x88, 0x00, 0x6b, 0x53, 0x31, 0xf7, 0x27, 0x01, 0x24, 0xe7, 0x1a, 0xa6, 0x35, 0xbc, 0x6a, 0x68, 0xf4, 0xc9, 0xc2,
0xe0, 0x05, 0x0e, 0x1d, 0x00, 0x82, 0xc0, 0x76, 0x01, 0x22, 0x33, 0x7b, 0x10, 0xc0, 0x00, 0xab, 0x00, 0x01, 0x70,
};
#endif
F1AP_F1AP_PDU_t *pdu = f1ap_decode_pdu(buf, sizeof(buf));
if (pdu == NULL) {
fprintf(stderr, "Failed to decode PDU\n");
return -1;
}
xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu);
ASN_STRUCT_FREE(asn_DEF_F1AP_F1AP_PDU, pdu);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment