From 49603972aae282ffa2f98acb9ba5ef4ff25d6969 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Mon, 3 Jul 2017 12:40:46 +0200 Subject: osmo-msc/a_iface/reset: add missing const Change-Id: Id75918dfd891d9407a62a0b7cd9590932c858093 --- include/openbsc/a_iface.h | 10 +++++----- include/openbsc/a_iface_bssap.h | 4 ++-- include/openbsc/a_reset.h | 2 +- src/libcommon-cs/a_reset.c | 2 +- src/libmsc/a_iface.c | 19 ++++++++++--------- src/libmsc/a_iface_bssap.c | 40 ++++++++++++++++++++++------------------ 6 files changed, 41 insertions(+), 36 deletions(-) diff --git a/include/openbsc/a_iface.h b/include/openbsc/a_iface.h index 4a9eaf620..124a5d2ee 100644 --- a/include/openbsc/a_iface.h +++ b/include/openbsc/a_iface.h @@ -49,24 +49,24 @@ struct bsc_context { }; /* Initalize A interface connection between to MSC and BSC */ -int a_init(void *ctx, struct osmo_sccp_instance *sccp, struct gsm_network *network); +int a_init(const void *ctx, struct osmo_sccp_instance *sccp, struct gsm_network *network); /* Send DTAP message via A-interface */ int a_iface_tx_dtap(struct msgb *msg); /* Send Cipher mode command via A-interface */ -int a_iface_tx_cipher_mode(struct gsm_subscriber_connection *conn, - int cipher, const uint8_t *key, int len, int include_imeisv); +int a_iface_tx_cipher_mode(const struct gsm_subscriber_connection *conn, + int cipher, const const uint8_t *key, int len, int include_imeisv); /* Page a subscriber via A-interface */ int a_iface_tx_paging(const char *imsi, uint32_t tmsi, uint16_t lac); /* Send assignment request via A-interface */ -int a_iface_tx_assignment(struct gsm_trans *trans); +int a_iface_tx_assignment(const struct gsm_trans *trans); /* Clear all subscriber connections on a specified BSC * (Helper function for a_iface_bssap.c) */ -void a_clear_all(struct osmo_sccp_user *scu, struct osmo_sccp_addr *bsc_addr); +void a_clear_all(struct osmo_sccp_user *scu, const struct osmo_sccp_addr *bsc_addr); /* Delete info of a closed connection from the active connection list * (Helper function for a_iface_bssap.c) */ diff --git a/include/openbsc/a_iface_bssap.h b/include/openbsc/a_iface_bssap.h index 9abb29bb4..237c618fd 100644 --- a/include/openbsc/a_iface_bssap.h +++ b/include/openbsc/a_iface_bssap.h @@ -34,8 +34,8 @@ struct a_conn_info { }; /* Receive incoming connection less data messages via sccp */ -void sccp_rx_udt(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg); +void sccp_rx_udt(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg); /* Receive incoming connection oriented data messages via sccp */ -int sccp_rx_dt(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg); +int sccp_rx_dt(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg); diff --git a/include/openbsc/a_reset.h b/include/openbsc/a_reset.h index 343454a28..7aaab0620 100644 --- a/include/openbsc/a_reset.h +++ b/include/openbsc/a_reset.h @@ -45,7 +45,7 @@ struct a_reset_ctx { }; /* Create and start state machine which handles the reset/reset-ack procedure */ -struct a_reset_ctx *a_reset_alloc(void *ctx, char *name, void *cb, void *priv); +struct a_reset_ctx *a_reset_alloc(const void *ctx, const char *name, void *cb, void *priv); /* Tear down state machine */ void a_reset_free(struct a_reset_ctx *reset); diff --git a/src/libcommon-cs/a_reset.c b/src/libcommon-cs/a_reset.c index a6110a22b..c0294c797 100644 --- a/src/libcommon-cs/a_reset.c +++ b/src/libcommon-cs/a_reset.c @@ -132,7 +132,7 @@ static struct osmo_fsm fsm = { }; /* Create and start state machine which handles the reset/reset-ack procedure */ -struct a_reset_ctx *a_reset_alloc(void *ctx, char *name, void *cb, void *priv) +struct a_reset_ctx *a_reset_alloc(const void *ctx, const char *name, void *cb, void *priv) { OSMO_ASSERT(name); diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c index 5ca631d03..f98a1c6bc 100644 --- a/src/libmsc/a_iface.c +++ b/src/libmsc/a_iface.c @@ -61,7 +61,7 @@ struct bsc_conn { static LLIST_HEAD(active_connections); /* Record info of a new active connection in the active connection list */ -static void record_bsc_con(void *ctx, uint32_t conn_id) +static void record_bsc_con(const void *ctx, uint32_t conn_id) { struct bsc_conn *conn; @@ -103,7 +103,7 @@ static bool check_connection_active(uint32_t conn_id) } /* Get the reset context for a specifiec calling (BSC) address */ -static struct a_reset_ctx *get_reset_ctx_by_sccp_addr(struct osmo_sccp_addr *addr) +static struct a_reset_ctx *get_reset_ctx_by_sccp_addr(const struct osmo_sccp_addr *addr) { struct bsc_context *bsc_ctx; @@ -148,8 +148,8 @@ int a_iface_tx_dtap(struct msgb *msg) } /* Send Cipher mode command via A-interface */ -int a_iface_tx_cipher_mode(struct gsm_subscriber_connection *conn, - int cipher, const uint8_t *key, int len, int include_imeisv) +int a_iface_tx_cipher_mode(const struct gsm_subscriber_connection *conn, + int cipher, const const uint8_t *key, int len, int include_imeisv) { /* TODO generalize for A- and Iu interfaces, don't name after 08.08 */ struct msgb *msg_resp; @@ -355,7 +355,7 @@ static int enc_speech_codec_list(struct gsm0808_speech_codec_list *scl, const st } /* Send assignment request via A-interface */ -int a_iface_tx_assignment(struct gsm_trans *trans) +int a_iface_tx_assignment(const struct gsm_trans *trans) { struct gsm_subscriber_connection *conn; struct gsm0808_channel_type ct; @@ -400,7 +400,7 @@ int a_iface_tx_assignment(struct gsm_trans *trans) } /* Callback function: Close all open connections */ -static void a_reset_cb(void *priv) +static void a_reset_cb(const void *priv) { struct msgb *msg; struct bsc_context *bsc_ctx = (struct bsc_context*) priv; @@ -420,7 +420,8 @@ static void a_reset_cb(void *priv) } /* Add a new BSC connection to our internal list with known BSCs */ -static void add_bsc(struct osmo_sccp_addr *msc_addr, struct osmo_sccp_addr *bsc_addr, struct osmo_sccp_user *scu) +static void add_bsc(const struct osmo_sccp_addr *msc_addr, const struct osmo_sccp_addr *bsc_addr, + struct osmo_sccp_user *scu) { struct bsc_context *bsc_ctx; @@ -510,7 +511,7 @@ static int sccp_sap_up(struct osmo_prim_hdr *oph, void *_scu) } /* Clear all subscriber connections on a specified BSC */ -void a_clear_all(struct osmo_sccp_user *scu, struct osmo_sccp_addr *bsc_addr) +void a_clear_all(struct osmo_sccp_user *scu, const struct osmo_sccp_addr *bsc_addr) { struct gsm_subscriber_connection *conn; struct gsm_subscriber_connection *conn_temp; @@ -538,7 +539,7 @@ void a_clear_all(struct osmo_sccp_user *scu, struct osmo_sccp_addr *bsc_addr) } /* Initalize A interface connection between to MSC and BSC */ -int a_init(void *ctx, struct osmo_sccp_instance *sccp, struct gsm_network *network) +int a_init(const void *ctx, struct osmo_sccp_instance *sccp, struct gsm_network *network) { OSMO_ASSERT(sccp); OSMO_ASSERT(network); diff --git a/src/libmsc/a_iface_bssap.c b/src/libmsc/a_iface_bssap.c index 95b8fcdd5..0931544dc 100644 --- a/src/libmsc/a_iface_bssap.c +++ b/src/libmsc/a_iface_bssap.c @@ -41,7 +41,7 @@ */ /* Allocate a new subscriber connection */ -static struct gsm_subscriber_connection *subscr_conn_allocate_a(struct a_conn_info *a_conn_info, +static struct gsm_subscriber_connection *subscr_conn_allocate_a(const struct a_conn_info *a_conn_info, struct gsm_network *network, struct ue_conn_ctx *ue, uint16_t lac, struct osmo_sccp_user *scu, int conn_id) { @@ -73,7 +73,7 @@ static struct gsm_subscriber_connection *subscr_conn_allocate_a(struct a_conn_in /* Return an existing A subscriber connection record for the given * connection IDs, or return NULL if not found. */ -struct gsm_subscriber_connection *subscr_conn_lookup_a(struct gsm_network *network, int conn_id) +struct gsm_subscriber_connection *subscr_conn_lookup_a(const struct gsm_network *network, int conn_id) { struct gsm_subscriber_connection *conn; @@ -100,7 +100,7 @@ struct gsm_subscriber_connection *subscr_conn_lookup_a(struct gsm_network *netwo */ /* Endpoint to handle BSSMAP reset */ -static void bssmap_rx_reset(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static void bssmap_rx_reset(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { LOGP(DMSC, LOGL_NOTICE, "Rx RESET from BSC %s, sending RESET ACK\n", osmo_sccp_addr_dump(a_conn_info->bsc_addr)); osmo_sccp_tx_unitdata_msg(scu, a_conn_info->msc_addr, a_conn_info->bsc_addr, gsm0808_create_reset_ack()); @@ -112,7 +112,8 @@ static void bssmap_rx_reset(struct osmo_sccp_user *scu, struct a_conn_info *a_co } /* Endpoint to handle BSSMAP reset acknowlegement */ -static void bssmap_rx_reset_ack(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static void bssmap_rx_reset_ack(const struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, + struct msgb *msg) { if (a_conn_info->reset == NULL) { LOGP(DMSC, LOGL_ERROR, "Received RESET ACK from an unknown BSC %s, ignoring...\n", @@ -132,7 +133,7 @@ fail: } /* Handle UNITDATA BSSMAP messages */ -static void bssmap_rcvmsg_udt(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static void bssmap_rcvmsg_udt(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { /* Note: When in the MSC role, RESET ACK is the only valid message that * can be received via UNITDATA */ @@ -159,7 +160,7 @@ static void bssmap_rcvmsg_udt(struct osmo_sccp_user *scu, struct a_conn_info *a_ } /* Receive incoming connection less data messages via sccp */ -void sccp_rx_udt(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +void sccp_rx_udt(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { /* Note: The only valid message type that can be received * via UNITDATA are BSS Management messages */ @@ -201,7 +202,7 @@ void sccp_rx_udt(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, st */ /* Endpoint to handle BSSMAP clear request */ -static int bssmap_rx_clear_rqst(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static int bssmap_rx_clear_rqst(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { struct gsm_network *network = a_conn_info->network; struct tlv_parsed tp; @@ -238,7 +239,7 @@ fail: } /* Endpoint to handle BSSMAP clear complete */ -static int bssmap_rx_clear_complete(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static int bssmap_rx_clear_complete(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { int rc; @@ -254,7 +255,7 @@ static int bssmap_rx_clear_complete(struct osmo_sccp_user *scu, struct a_conn_in } /* Endpoint to handle layer 3 complete messages */ -static int bssmap_rx_l3_compl(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static int bssmap_rx_l3_compl(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { struct tlv_parsed tp; struct { @@ -337,7 +338,7 @@ fail: } /* Endpoint to handle BSSMAP classmark update */ -static int bssmap_rx_classmark_upd(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static int bssmap_rx_classmark_upd(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { struct gsm_network *network = a_conn_info->network; struct gsm_subscriber_connection *conn; @@ -379,7 +380,8 @@ fail: } /* Endpoint to handle BSSMAP cipher mode complete */ -static int bssmap_rx_ciph_compl(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static int bssmap_rx_ciph_compl(const struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, + struct msgb *msg) { /* FIXME: The field GSM0808_IE_LAYER_3_MESSAGE_CONTENTS is optional by * means of the specification. So there can be messages without L3 info. @@ -424,7 +426,7 @@ fail: } /* Endpoint to handle BSSMAP cipher mode reject */ -static int bssmap_rx_ciph_rej(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static int bssmap_rx_ciph_rej(const struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { struct gsm_network *network = a_conn_info->network; struct gsm_subscriber_connection *conn; @@ -457,7 +459,7 @@ fail: } /* Endpoint to handle BSSMAP assignment failure */ -static int bssmap_rx_ass_fail(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static int bssmap_rx_ass_fail(const struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { struct gsm_network *network = a_conn_info->network; struct gsm_subscriber_connection *conn; @@ -501,7 +503,8 @@ fail: } /* Endpoint to handle sapi "n" reject */ -static int bssmap_rx_sapi_n_rej(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static int bssmap_rx_sapi_n_rej(const struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, + struct msgb *msg) { struct gsm_network *network = a_conn_info->network; struct gsm_subscriber_connection *conn; @@ -541,7 +544,8 @@ fail: } /* Endpoint to handle assignment complete */ -static int bssmap_rx_ass_compl(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static int bssmap_rx_ass_compl(const struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, + struct msgb *msg) { struct gsm_network *network = a_conn_info->network; struct gsm_subscriber_connection *conn; @@ -601,7 +605,7 @@ fail: } /* Handle incoming connection oriented BSSMAP messages */ -static int rx_bssmap(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static int rx_bssmap(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { if (msgb_l3len(msg) < 1) { LOGP(DMSC, LOGL_NOTICE, "Error: No data received -- discarding message!\n"); @@ -649,7 +653,7 @@ static int rx_bssmap(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info } /* Endpoint to handle regular BSSAP DTAP messages */ -static int rx_dtap(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +static int rx_dtap(const struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { struct gsm_network *network = a_conn_info->network; struct gsm_subscriber_connection *conn; @@ -673,7 +677,7 @@ static int rx_dtap(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, } /* Handle incoming connection oriented messages */ -int sccp_rx_dt(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg) +int sccp_rx_dt(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { OSMO_ASSERT(scu); OSMO_ASSERT(a_conn_info); -- cgit v1.2.3