gprs_ns2: add member name to bind
Every bind will have a unique name. Add a name argument
to all bind creating functions and require them to be unique.
This is an API break but there wasn't yet a release with NS2.
Change-Id: I8f1d66b7b3b12da12db8b5e6bd08c1beff085b3e
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 890b656..bd69acf 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -1239,6 +1239,7 @@
bind->driver->free_bind(bind);
llist_del(&bind->list);
+ talloc_free((char *)bind->name);
talloc_free(bind);
}
@@ -1251,6 +1252,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, &nsi->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)
{