Change in osmo-bsc[master]: cosmetic: reduce bsc_api.h

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Tue Jul 24 16:13:32 UTC 2018


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/10147


Change subject: cosmetic: reduce bsc_api.h
......................................................................

cosmetic: reduce bsc_api.h

Remove as much as possible from bsc_api.h. Use '#pragma once'. Tweak head
comment.

BSC_API_CONN_POL_{ACCEPT,REJECT}: only user is static complete_layer3(), just
use a bool return value instead.

msc_connected(): only used in osmo_bsc_api.c, make static there.

Instead of including gsm_data.h, declare structs opaquely, include stdint.h.
codec_pref_test.c used this as indirect gsm_data.h include via osmo_bsc.h,
include gsm_data.h there directly.

osmo_bsc.h: instead of including bsc_api.h, declare opaque structs.

gsm_04_08_rr.h: declare opaque structs to replace indirect include of
gsm_data.h.

Change-Id: Ia9c0f9828317236048e40ec9ecf9990592e2190a
---
M include/osmocom/bsc/bsc_api.h
M include/osmocom/bsc/gsm_04_08_rr.h
M include/osmocom/bsc/osmo_bsc.h
M src/osmo-bsc/osmo_bsc_api.c
4 files changed, 30 insertions(+), 25 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/47/10147/1

diff --git a/include/osmocom/bsc/bsc_api.h b/include/osmocom/bsc/bsc_api.h
index dcfcc45..5241295 100644
--- a/include/osmocom/bsc/bsc_api.h
+++ b/include/osmocom/bsc/bsc_api.h
@@ -1,12 +1,10 @@
-/* GSM 08.08 like API for OpenBSC */
+/* GSM 08.08 function declarations for osmo-bsc */
 
-#ifndef OPENBSC_BSC_API_H
-#define OPENBSC_BSC_API_H
+#pragma once
 
-#include "gsm_data.h"
+#include <stdint.h>
 
-#define BSC_API_CONN_POL_ACCEPT	0
-#define BSC_API_CONN_POL_REJECT	1
+struct gsm_subscriber_connection;
 
 void bsc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci);
 void bsc_cipher_mode_compl(struct gsm_subscriber_connection *conn, struct msgb *msg, uint8_t chosen_encr);
@@ -16,11 +14,3 @@
 void bsc_cm_update(struct gsm_subscriber_connection *conn,
 		   const uint8_t *cm2, uint8_t cm2_len,
 		   const uint8_t *cm3, uint8_t cm3_len);
-
-int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn, struct msgb *msg, uint8_t link_id,
-			bool allow_sacch);
-int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate);
-int gsm0808_clear(struct gsm_subscriber_connection *conn);
-
-bool msc_connected(struct gsm_subscriber_connection *conn);
-#endif
diff --git a/include/osmocom/bsc/gsm_04_08_rr.h b/include/osmocom/bsc/gsm_04_08_rr.h
index 63bec7a..8f46922 100644
--- a/include/osmocom/bsc/gsm_04_08_rr.h
+++ b/include/osmocom/bsc/gsm_04_08_rr.h
@@ -1,5 +1,18 @@
 #pragma once
 
+#include <stdint.h>
+
+struct amr_mode;
+struct amr_multirate_conf;
+struct bsc_subscr;
+struct gsm48_chan_desc;
+struct gsm48_pag_resp;
+struct gsm_lchan;
+struct gsm_meas_rep;
+struct gsm_network;
+struct gsm_subscriber_connection;
+struct msgb;
+
 void gsm_net_update_ctype(struct gsm_network *network);
 enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *network, uint8_t ra);
 int get_reason_by_chreq(uint8_t ra, int neci);
diff --git a/include/osmocom/bsc/osmo_bsc.h b/include/osmocom/bsc/osmo_bsc.h
index 0e19b0b..bebfb2f 100644
--- a/include/osmocom/bsc/osmo_bsc.h
+++ b/include/osmocom/bsc/osmo_bsc.h
@@ -2,7 +2,6 @@
 
 #include <osmocom/gsm/protocol/gsm_04_08.h>
 
-#include <osmocom/bsc/bsc_api.h>
 #include <osmocom/bsc/bsc_msg_filter.h>
 
 #define BSS_SEND_USSD 1
