Change in libosmocore[master]: ctrl: Make 'struct ctrl_connection' non-public

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue May 29 19:14:57 UTC 2018


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/9377


Change subject: ctrl: Make 'struct ctrl_connection' non-public
......................................................................

ctrl: Make 'struct ctrl_connection' non-public

The ctrl_connection is always dynamically allocated by API functions
exported by libosmoctrl, and users simply pass pointers to it back
into other API functions.  As such, there's no need to expose the
detailed intenals of this structure to the user.

Change-Id: I3fb9fb19eb057a40fcda139066f04f1096944755
---
M include/osmocom/ctrl/control_cmd.h
M include/osmocom/gsm/protocol/gsm_08_08.h
M src/ctrl/Makefile.am
M src/ctrl/control_cmd.c
M src/ctrl/control_if.c
A src/ctrl/ctrl_internal.h
M tests/Makefile.am
M tests/ctrl/ctrl_test.c
8 files changed, 36 insertions(+), 22 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/9377/1

diff --git a/include/osmocom/ctrl/control_cmd.h b/include/osmocom/ctrl/control_cmd.h
index 08376f3..29425e1 100644
--- a/include/osmocom/ctrl/control_cmd.h
+++ b/include/osmocom/ctrl/control_cmd.h
@@ -41,25 +41,7 @@
 extern const struct value_string ctrl_type_vals[];
 
 /*! Represents a single ctrl connection */
-struct ctrl_connection {
-	struct llist_head list_entry;
-
-	/*! The queue for sending data back */
-	struct osmo_wqueue write_queue;
-
-	/*! Buffer for partial input data */
-	struct msgb *pending_msg;
-
-	/*! Callback if the connection was closed */
-	void (*closed_cb)(struct ctrl_connection *conn);
-
-	/*! Pending commands for this connection */
-	struct llist_head cmds;
-
-	/*! Pending deferred command responses for this connection */
-	struct llist_head def_cmds;
-};
-
+struct ctrl_connection;
 struct ctrl_cmd_def;
 
 /*! Represents a single ctrl command after parsing */
diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h
index 5d2bf13..0a5e299 100644
--- a/include/osmocom/gsm/protocol/gsm_08_08.h
+++ b/include/osmocom/gsm/protocol/gsm_08_08.h
@@ -549,8 +549,8 @@
 
 /* TS 48.008 3.2.2.117 */
 enum gsm0808_lcls_control {
-	GSM0808_LCLS_CSC_CONNET						= 0x00,
-	GSM0808_LCLS_CSC_DO_NOT_CONNET					= 0x01,
+	GSM0808_LCLS_CSC_CONNECT					= 0x00,
+	GSM0808_LCLS_CSC_DO_NOT_CONNECT					= 0x01,
 	GSM0808_LCLS_CSC_RELEASE_LCLS					= 0x02,
 	GSM0808_LCLS_CSC_BICAST_UL_AT_HANDOVER				= 0x03,
 	GSM0808_LCLS_CSC_BICAST_UL_AND_RECV_DL_AT_HANDOVER		= 0x04,
diff --git a/src/ctrl/Makefile.am b/src/ctrl/Makefile.am
index a51ae05..0a401c8 100644
--- a/src/ctrl/Makefile.am
+++ b/src/ctrl/Makefile.am
@@ -20,6 +20,6 @@
 libosmoctrl_la_SOURCES += control_vty.c
 endif
 
-EXTRA_DIST = libosmoctrl.map
+EXTRA_DIST = libosmoctrl.map ctrl_internal.h
 
 endif
diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c
index bff4d17..e6bc073 100644
--- a/src/ctrl/control_cmd.c
+++ b/src/ctrl/control_cmd.c
@@ -42,6 +42,8 @@
 #include <osmocom/vty/command.h>
 #include <osmocom/vty/vector.h>
 
+#include "ctrl_internal.h"
+
 extern vector ctrl_node_vec;
 
 const struct value_string ctrl_type_vals[] = {
diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c
index d3e6fac..8eadf7e 100644
--- a/src/ctrl/control_if.c
+++ b/src/ctrl/control_if.c
@@ -64,6 +64,8 @@
 #include <osmocom/vty/command.h>
 #include <osmocom/vty/vector.h>
 
+#include "ctrl_internal.h"
+
 extern int osmo_fsm_ctrl_cmds_install(void);
 
 vector ctrl_node_vec;
diff --git a/src/ctrl/ctrl_internal.h b/src/ctrl/ctrl_internal.h
new file mode 100644
index 0000000..d2911be
--- /dev/null
+++ b/src/ctrl/ctrl_internal.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/write_queue.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/ctrl/control_if.h>
+
+struct ctrl_connection {
+	struct llist_head list_entry;
+
+	/*! The queue for sending data back */
+	struct osmo_wqueue write_queue;
+
+	/*! Buffer for partial input data */
+	struct msgb *pending_msg;
+
+	/*! Callback if the connection was closed */
+	void (*closed_cb)(struct ctrl_connection *conn);
+
+	/*! Pending commands for this connection */
+	struct llist_head cmds;
+
+	/*! Pending deferred command responses for this connection */
+	struct llist_head def_cmds;
+};
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 70b5cb8..a2ace2c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -75,6 +75,7 @@
 abis_abis_test_LDADD = $(LDADD) $(top_builddir)/src/gsm/libosmogsm.la
 
 ctrl_ctrl_test_SOURCES = ctrl/ctrl_test.c
+ctrl_ctrl_test_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/ctrl
 ctrl_ctrl_test_LDADD = $(LDADD) $(top_builddir)/src/ctrl/libosmoctrl.la
 
 gea_gea_test_SOURCES = gea/gea_test.c
diff --git a/tests/ctrl/ctrl_test.c b/tests/ctrl/ctrl_test.c
index 8bb917b..a0f5973 100644
--- a/tests/ctrl/ctrl_test.c
+++ b/tests/ctrl/ctrl_test.c
@@ -12,6 +12,8 @@
 #include <osmocom/gsm/protocol/ipaccess.h>
 #include <osmocom/ctrl/control_if.h>
 
+#include "ctrl_internal.h"
+
 static void check_type(enum ctrl_type c)
 {
 	const char *t = get_value_string(ctrl_type_vals, c);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3fb9fb19eb057a40fcda139066f04f1096944755
Gerrit-Change-Number: 9377
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180529/d21b7f5a/attachment.htm>


More information about the gerrit-log mailing list