Change in libosmocore[master]: ns2: move LL into public api

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/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Thu Nov 19 02:05:21 UTC 2020


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/21246 )


Change subject: ns2: move LL into public api
......................................................................

ns2: move LL into public api

Also fix prefix. GPRS_NS -> GPRS_NS2.
In preparation to move LL into upper layer.

Change-Id: I3b5e0d51ce69b095095e5160ca0cf0d4534db1b8
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_fr.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_udp.c
M src/gb/gprs_ns2_vty.c
6 files changed, 37 insertions(+), 37 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/46/21246/1

diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index c13d315..70b4bca 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -32,6 +32,14 @@
 	NS2_VC_MODE_ALIVE,
 };
 
+/*! Osmocom NS link layer types */
+enum gprs_ns2_ll {
+	GPRS_NS2_LL_UDP,	/*!< NS/UDP/IP */
+	GPRS_NS2_LL_E1,		/*!< NS/E1 */
+	GPRS_NS2_LL_FR,		/*!< NS/FR */
+	GPRS_NS2_LL_FR_GRE,	/*!< NS/FR/GRE/IP */
+};
+
 /*! Osmocom NS primitives according to 48.016 5.2 Service primitves */
 enum gprs_ns2_prim {
 	PRIM_NS_UNIT_DATA,
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 602bca7..004d0ad 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -227,7 +227,7 @@
 		return NULL;
 
 	switch (nsvc->ll) {
-	case GPRS_NS_LL_UDP:
+	case GPRS_NS2_LL_UDP:
 		if (!gprs_ns2_is_ip_bind(nsvc->bind)) {
 			buf[0] = '\0';
 			return buf;
@@ -250,13 +250,13 @@
 				 local_str.ip, local_str.port,
 				 remote_str.ip, remote_str.port);
 		break;
-	case GPRS_NS_LL_FR_GRE:
+	case GPRS_NS2_LL_FR_GRE:
 		snprintf(buf, buf_len, "frgre)");
 		break;
-	case GPRS_NS_LL_E1:
+	case GPRS_NS2_LL_E1:
 		snprintf(buf, buf_len, "e1)");
 		break;
-	case GPRS_NS_LL_FR:
+	case GPRS_NS2_LL_FR:
 		snprintf(buf, buf_len, "fr)netif: %s dlci: %s", "hdlcX", "unsupported");
 		break;
 	default:
@@ -392,7 +392,7 @@
 		/* signalling */
 		nsvc = ns2_load_sharing_signal(nse);
 	} else {
-		enum gprs_ns_ll ll;
+		enum gprs_ns2_ll ll;
 
 		/* data with load sharing parameter */
 		if (llist_empty(&nse->nsvc))
@@ -401,7 +401,7 @@
 		ll = nsvc->ll;
 
 		switch (ll) {
-		case GPRS_NS_LL_FR:
+		case GPRS_NS2_LL_FR:
 			nsvc = ns2_load_sharing_modulor(nse, bvci, link_selector);
 			break;
 		default:
@@ -850,7 +850,7 @@
 	if (!nsvc)
 		return GPRS_NS2_CS_SKIPPED;
 
-	nsvc->ll = GPRS_NS_LL_UDP;
+	nsvc->ll = GPRS_NS2_LL_UDP;
 
 	nsvci = tlvp_val16be(&tp, NS_IE_VCI);
 	nsvc->nsvci = nsvci;
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index c04a7d1..40ea64c 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -523,7 +523,7 @@
 
 	nsvc->nsvci = nsvci;
 	nsvc->nsvci_is_valid = true;
-	nsvc->ll = GPRS_NS_LL_FR;
+	nsvc->ll = GPRS_NS2_LL_FR;
 
 	gprs_ns2_vc_fsm_start(nsvc);
 
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index 78b6d82..2c74bab 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -56,14 +56,6 @@
 	NS_STAT_ALIVE_DELAY,
 };
 
-/*! Osmocom NS link layer types */
-enum gprs_ns_ll {
-	GPRS_NS_LL_UDP,		/*!< NS/UDP/IP */
-	GPRS_NS_LL_E1,		/*!< NS/E1 */
-	GPRS_NS_LL_FR,		/*!< NS/FR */
-	GPRS_NS_LL_FR_GRE,	/*!< NS/FR/GRE/IP */
-};
-
 /*! Osmocom NS2 VC create status */
 enum gprs_ns2_cs {
 	GPRS_NS2_CS_CREATED,     /*!< A NSVC object has been created */
@@ -173,7 +165,7 @@
 	struct osmo_stat_item_group *statg;
 
 	/*! which link-layer are we based on? */
-	enum gprs_ns_ll ll;
+	enum gprs_ns2_ll ll;
 	enum gprs_ns2_vc_mode mode;
 
 	struct osmo_fsm_inst *fi;
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c
index 26a0483..38c1a16 100644
--- a/src/gb/gprs_ns2_udp.c
+++ b/src/gb/gprs_ns2_udp.c
@@ -391,7 +391,7 @@
 	priv = nsvc->priv;
 	priv->remote = *remote;
 
-	nsvc->ll = GPRS_NS_LL_UDP;
+	nsvc->ll = GPRS_NS2_LL_UDP;
 
 	return nsvc;
 }
@@ -403,7 +403,7 @@
 {
 	struct priv_bind *priv;
 
-	if (nsvc->ll != GPRS_NS_LL_UDP)
+	if (nsvc->ll != GPRS_NS2_LL_UDP)
 		return NULL;
 
 	if (nsvc->bind->driver != &vc_driver_ip)
@@ -420,7 +420,7 @@
 {
 	struct priv_vc *priv;
 
-	if (nsvc->ll != GPRS_NS_LL_UDP)
+	if (nsvc->ll != GPRS_NS2_LL_UDP)
 		return NULL;
 
 	priv = nsvc->priv;
@@ -442,7 +442,7 @@
 	struct priv_vc *vpriv;
 	struct priv_bind *bpriv;
 
-	if (nsvc->ll != GPRS_NS_LL_UDP)
+	if (nsvc->ll != GPRS_NS2_LL_UDP)
 		return false;
 
 	vpriv = nsvc->priv;
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 28bf0ac..57b92e9 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -72,7 +72,7 @@
 	struct llist_head list;
 
 	struct osmo_sockaddr_str remote;
-	enum gprs_ns_ll ll;
+	enum gprs_ns2_ll ll;
 
 	/* old vty code doesnt support multiple NSVCI per NSEI */
 	uint16_t nsei;
@@ -213,7 +213,7 @@
 			vtyvc->remote_end_is_sgsn ? "sgsn" : "bss", VTY_NEWLINE);
 
 		switch (vtyvc->ll) {
-		case GPRS_NS_LL_UDP:
+		case GPRS_NS2_LL_UDP:
 			vty_out(vty, " nse %u nsvci %u encapsulation udp%s", vtyvc->nsei, vtyvc->nsvci,
 				VTY_NEWLINE);
 			vty_out(vty, " nse %u nsvci %u remote-ip %s%s", vtyvc->nsei, vtyvc->nsvci,
@@ -221,7 +221,7 @@
 			vty_out(vty, " nse %u nsvci %u remote-port %u%s", vtyvc->nsei, vtyvc->nsvci,
 				vtyvc->remote.port, VTY_NEWLINE);
 			break;
-		case GPRS_NS_LL_FR_GRE:
+		case GPRS_NS2_LL_FR_GRE:
 			vty_out(vty, " nse %u nsvci %u encapsulation framerelay-gre%s", vtyvc->nsei,
 				vtyvc->nsvci, VTY_NEWLINE);
 			vty_out(vty, " nse %u nsvci %u remote-ip %s%s", vtyvc->nsei, vtyvc->nsvci,
@@ -229,7 +229,7 @@
 			vty_out(vty, " nse %u nsvci %u fr-dlci %u%s", vtyvc->nsei, vtyvc->nsvci,
 				vtyvc->frdlci, VTY_NEWLINE);
 			break;
-		case GPRS_NS_LL_FR:
+		case GPRS_NS2_LL_FR:
 			vty_out(vty, " nse %u nsvci %u fr %s dlci %u%s", vtyvc->nsei, vtyvc->nsvci,
 				vtyvc->netif, vtyvc->frdlci, VTY_NEWLINE);
 			break;
@@ -400,7 +400,7 @@
 	osmo_strlcpy(vtyvc->netif, name, sizeof(vtyvc->netif));
 	vtyvc->frdlci = dlci;
 	vtyvc->nsvci = nsvci;
-	vtyvc->ll = GPRS_NS_LL_FR;
+	vtyvc->ll = GPRS_NS2_LL_FR;
 
 	return CMD_SUCCESS;
 }
@@ -495,7 +495,7 @@
 		return CMD_WARNING;
 	}
 
-	if (vtyvc->ll != GPRS_NS_LL_FR_GRE) {
+	if (vtyvc->ll != GPRS_NS2_LL_FR_GRE) {
 		vty_out(vty, "Warning: seting FR DLCI on non-FR NSE%s",
 			VTY_NEWLINE);
 	}
@@ -524,9 +524,9 @@
 	}
 
 	if (!strcmp(argv[2], "udp"))
-		vtyvc->ll = GPRS_NS_LL_UDP;
+		vtyvc->ll = GPRS_NS2_LL_UDP;
 	else
-		vtyvc->ll = GPRS_NS_LL_FR_GRE;
+		vtyvc->ll = GPRS_NS2_LL_FR_GRE;
 
 	return CMD_SUCCESS;
 }
@@ -823,7 +823,7 @@
 	llist_for_each_entry(vtyvc, &priv.vtyvc, list) {
 		/* validate settings */
 		switch (vtyvc->ll) {
-		case GPRS_NS_LL_UDP:
+		case GPRS_NS2_LL_UDP:
 			if (strlen(vtyvc->remote.ip) == 0) {
 				/* Invalid IP for VC */
 				continue;
@@ -839,10 +839,10 @@
 				continue;
 			}
 			break;
-		case GPRS_NS_LL_FR:
+		case GPRS_NS2_LL_FR:
 			break;
-		case GPRS_NS_LL_FR_GRE:
-		case GPRS_NS_LL_E1:
+		case GPRS_NS2_LL_FR_GRE:
+		case GPRS_NS2_LL_E1:
 			continue;
 		}
 
@@ -857,7 +857,7 @@
 		nse->persistent = true;
 
 		switch (vtyvc->ll) {
-		case GPRS_NS_LL_UDP:
+		case GPRS_NS2_LL_UDP:
 			nsvc = gprs_ns2_ip_connect(bind,
 						   &sockaddr,
 						   nse,
@@ -868,7 +868,7 @@
 			}
 			nsvc->persistent = true;
 			break;
-		case GPRS_NS_LL_FR: {
+		case GPRS_NS2_LL_FR: {
 			if (vty_fr_network == NULL) {
 				/* TODO: add a switch for BSS/SGSN/gbproxy */
 				vty_fr_network = osmo_fr_network_alloc(vty_nsi);
@@ -892,8 +892,8 @@
 			nsvc->persistent = true;
 			break;
 		}
-		case GPRS_NS_LL_FR_GRE:
-		case GPRS_NS_LL_E1:
+		case GPRS_NS2_LL_FR_GRE:
+		case GPRS_NS2_LL_E1:
 			continue;
 		}
 	}

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I3b5e0d51ce69b095095e5160ca0cf0d4534db1b8
Gerrit-Change-Number: 21246
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201119/07846e24/attachment.htm>


More information about the gerrit-log mailing list