pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/40268?usp=email )
Change subject: Introduce func helper hnbgw_sccp_user_get_sccp_instance() ......................................................................
Introduce func helper hnbgw_sccp_user_get_sccp_instance()
This way we keep struct field access within the header file.
Change-Id: I1684fa1871098ab6df7c79c9c0e0daf6c6f35b09 --- M include/osmocom/hnbgw/cnlink.h M include/osmocom/hnbgw/hnbgw_sccp.h 2 files changed, 8 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/68/40268/1
diff --git a/include/osmocom/hnbgw/cnlink.h b/include/osmocom/hnbgw/cnlink.h index c4e494d..fd1b7de 100644 --- a/include/osmocom/hnbgw/cnlink.h +++ b/include/osmocom/hnbgw/cnlink.h @@ -108,9 +108,7 @@ return NULL; if (!cnlink->hnbgw_sccp_user) return NULL; - if (!cnlink->hnbgw_sccp_user->ss7) - return NULL; - return osmo_ss7_get_sccp(cnlink->hnbgw_sccp_user->ss7); + return hnbgw_sccp_user_get_sccp_instance(cnlink->hnbgw_sccp_user); }
/* cnlink_fsm.c related: */ diff --git a/include/osmocom/hnbgw/hnbgw_sccp.h b/include/osmocom/hnbgw/hnbgw_sccp.h index d207348..4388a3a 100644 --- a/include/osmocom/hnbgw/hnbgw_sccp.h +++ b/include/osmocom/hnbgw/hnbgw_sccp.h @@ -57,3 +57,10 @@ int hnbgw_sccp_user_tx_data_req(struct hnbgw_sccp_user *hsu, uint32_t scu_conn_id, struct msgb *ranap_msg); int hnbgw_sccp_user_tx_disconnect_req(struct hnbgw_sccp_user *hsu, uint32_t scu_conn_id); + +static inline struct osmo_sccp_instance *hnbgw_sccp_user_get_sccp_instance(const struct hnbgw_sccp_user *hsu) +{ + if (!hsu->ss7) + return NULL; + return osmo_ss7_get_sccp(hsu->ss7); +}