[PATCH] libosmocore[master]: Fix client-side ctrl interface helpers

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

Max gerrit-no-reply at lists.osmocom.org
Wed Mar 1 09:03:00 UTC 2017


Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/1897

to look at the new patch set (#2).

Fix client-side ctrl interface helpers

* remove unused ctrl_interface_connect() which is not part of public API
* add default read callback to osmo_ctrl_conn_alloc()

Change-Id: Iaa209e34a849ce0dfe2e29b482c3208ade1a32a4
Related: OS#1615
---
M src/ctrl/control_if.c
1 file changed, 1 insertion(+), 40 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/97/1897/2

diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c
index d78b513..de49d16 100644
--- a/src/ctrl/control_if.c
+++ b/src/ctrl/control_if.c
@@ -388,6 +388,7 @@
 
 	ccon->write_queue.bfd.data = data;
 	ccon->write_queue.write_cb = control_write_cb;
+	ccon->write_queue.read_cb = handle_control_read;
 
 	return ccon;
 }
@@ -431,7 +432,6 @@
 
 	ccon->write_queue.bfd.fd = fd;
 	ccon->write_queue.bfd.when = BSC_FD_READ;
-	ccon->write_queue.read_cb = handle_control_read;
 
 	ret = osmo_fd_register(&ccon->write_queue.bfd);
 	if (ret < 0) {
@@ -653,45 +653,6 @@
 static int verify_counter(struct ctrl_cmd *cmd, const char *value, void *data)
 {
 	return 0;
-}
-
-/*! \brief Setup CTRL interface connection to a given address
- *  \param[in] data Pointer which will be made available to each
-               set_..() get_..() verify_..() control command function
- *  \param[in] addr Address to which we shall connect
- *  \param[in] port Port to which we shall connect
- *  \param[in] lookup Lookup function pointer, can be NULL
- *  \returns ctrl_handle pointer or NULL in case of errors
- */
-struct ctrl_handle *ctrl_interface_connect(void *data, const char *addr,
-					   uint16_t port,
-					   ctrl_cmd_lookup lookup)
-{
-	int ret;
-	struct ctrl_handle *ctrl;
-
-	ctrl = talloc_zero(data, struct ctrl_handle);
-	if (!ctrl)
-		return NULL;
-
-	INIT_LLIST_HEAD(&ctrl->ccon_list);
-
-	ctrl->data = data;
-	ctrl->lookup = lookup;
-
-	ctrl->listen_fd.cb = NULL;
-	ctrl->listen_fd.data = ctrl;
-	ret = osmo_sock_init_ofd(&ctrl->listen_fd, AF_INET, SOCK_STREAM,
-				 IPPROTO_TCP, addr, port, OSMO_SOCK_F_CONNECT);
-	if (ret < 0) {
-		LOGP(DLCTRL, LOGL_ERROR, "Cannot connect to CTRL at %s:%u\n",
-		     addr, port);
-		talloc_free(ctrl);
-		return NULL;
-	}
-	LOGP(DLCTRL, LOGL_NOTICE, "CTRL connected to %s:%u\n", addr, port);
-
-	return ctrl;
 }
 
 struct ctrl_handle *ctrl_interface_setup(void *data, uint16_t port,

-- 
To view, visit https://gerrit.osmocom.org/1897
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iaa209e34a849ce0dfe2e29b482c3208ade1a32a4
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list