From 9756c4691d576c5bfe175245a82d00b2d03ed70e Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 24 Feb 2017 13:03:32 +0100 Subject: 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 --- src/ctrl/control_if.c | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) (limited to 'src') diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c index d78b513d..de49d160 100644 --- a/src/ctrl/control_if.c +++ b/src/ctrl/control_if.c @@ -388,6 +388,7 @@ struct ctrl_connection *osmo_ctrl_conn_alloc(void *ctx, void *data) 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 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what) 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) { @@ -655,45 +655,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, ctrl_cmd_lookup lookup) { -- cgit v1.2.3