@@ -18,6 +17,8 @@
 struct gsm0808_channel_type;
 struct gsm0808_speech_codec_list;
 struct gsm_audio_support;
+struct gsm_subscriber_connection;
+struct gsm_bts;
 
 struct bsc_api *osmo_bsc_api();
 
diff --git a/src/osmo-bsc/osmo_bsc_api.c b/src/osmo-bsc/osmo_bsc_api.c
index b4d080d..dfec19a 100644
--- a/src/osmo-bsc/osmo_bsc_api.c
+++ b/src/osmo-bsc/osmo_bsc_api.c
@@ -23,6 +23,7 @@
 #include <osmocom/bsc/bsc_subscriber.h>
 #include <osmocom/bsc/debug.h>
 #include <osmocom/bsc/paging.h>
+#include <osmocom/bsc/bsc_api.h>
 
 #include <osmocom/bsc/gsm_04_80.h>
 #include <osmocom/bsc/gsm_04_08_rr.h>
@@ -36,7 +37,7 @@
 #include <osmocom/bsc/osmo_bsc_sigtran.h>
 
 /* Check if we have a proper connection to the MSC */
-bool msc_connected(struct gsm_subscriber_connection *conn)
+static bool msc_connected(struct gsm_subscriber_connection *conn)
 {
 	/* No subscriber conn at all */
 	if (!conn)
@@ -53,8 +54,8 @@
 	return true;
 }
 
-static int complete_layer3(struct gsm_subscriber_connection *conn,
-			   struct msgb *msg, struct bsc_msc_data *msc);
+static bool complete_layer3(struct gsm_subscriber_connection *conn,
+			    struct msgb *msg, struct bsc_msc_data *msc);
 
 static struct osmo_cell_global_id *cgi_for_msc(struct bsc_msc_data *msc, struct gsm_bts *bts)
 {
@@ -438,8 +439,8 @@
 	return 0;
 }
 
-static int complete_layer3(struct gsm_subscriber_connection *conn,
-			   struct msgb *msg, struct bsc_msc_data *msc)
+static bool complete_layer3(struct gsm_subscriber_connection *conn,
+			    struct msgb *msg, struct bsc_msc_data *msc)
 {
 	int con_type, rc, lu_cause;
 	char *imsi = NULL;
@@ -451,7 +452,7 @@
 				&imsi, &con_type, &lu_cause);
 	if (rc < 0) {
 		bsc_maybe_lu_reject(conn, con_type, lu_cause);
-		return BSC_API_CONN_POL_REJECT;
+		return false;
 	}
 
 	/* allocate resource for a new connection */
@@ -464,7 +465,7 @@
 		else if (ret == BSC_CON_REJECT_RF_GRACE)
 			bsc_send_ussd_no_srv(conn, msg, msc->ussd_grace_txt);
 
-		return BSC_API_CONN_POL_REJECT;
+		return false;
 	}
 
 	/* TODO: also extract TMSI. We get an IMSI only when an initial L3 Complete comes in that
@@ -493,12 +494,12 @@
 	resp = gsm0808_create_layer3_2(msg, cgi_for_msc(conn->sccp.msc, conn_get_bts(conn)), NULL);
 	if (!resp) {
 		LOGP(DMSC, LOGL_DEBUG, "Failed to create layer3 message.\n");
-		return BSC_API_CONN_POL_REJECT;
+		return false;
 	}
 
 	osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_A_CONN_REQ, resp);
 
-	return BSC_API_CONN_POL_ACCEPT;
+	return true;
 }
 
 /*
@@ -519,7 +520,7 @@
 	 * MSC. If it fails the caller will need to handle this
 	 * properly.
 	 */
-	if (complete_layer3(_conn, msg, msc) != BSC_API_CONN_POL_ACCEPT) {
+	if (!complete_layer3(_conn, msg, msc)) {
 		/* FIXME: I have not the slightest idea what move_to_msc() intends to do; during lchan
 		 * FSM introduction, I changed this and hope it is the appropriate action. I actually
 		 * assume this is unused legacy code for osmo-bsc_nat?? */

-- 
To view, visit https://gerrit.osmocom.org/10147
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9c0f9828317236048e40ec9ecf9990592e2190a
Gerrit-Change-Number: 10147
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180724/bee07bae/attachment.htm>


More information about the gerrit-log mailing list