Change in libosmocore[master]: gprs_ns2: add gprs_ns2_bind_by_name()

2020-12-03 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/21485 )

Change subject: gprs_ns2: add gprs_ns2_bind_by_name()
..


Patch Set 1:

do we yet enforce all binds have a unique name at crate time? If not, one could 
create binds without name or with identical name, rendering this new 
bind_by_name() function rather useless.


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8f1d66b7b3b12da12db8b5e6bd08c1beff085b3e
Gerrit-Change-Number: 21485
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge 
Gerrit-Comment-Date: Thu, 03 Dec 2020 09:20:46 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in libosmocore[master]: gprs_ns2: add gprs_ns2_bind_by_name()

2020-12-02 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/21485 )


Change subject: gprs_ns2: add gprs_ns2_bind_by_name()
..

gprs_ns2: add gprs_ns2_bind_by_name()

To find a bind by a unique name. The new vty will add
unique names to bind.

Change-Id: I8f1d66b7b3b12da12db8b5e6bd08c1beff085b3e
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2.c
M src/gb/libosmogb.map
3 files changed, 20 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/85/21485/1

diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index ccb1a94..598f197 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -168,6 +168,7 @@
 struct gprs_ns2_vc_bind **result);
 struct gprs_ns2_vc_bind *gprs_ns2_ip_bind_by_sockaddr(struct gprs_ns2_inst 
*nsi,
  const struct 
osmo_sockaddr *sockaddr);
+struct gprs_ns2_vc_bind *gprs_ns2_bind_by_name(struct gprs_ns2_inst *nsi, 
const char *name);

 /* FR VL driver */
 struct gprs_ns2_vc_bind *gprs_ns2_fr_bind_by_netif(
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index a2443ea..8a679f4 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -1232,6 +1232,24 @@
}
 }

+/*! Search for a bind with a unique name
+ *  \param[in] nsi NS instance on which we operate
+ *  \param[in] name The unique bind name to search for
+ *  \return the bind or NULL if not found
+ */
+struct gprs_ns2_vc_bind *gprs_ns2_bind_by_name(
+   struct gprs_ns2_inst *nsi, const char *name)
+{
+   struct gprs_ns2_vc_bind *bind;
+
+   llist_for_each_entry(bind, >binding, list) {
+   if (!strcmp(bind->name, name))
+   return bind;
+   }
+
+   return NULL;
+}
+
 enum gprs_ns2_vc_mode gprs_ns2_dialect_to_vc_mode(
enum gprs_ns2_dialect dialect)
 {
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index d390035..9c5e84b 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -82,6 +82,7 @@
 gprs_ns_msgb_alloc;

 gprs_ns2_aff_cause_prim_strs;
+gprs_ns2_bind_by_name;
 gprs_ns2_cause_strs;
 gprs_ns2_create_nse;
 gprs_ns2_dynamic_create_nse;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8f1d66b7b3b12da12db8b5e6bd08c1beff085b3e
Gerrit-Change-Number: 21485
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange