summaryrefslogtreecommitdiffstats
path: root/include/osmocom/ctrl/control_if.h
blob: 512ae10ea46b569655532ca046053fd7f7607f80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include <osmocom/core/write_queue.h>
#include <osmocom/ctrl/control_cmd.h>

int ctrl_parse_get_num(vector vline, int i, long *num);

typedef int (*ctrl_cmd_lookup)(void *data, vector vline, int *node_type,
				void **node_data, int *i);

struct ctrl_handle {
	struct osmo_fd listen_fd;
	void *data;

	ctrl_cmd_lookup lookup;

	/* List of control connections */
	struct llist_head ccon_list;
};


int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd);
int ctrl_cmd_send_trap(struct ctrl_handle *ctrl, const char *name, char *value);
struct ctrl_handle *ctrl_interface_setup(void *data, uint16_t port,
					 ctrl_cmd_lookup lookup);
struct ctrl_handle *ctrl_interface_setup_dynip(void *data,
					       const char *bind_addr,
					       uint16_t port,
					       ctrl_cmd_lookup lookup);

int ctrl_cmd_handle(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data);