blob: 4cd336990edea20357a0eb597cb32ce01a2d4cd6 [file] [log] [blame]
Harald Welte5ddd4352014-08-21 15:42:44 +02001#pragma once
Alexander Huemer4376bcc2011-09-06 00:09:48 +02002
3#include <osmocom/core/write_queue.h>
Harald Welte1238cc62014-08-20 19:50:04 +02004#include <osmocom/ctrl/control_cmd.h>
5
Harald Welte528134b2014-08-21 15:13:08 +02006int ctrl_parse_get_num(vector vline, int i, long *num);
7
8typedef int (*ctrl_cmd_lookup)(void *data, vector vline, int *node_type,
9 void **node_data, int *i);
Holger Hans Peter Freytherea62a382014-03-23 16:25:16 +010010
Daniel Willmann782974b2011-07-22 17:55:42 +020011struct ctrl_handle {
12 struct osmo_fd listen_fd;
Harald Weltec78e74e2014-08-21 14:34:32 +020013 void *data;
Daniel Willmann782974b2011-07-22 17:55:42 +020014
Harald Welte528134b2014-08-21 15:13:08 +020015 ctrl_cmd_lookup lookup;
Holger Hans Peter Freytherea62a382014-03-23 16:25:16 +010016
Daniel Willmann782974b2011-07-22 17:55:42 +020017 /* List of control connections */
18 struct llist_head ccon_list;
19};
20
Holger Hans Peter Freytherea62a382014-03-23 16:25:16 +010021
Alexander Huemer4376bcc2011-09-06 00:09:48 +020022int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd);
Maxbc067eb2016-08-04 11:07:08 +020023int ctrl_cmd_send_trap(struct ctrl_handle *ctrl, const char *name, char *value);
Harald Welte79c137c2017-04-16 19:08:49 +020024struct ctrl_handle *ctrl_handle_alloc(void *ctx, void *data, ctrl_cmd_lookup lookup);
Harald Welteae2fcb22014-08-21 15:20:00 +020025struct ctrl_handle *ctrl_interface_setup(void *data, uint16_t port,
26 ctrl_cmd_lookup lookup);
Neels Hofmeyr49343092016-02-24 00:09:40 +010027struct ctrl_handle *ctrl_interface_setup_dynip(void *data,
28 const char *bind_addr,
29 uint16_t port,
30 ctrl_cmd_lookup lookup);
Maxfa9e05e2017-02-20 11:53:11 +010031struct ctrl_connection *osmo_ctrl_conn_alloc(void *ctx, void *data);
Harald Welte528134b2014-08-21 15:13:08 +020032int ctrl_cmd_handle(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data);
Harald Weltef85861d2017-04-16 19:17:10 +020033struct ctrl_cmd *ctrl_cmd_exec_from_string(struct ctrl_handle *ch, const char *cmdstr);
Harald Welted6b1f852017-04-16 16:57:40 +020034
35int ctrl_lookup_register(ctrl_cmd_lookup lookup);