Change in libosmocore[master]: ns2: encapsulate calls to nsvc->bind->send_vc()

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

laforge gerrit-no-reply at lists.osmocom.org
Mon Feb 1 08:32:13 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/22557 )

Change subject: ns2: encapsulate calls to nsvc->bind->send_vc()
......................................................................

ns2: encapsulate calls to nsvc->bind->send_vc()

Don't call the function pointer of the underlying transport
directly, as we many still want to do some common processing,
such as statistics counting (see follow-up patches).

Change-Id: I8d14c7b8d3aacc2bed033072d7934dbd6aab41df
---
M src/gb/gprs_ns2_message.c
1 file changed, 17 insertions(+), 12 deletions(-)

Approvals:
  Jenkins Builder: Verified
  lynxis lazus: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_message.c b/src/gb/gprs_ns2_message.c
index 67ee254..d97c2a5 100644
--- a/src/gb/gprs_ns2_message.c
+++ b/src/gb/gprs_ns2_message.c
@@ -166,6 +166,11 @@
 }
 
 
+static int ns_vc_tx(struct gprs_ns2_vc *nsvc, struct msgb *msg)
+{
+	return nsvc->bind->send_vc(nsvc, msg);
+}
+
 /* transmit functions */
 static int ns2_tx_simple(struct gprs_ns2_vc *nsvc, uint8_t pdu_type)
 {
@@ -183,7 +188,7 @@
 
 	nsh->pdu_type = pdu_type;
 
-	return nsvc->bind->send_vc(nsvc, msg);
+	return ns_vc_tx(nsvc, msg);
 }
 
 /*! Transmit a NS-BLOCK on a given NS-VC.
@@ -216,7 +221,7 @@
 	msgb_tvlv_put(msg, NS_IE_CAUSE, 1, &cause);
 	msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *) &nsvci);
 
-	return nsvc->bind->send_vc(nsvc, msg);
+	return ns_vc_tx(nsvc, msg);
 }
 
 /*! Transmit a NS-BLOCK-ACK on a given NS-VC.
@@ -245,7 +250,7 @@
 
 	msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *) &nsvci);
 
-	return nsvc->bind->send_vc(nsvc, msg);
+	return ns_vc_tx(nsvc, msg);
 }
 
 /*! Transmit a NS-RESET on a given NS-VC.
@@ -278,7 +283,7 @@
 	msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *) &nsvci);
 	msgb_tvlv_put(msg, NS_IE_NSEI, 2, (uint8_t *) &nsei);
 
-	return nsvc->bind->send_vc(nsvc, msg);
+	return ns_vc_tx(nsvc, msg);
 }
 
 /*! Transmit a NS-RESET-ACK on a given NS-VC.
@@ -313,7 +318,7 @@
 	msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *)&nsvci);
 	msgb_tvlv_put(msg, NS_IE_NSEI, 2, (uint8_t *)&nsei);
 
-	return nsvc->bind->send_vc(nsvc, msg);
+	return ns_vc_tx(nsvc, msg);
 }
 
 /*! Transmit a NS-UNBLOCK on a given NS-VC.
@@ -399,7 +404,7 @@
 	nsh->data[1] = bvci >> 8;
 	nsh->data[2] = bvci & 0xff;
 
-	return nsvc->bind->send_vc(nsvc, msg);
+	return ns_vc_tx(nsvc, msg);
 }
 
 /*! Transmit a NS-STATUS on a given NS-VC.
@@ -454,7 +459,7 @@
 	if (cause == NS_CAUSE_BVCI_UNKNOWN)
 		msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *)&bvci);
 
-	return nsvc->bind->send_vc(nsvc, msg);
+	return ns_vc_tx(nsvc, msg);
 }
 
 
@@ -514,7 +519,7 @@
 			      (const uint8_t *)ip6_elems);
 	}
 
-	return nsvc->bind->send_vc(nsvc, msg);
+	return ns_vc_tx(nsvc, msg);
 }
 
 /*! Encode + Transmit a SNS-CONFIG as per Section 9.3.4.
@@ -569,7 +574,7 @@
 			      (const uint8_t *)ip6_elems);
 	}
 
-	return nsvc->bind->send_vc(nsvc, msg);
+	return ns_vc_tx(nsvc, msg);
 }
 
 /*! Encode + Transmit a SNS-CONFIG-ACK as per Section 9.3.5.
@@ -608,7 +613,7 @@
 	if (cause)
 		msgb_tvlv_put(msg, NS_IE_CAUSE, 1, cause);
 
-	return nsvc->bind->send_vc(nsvc, msg);
+	return ns_vc_tx(nsvc, msg);
 }
 
 
@@ -657,7 +662,7 @@
 	if (ip6_ep_nr >= 0)
 		msgb_tv16_put(msg, NS_IE_IPv6_EP_NR, ip6_ep_nr);
 
-	return nsvc->bind->send_vc(nsvc, msg);
+	return ns_vc_tx(nsvc, msg);
 }
 
 /*! Encode + Transmit a SNS-SIZE-ACK as per Section 9.3.8.
@@ -692,7 +697,7 @@
 	if (cause)
 		msgb_tvlv_put(msg, NS_IE_CAUSE, 1, cause);
 
-	return nsvc->bind->send_vc(nsvc, msg);
+	return ns_vc_tx(nsvc, msg);
 }
 
 

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8d14c7b8d3aacc2bed033072d7934dbd6aab41df
Gerrit-Change-Number: 22557
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210201/3cd3cac5/attachment.htm>


More information about the gerrit-log mailing list