pespin submitted this change.

View Change

Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
Move sbcap_as_find_ie() to libsbcap

This function is generic and can be (will be) used in more places.

Change-Id: Ib0c7fa12a8f6faa4271e4132ca5a5c656e717400
---
M include/osmocom/sbcap/sbcap_common.h
M src/sbcap/sbcap_common.c
M src/sbcap_link_fsm.c
3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/include/osmocom/sbcap/sbcap_common.h b/include/osmocom/sbcap/sbcap_common.h
index 303cf6d..91a95eb 100644
--- a/include/osmocom/sbcap/sbcap_common.h
+++ b/include/osmocom/sbcap/sbcap_common.h
@@ -144,6 +144,8 @@
SBcAP_ProcedureCode_t sbcap_pdu_get_procedure_code(const SBcAP_SBC_AP_PDU_t *pdu);
SBcAP_Criticality_t sbcap_pdu_get_criticality(const SBcAP_SBC_AP_PDU_t *pdu);

+void *sbcap_as_find_ie(void *void_list, SBcAP_ProtocolIE_ID_t ie_id);
+
SBcAP_Write_Replace_Warning_Request_IEs_t *sbcap_alloc_Write_Replace_Warning_Request_IE(
long id, SBcAP_Criticality_t criticality, SBcAP_Write_Replace_Warning_Request_IEs__value_PR present);

diff --git a/src/sbcap/sbcap_common.c b/src/sbcap/sbcap_common.c
index 86ca0b2..0596b53 100644
--- a/src/sbcap/sbcap_common.c
+++ b/src/sbcap/sbcap_common.c
@@ -141,6 +141,20 @@
}
}

+void *sbcap_as_find_ie(void *void_list, SBcAP_ProtocolIE_ID_t ie_id)
+{
+ A_SEQUENCE_OF(SBcAP_ProtocolIE_ID_t) *li = (void *)void_list;
+ int i;
+ for (i = 0; i < li->count; i++) {
+ /* "SBcAP_ProtocolIE_ID_t id" is first element in all *_IEs struct */
+ SBcAP_ProtocolIE_ID_t *cur_ie_id = li->array[i];
+ if (*cur_ie_id == ie_id) {
+ return cur_ie_id;
+ }
+ }
+ return NULL;
+}
+
void sbcap_set_log_area(int log_area)
{
_sbcap_DSBCAP = log_area;
diff --git a/src/sbcap_link_fsm.c b/src/sbcap_link_fsm.c
index 4f89c3c..c632a4a 100644
--- a/src/sbcap_link_fsm.c
+++ b/src/sbcap_link_fsm.c
@@ -129,20 +129,6 @@
.cleanup = sbcap_link_fsm_cleanup,
};

-static void *sbcap_as_find_ie(void *void_list, SBcAP_ProtocolIE_ID_t ie_id)
-{
- A_SEQUENCE_OF(SBcAP_ProtocolIE_ID_t) *li = (void *)void_list;
- int i;
- for (i = 0; i < li->count; i++) {
- /* "SBcAP_ProtocolIE_ID_t id" is first element in all *_IEs struct */
- SBcAP_ProtocolIE_ID_t *cur_ie_id = li->array[i];
- if (*cur_ie_id == ie_id) {
- return cur_ie_id;
- }
- }
- return NULL;
-}
-
static SBcAP_Message_Identifier_t *get_msg_id_ie(struct cbc_sbcap_link *link,
const SBcAP_SBC_AP_PDU_t *pdu)
{

2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one.

To view, visit change 28805. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: Ib0c7fa12a8f6faa4271e4132ca5a5c656e717400
Gerrit-Change-Number: 28805
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged