Skip to content

Commit 0d30738

Browse files
committed
asn1: represent F1AP IE through the value type instead of via a template
1 parent 67a4245 commit 0d30738

File tree

48 files changed

+11661
-9222
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+11661
-9222
lines changed

apps/examples/du/du_example.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,9 @@ class dummy_cu_cp_handler : public f1ap_message_notifier
207207
response.pdu.set_init_msg().load_info_obj(ASN1_F1AP_ID_DL_RRC_MSG_TRANSFER);
208208

209209
auto& resp = response.pdu.init_msg().value.dl_rrc_msg_transfer();
210-
resp->gnb_du_ue_f1ap_id->value = msg.pdu.init_msg().value.init_ul_rrc_msg_transfer()->gnb_du_ue_f1ap_id->value;
211-
resp->gnb_cu_ue_f1ap_id->value = 0;
212-
resp->srb_id->value = srb_id_to_uint(srb_id_t::srb0);
210+
resp->gnb_du_ue_f1ap_id = msg.pdu.init_msg().value.init_ul_rrc_msg_transfer()->gnb_du_ue_f1ap_id;
211+
resp->gnb_cu_ue_f1ap_id = 0;
212+
resp->srb_id = srb_id_to_uint(srb_id_t::srb0);
213213
static constexpr uint8_t msg4[] = {
214214
0x20, 0x40, 0x03, 0x82, 0xe0, 0x05, 0x80, 0x08, 0x8b, 0xd7, 0x63, 0x80, 0x83, 0x0f, 0x00, 0x03, 0xe1,
215215
0x02, 0x04, 0x68, 0x3c, 0x08, 0x01, 0x05, 0x10, 0x48, 0x24, 0x06, 0x54, 0x00, 0x07, 0xc0, 0x00, 0x00,
@@ -227,7 +227,7 @@ class dummy_cu_cp_handler : public f1ap_message_notifier
227227

228228
// Copy DU-to-CU RRC container stored in the F1AP "INITIAL UL RRC MESSAGE TRANSFER" to masterCellGroup field of
229229
// the unpacked RRC Setup message.
230-
const auto& src = msg.pdu.init_msg().value.init_ul_rrc_msg_transfer()->du_to_cu_rrc_container.value;
230+
const auto& src = msg.pdu.init_msg().value.init_ul_rrc_msg_transfer()->du_to_cu_rrc_container;
231231
asn1::dyn_octstring& dest = msg4_rrc.msg.c1().rrc_setup().crit_exts.rrc_setup().master_cell_group;
232232
dest = src.copy();
233233

@@ -237,8 +237,8 @@ class dummy_cu_cp_handler : public f1ap_message_notifier
237237
msg4_rrc.pack(w_bref);
238238

239239
// Store the packed RRC setup message in the RRC container field of the F1 DL RRC Message that is sent to the DU.
240-
resp->rrc_container.value.resize(msg4_pdu.length());
241-
std::copy(msg4_pdu.begin(), msg4_pdu.end(), resp->rrc_container.value.begin());
240+
resp->rrc_container.resize(msg4_pdu.length());
241+
std::copy(msg4_pdu.begin(), msg4_pdu.end(), resp->rrc_container.begin());
242242
} else if (msg.pdu.init_msg().value.type().value ==
243243
asn1::f1ap::f1ap_elem_procs_o::init_msg_c::types_opts::f1_setup_request) {
244244
// Generate a dummy F1 Setup response message and pass it back to the DU.
@@ -247,10 +247,10 @@ class dummy_cu_cp_handler : public f1ap_message_notifier
247247

248248
auto& setup_res = response.pdu.successful_outcome().value.f1_setup_resp();
249249
// Use the same transaction ID as in the request message.
250-
setup_res->transaction_id.value = msg.pdu.init_msg().value.f1_setup_request()->transaction_id.value;
251-
setup_res->gnb_cu_name_present = true;
252-
setup_res->gnb_cu_name.value.from_string("srsCU");
253-
setup_res->gnb_cu_rrc_version.value.latest_rrc_version.from_number(2);
250+
setup_res->transaction_id = msg.pdu.init_msg().value.f1_setup_request()->transaction_id;
251+
setup_res->gnb_cu_name_present = true;
252+
setup_res->gnb_cu_name.from_string("srsCU");
253+
setup_res->gnb_cu_rrc_version.latest_rrc_version.from_number(2);
254254
} else {
255255
srsran::byte_buffer buffer;
256256
asn1::bit_ref bref(buffer);

include/srsran/asn1/asn1_utils.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,6 +1804,29 @@ template <class ExtensionSetParam>
18041804
struct protocol_ext_field_s : public detail::base_ie_field<detail::ie_field_ext_item<ExtensionSetParam>> {
18051805
};
18061806

1807+
template <typename IEValue>
1808+
SRSASN_CODE pack_ie_container_item(bit_ref& bref, uint32_t id, crit_e crit, const IEValue& value)
1809+
{
1810+
HANDLE_CODE(pack_integer(bref, id, (uint32_t)0u, (uint32_t)65535u, false, true));
1811+
HANDLE_CODE(crit.pack(bref));
1812+
{
1813+
varlength_field_pack_guard varlen_scope(bref, true);
1814+
HANDLE_CODE(value.pack(bref));
1815+
}
1816+
return SRSASN_SUCCESS;
1817+
}
1818+
1819+
template <typename IEValue>
1820+
void ie_container_item_to_json(json_writer& j, uint32_t id, crit_e crit, const char* value_name, const IEValue& value)
1821+
{
1822+
j.start_obj();
1823+
j.write_int("id", id);
1824+
j.write_str("criticality", crit.to_string());
1825+
j.write_fieldname(value_name);
1826+
asn1::to_json(j, value);
1827+
j.end_obj();
1828+
}
1829+
18071830
namespace detail {
18081831

18091832
template <typename T>

include/srsran/asn1/f1ap/f1ap_ies.h

Lines changed: 353 additions & 393 deletions
Large diffs are not rendered by default.

include/srsran/asn1/f1ap/f1ap_pdu_contents.h

Lines changed: 772 additions & 957 deletions
Large diffs are not rendered by default.

include/srsran/asn1/f1ap/f1ap_pdu_contents_ue.h

Lines changed: 528 additions & 604 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)