pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/39980?usp=email ) Change subject: ranap_common_ran: remove unused ctx args ...................................................................... ranap_common_ran: remove unused ctx args This commit is basically 8b6dad3331eab339a7ffea7c22ed1830fe9ced60 applied to ranap_common_ran instead of ranap_common_cn. ranap_ran_rx_co has a void *ctx argument, that gets passed to: * a callback function and * to various decode functions in the same file. As it is named "ctx", it looks like a talloc context. But the decode functions don't use ctx at all and so in reality it is private userdata for the callback. It is used as such by test/hnb-test-rua and in osmo-msc. Change-Id: I57b320c2fdd72d11b87507d0cd9c2e7b479e7fe4 --- M TODO-RELEASE M include/osmocom/ranap/ranap_common_ran.h M src/ranap_common_ran.c 3 files changed, 16 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/80/39980/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index 0ed7189..34f3506 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,5 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +libosmo-ranap add API ranap_ran_rx_co_decode2() +libosmo-ranap deprecate API ranap_ran_rx_co_decode() diff --git a/include/osmocom/ranap/ranap_common_ran.h b/include/osmocom/ranap/ranap_common_ran.h index 5eef272..7118c7e 100644 --- a/include/osmocom/ranap/ranap_common_ran.h +++ b/include/osmocom/ranap/ranap_common_ran.h @@ -9,7 +9,9 @@ void ranap_ran_rx_co_free(ranap_message *message); /* decode a connection-oriented RANAP message */ -int ranap_ran_rx_co_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len); +int ranap_ran_rx_co_decode2(ranap_message *message, uint8_t *data, size_t len); +int ranap_ran_rx_co_decode(void *unused, ranap_message *message, uint8_t *data, size_t len) + OSMO_DEPRECATED("Use ranap_ran_rx_co_decode2() instead, the first arg is not used"); /* receive a connection-oriented RANAP message */ int ranap_ran_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len); diff --git a/src/ranap_common_ran.c b/src/ranap_common_ran.c index 828587e..fe11610 100644 --- a/src/ranap_common_ran.c +++ b/src/ranap_common_ran.c @@ -33,7 +33,7 @@ #define DRANAP _ranap_DRANAP -static int ran_ranap_rx_initiating_msg_co(void *ctx, RANAP_InitiatingMessage_t *imsg, ranap_message *message) +static int ran_ranap_rx_initiating_msg_co(RANAP_InitiatingMessage_t *imsg, ranap_message *message) { int rc = 0; @@ -232,13 +232,13 @@ } } -static int _ran_ranap_rx_co(void *ctx, RANAP_RANAP_PDU_t *pdu, ranap_message *message) +static int _ran_ranap_rx_co(RANAP_RANAP_PDU_t *pdu, ranap_message *message) { int rc = 0; switch (pdu->present) { case RANAP_RANAP_PDU_PR_initiatingMessage: - rc = ran_ranap_rx_initiating_msg_co(ctx, &pdu->choice.initiatingMessage, message); + rc = ran_ranap_rx_initiating_msg_co(&pdu->choice.initiatingMessage, message); break; case RANAP_RANAP_PDU_PR_successfulOutcome: rc = ran_ranap_rx_successful_msg_co(&pdu->choice.successfulOutcome, message); @@ -289,7 +289,7 @@ } /* decode a connection-oriented RANAP message */ -int ranap_ran_rx_co_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len) +int ranap_ran_rx_co_decode2(ranap_message *message, uint8_t *data, size_t len) { RANAP_RANAP_PDU_t *pdu = NULL; asn_dec_rval_t dec_ret; @@ -306,7 +306,7 @@ message->direction = pdu->present; - rc = _ran_ranap_rx_co(ctx, pdu, message); + rc = _ran_ranap_rx_co(pdu, message); error_free: ASN_STRUCT_FREE(asn_DEF_RANAP_RANAP_PDU, pdu); @@ -314,6 +314,11 @@ return rc; } +int ranap_ran_rx_co_decode(void *unused, ranap_message *message, uint8_t *data, size_t len) +{ + return ranap_ran_rx_co_decode2(message, data, len); +} + /* receive a connection-oriented RANAP message and call * cn_ranap_handle_co() with the resulting ranap_message struct */ int ranap_ran_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len) @@ -321,7 +326,7 @@ ranap_message message; int rc; - rc = ranap_ran_rx_co_decode(ctx, &message, data, len); + rc = ranap_ran_rx_co_decode2(&message, data, len); if (rc == 0) (*cb) (ctx, &message); -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/39980?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I57b320c2fdd72d11b87507d0cd9c2e7b479e7fe4 Gerrit-Change-Number: 39980 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin@sysmocom.de>