fixed generation of ie containers of one single ie object

master
Francisco Paisana 5 years ago committed by Francisco Paisana
parent e3e3848210
commit e79fc9bf08

File diff suppressed because it is too large Load Diff

@ -1173,7 +1173,7 @@ SRSASN_CODE unpack_bitfield(uint8_t* buf, cbit_ref& bref, uint32_t n, uint32_t l
void from_number(uint8_t* ptr, uint64_t number, uint32_t nbits)
{
if (nbits > 64) {
if (nbits > 64u) {
log_error("bitstring of size=%d does not fit in an uint64_t\n", nbits);
return;
}

File diff suppressed because it is too large Load Diff

@ -94,6 +94,29 @@ int test_init_ctxt_setup_req()
return SRSLTE_SUCCESS;
}
int test_ue_ctxt_release_req()
{
uint8_t s1ap_msg[] = {0x00, 0x12, 0x40, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01,
0x00, 0x08, 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, 0x40, 0x02, 0x02, 0x80};
// 00124015000003000000020001000800020001000240020280
cbit_ref bref(&s1ap_msg[0], sizeof(s1ap_msg));
s1ap_pdu_c pdu;
TESTASSERT(pdu.unpack(bref) == SRSASN_SUCCESS);
TESTASSERT(pdu.type().value == s1ap_pdu_c::types_opts::init_msg);
TESTASSERT(pdu.init_msg().proc_code == ASN1_S1AP_ID_UE_CONTEXT_RELEASE_REQUEST);
auto& req = pdu.init_msg().value.ue_context_release_request().protocol_ies;
TESTASSERT(req.mme_ue_s1ap_id.value.value == 1);
TESTASSERT(req.enb_ue_s1ap_id.value.value == 1);
TESTASSERT(req.cause.value.type().value == cause_c::types_opts::radio_network);
TESTASSERT(req.cause.value.radio_network().value == cause_radio_network_opts::user_inactivity);
TESTASSERT(test_pack_unpack_consistency(pdu) == SRSASN_SUCCESS);
return SRSLTE_SUCCESS;
}
template <typename T, typename U>
bool is_same_type(U& u)
{
@ -139,6 +162,42 @@ int test_proc_id_consistency()
return SRSLTE_SUCCESS;
}
int test_ho_request()
{
uint8_t s1ap_msg[] = {
0x00, 0x01, 0x00, 0x80, 0xe6, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x64, 0x00, 0x01, 0x00, 0x01, 0x00,
0x00, 0x02, 0x40, 0x02, 0x00, 0x00, 0x00, 0x42, 0x00, 0x0a, 0x18, 0x3b, 0x9a, 0xca, 0x00, 0x60, 0x3b, 0x9a, 0xca,
0x00, 0x00, 0x35, 0x00, 0x19, 0x00, 0x00, 0x1b, 0x00, 0x14, 0x4a, 0x1f, 0x0a, 0x00, 0x21, 0xf0, 0xb7, 0x36, 0x1c,
0x56, 0x00, 0x09, 0x3c, 0x00, 0x00, 0x00, 0x8f, 0x40, 0x01, 0x00, 0x00, 0x68, 0x00, 0x75, 0x74, 0x00, 0x5f, 0x0a,
0x10, 0x0c, 0x81, 0xa0, 0x00, 0x00, 0x18, 0x00, 0x02, 0xe8, 0x7f, 0xe4, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x05,
0x91, 0x00, 0x00, 0x02, 0x90, 0x09, 0x78, 0x00, 0x00, 0x00, 0x62, 0x7c, 0x1f, 0x50, 0x29, 0x8f, 0x00, 0xe9, 0xce,
0x02, 0x13, 0x00, 0x00, 0x95, 0x01, 0x00, 0x46, 0x40, 0x00, 0x00, 0x01, 0x90, 0x13, 0x84, 0x00, 0x1c, 0x00, 0x67,
0x00, 0xa0, 0x51, 0x80, 0x41, 0x40, 0x06, 0x70, 0xdf, 0xbc, 0x44, 0x00, 0x6b, 0x01, 0x40, 0x00, 0x80, 0x02, 0x08,
0x00, 0xc1, 0x4c, 0xa2, 0xd5, 0x4e, 0x28, 0x03, 0x51, 0x72, 0x40, 0xe0, 0x59, 0x14, 0x01, 0x21, 0x7b, 0x00, 0x00,
0x09, 0xf1, 0x07, 0x00, 0x19, 0xb0, 0x10, 0x00, 0x09, 0xf1, 0x07, 0x00, 0x19, 0xc0, 0x21, 0x00, 0x00, 0x1f, 0x00,
0x6b, 0x00, 0x05, 0x18, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x28, 0x00, 0x21, 0x10, 0x8b, 0x0d, 0xab, 0xd7, 0xe5, 0x98,
0x34, 0xb3, 0xef, 0x6c, 0xc1, 0xaa, 0xa7, 0x27, 0xfb, 0xf4, 0x53, 0x08, 0xff, 0x74, 0x94, 0x7c, 0xa7, 0x1b, 0xd9,
0xb4, 0x37, 0xb9, 0x02, 0x78, 0x62, 0x12};
// 00010080E600000800000002006400010001000002400200000042000A183B9ACA00603B9ACA000035001900001B00144A1F0A0021F0B7361C5600093C0000008F4001000068007574005F0A100C81A00000180002E87FE40000150000000591000002900978000000627C1F50298F00E9CE021300009501004640000001901384001C006700A0518041400670DFBC44006B01400080020800C14CA2D54E2803517240E0591401217B000009F1070019B0100009F1070019C02100001F006B000518000C000000280021108B0DABD7E59834B3EF6CC1AAA727FBF45308FF74947CA71BD9B437B902786212
cbit_ref bref(&s1ap_msg[0], sizeof(s1ap_msg));
s1ap_pdu_c pdu;
TESTASSERT(pdu.unpack(bref) == SRSASN_SUCCESS);
TESTASSERT(pdu.type().value == s1ap_pdu_c::types_opts::init_msg);
TESTASSERT(pdu.init_msg().proc_code == ASN1_S1AP_ID_HO_RES_ALLOC);
TESTASSERT(pdu.init_msg().crit.value == crit_opts::reject);
auto& horeq = pdu.init_msg().value.ho_request().protocol_ies;
auto& erab_item = horeq.erab_to_be_setup_list_ho_req.value[0].value.erab_to_be_setup_item_ho_req();
TESTASSERT(erab_item.erab_id == 5);
TESTASSERT(erab_item.gtp_teid.to_string() == "b7361c56");
TESTASSERT(test_pack_unpack_consistency(pdu) == SRSASN_SUCCESS);
return SRSLTE_SUCCESS;
}
int main()
{
srslte::logmap::set_default_log_level(srslte::LOG_LEVEL_DEBUG);
@ -146,7 +205,9 @@ int main()
TESTASSERT(test_s1setup_request() == 0);
TESTASSERT(test_init_ctxt_setup_req() == 0);
TESTASSERT(test_ue_ctxt_release_req() == 0);
TESTASSERT(test_proc_id_consistency() == 0);
TESTASSERT(test_ho_request() == 0);
printf("Success\n");
return 0;

Loading…
Cancel
Save