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

Max gerrit-no-reply at lists.osmocom.org
Fri Feb 24 14:04:26 UTC 2017


Review at  https://gerrit.osmocom.org/1897

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(+), 39 deletions(-)


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

diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c
index ac5af87..8bf1ffa 100644
--- a/src/ctrl/control_if.c
+++ b/src/ctrl/control_if.c
@@ -405,6 +405,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;
 }
@@ -670,45 +671,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: newchange
Gerrit-Change-Id: Iaa209e34a849ce0dfe2e29b482c3208ade1a32a4
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>


More information about the gerrit-log mailing list