libosmoctrl 1.7.0
Osmocom CTRL library
control_if.h
Go to the documentation of this file.
1
3#pragma once
4
7
8int ctrl_parse_get_num(vector vline, int i, long *num);
9
10typedef int (*ctrl_cmd_lookup)(void *data, vector vline, int *node_type,
11 void **node_data, int *i);
12typedef void (*ctrl_cmd_reply_cb)(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data);
13
16 void *data;
17
19
20 /* List of control connections */
22
23 /* User defined GET/SET REPLY handler. User can set cmd->defer to 1 in
24 order to own and keep the cmd pointer and free it after the function
25 returns. "data" param is the user data pointer supplied during
26 ctrl_handle allocation */
28};
29
30
31int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd);
32int ctrl_cmd_send_trap(struct ctrl_handle *ctrl, const char *name, char *value);
34struct ctrl_handle *ctrl_handle_alloc2(void *ctx, void *data,
36 unsigned int node_count);
37struct ctrl_handle *ctrl_interface_setup(void *data, uint16_t port,
40 const char *bind_addr,
41 uint16_t port,
44 const char *bind_addr,
45 uint16_t port,
47 unsigned int node_count);
48struct ctrl_connection *osmo_ctrl_conn_alloc(void *ctx, void *data);
49int ctrl_cmd_handle(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data);
50struct ctrl_cmd *ctrl_cmd_exec_from_string(struct ctrl_handle *ch, const char *cmdstr);
51
53
54int ctrl_handle_msg(struct ctrl_handle *ctrl, struct ctrl_connection *ccon, struct msgb *msg);
struct ctrl_handle * ctrl_interface_setup_dynip(void *data, const char *bind_addr, uint16_t port, ctrl_cmd_lookup lookup)
Setup CTRL interface on a given address.
Definition: control_if.c:1025
void(* ctrl_cmd_reply_cb)(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data)
Definition: control_if.h:12
int ctrl_lookup_register(ctrl_cmd_lookup lookup)
Install a lookup helper function for control nodes This function is used by e.g.
Definition: control_if.c:1040
struct ctrl_handle * ctrl_interface_setup_dynip2(void *data, const char *bind_addr, uint16_t port, ctrl_cmd_lookup lookup, unsigned int node_count)
Setup CTRL interface on a given address.
Definition: control_if.c:990
int ctrl_parse_get_num(vector vline, int i, long *num)
Parse ascii-encoded decimal number at vline[i].
Definition: control_if.c:81
struct ctrl_connection * osmo_ctrl_conn_alloc(void *ctx, void *data)
Allocate CTRL connection.
Definition: control_if.c:504
int ctrl_cmd_handle(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data)
Definition: control_if.c:208
struct ctrl_handle * ctrl_handle_alloc(void *ctx, void *data, ctrl_cmd_lookup lookup)
Allocate a CTRL interface handle.
Definition: control_if.c:966
int(* ctrl_cmd_lookup)(void *data, vector vline, int *node_type, void **node_data, int *i)
Definition: control_if.h:10
struct ctrl_handle * ctrl_handle_alloc2(void *ctx, void *data, ctrl_cmd_lookup lookup, unsigned int node_count)
Allocate a CTRL interface handle.
Definition: control_if.c:939
struct ctrl_handle * ctrl_interface_setup(void *data, uint16_t port, ctrl_cmd_lookup lookup)
Definition: control_if.c:878
int ctrl_handle_msg(struct ctrl_handle *ctrl, struct ctrl_connection *ccon, struct msgb *msg)
Handle a received CTRL command contained in a Message buffers.
Definition: control_if.c:382
int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd)
Encode a CTRL command and append it to the given write queue.
Definition: control_if.c:118
int ctrl_cmd_send_trap(struct ctrl_handle *ctrl, const char *name, char *value)
Send TRAP over given Control Interface.
Definition: control_if.c:146
struct ctrl_cmd * ctrl_cmd_exec_from_string(struct ctrl_handle *ch, const char *cmdstr)
Helper for "local execution" of a CTRL command from a string The function will parse + execute the gi...
Definition: control_if.c:1065
node_type
uint8_t data[0]
const char * name
Represents a single ctrl command after parsing.
Definition: control_cmd.h:67
struct ctrl_connection * ccon
connection through which the command was received
Definition: control_cmd.h:69
Represents a single ctrl connection.
Definition: control_cmd.h:45
Definition: control_if.h:14
ctrl_cmd_lookup lookup
Definition: control_if.h:18
void * data
Definition: control_if.h:16
struct llist_head ccon_list
Definition: control_if.h:21
ctrl_cmd_reply_cb reply_cb
Definition: control_if.h:27
struct osmo_fd listen_fd
Definition: control_if.h:15