libosmoctrl 1.13.1.1-afb4 Osmocom CTRL library

control_if.h
Go to the documentation of this file.
1
3#pragma once
4
5#include <osmocom/core/write_queue.h>
6#include <osmocom/ctrl/control_cmd.h>
7
8 int ctrl_parse_get_num(vector vline, int i, long *num);
9
10 typedef int (*ctrl_cmd_lookup)(void *data, vector vline, int *node_type,
11 void **node_data, int *i);
12 typedef void (*ctrl_cmd_reply_cb)(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data);
13
14 struct ctrl_handle {
15 struct osmo_fd listen_fd;
16 void *data;
17
18 ctrl_cmd_lookup lookup;
19
20 /* List of control connections */
21 struct llist_head ccon_list;
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 */
27 ctrl_cmd_reply_cb reply_cb;
28};
29
30
31 int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd) OSMO_DEPRECATED("Use ctrl_cmd_send2() instead.");
32 int ctrl_cmd_send2(struct ctrl_connection *ccon, struct ctrl_cmd *cmd);
33 int ctrl_cmd_send_trap(struct ctrl_handle *ctrl, const char *name, char *value);
34 struct ctrl_handle *ctrl_handle_alloc(void *ctx, void *data, ctrl_cmd_lookup lookup);
35 struct ctrl_handle *ctrl_handle_alloc2(void *ctx, void *data,
36 ctrl_cmd_lookup lookup,
37 unsigned int node_count);
38 struct ctrl_handle *ctrl_interface_setup(void *data, uint16_t port,
39 ctrl_cmd_lookup lookup);
40 struct ctrl_handle *ctrl_interface_setup2(void *data, uint16_t default_port, ctrl_cmd_lookup lookup,
41 unsigned int node_count);
42 struct ctrl_handle *ctrl_interface_setup_dynip(void *data,
43 const char *bind_addr,
44 uint16_t port,
45 ctrl_cmd_lookup lookup) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
46 struct ctrl_handle *ctrl_interface_setup_dynip2(void *data,
47 const char *bind_addr,
48 uint16_t port,
49 ctrl_cmd_lookup lookup,
50 unsigned int node_count) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
51 struct ctrl_connection *osmo_ctrl_conn_alloc(void *ctx, void *data);
52 int ctrl_cmd_handle(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data);
53 struct ctrl_cmd *ctrl_cmd_exec_from_string(struct ctrl_handle *ch, const char *cmdstr);
54
55 int ctrl_lookup_register(ctrl_cmd_lookup lookup);
56 int ctrl_handle_msg(struct ctrl_handle *ctrl, struct ctrl_connection *ccon, struct msgb *msg);
control_cmd.h
ctrl_cmd_reply_cb
void(* ctrl_cmd_reply_cb)(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data)
Definition: control_if.h:12
ctrl_interface_setup_dynip2
struct ctrl_handle * ctrl_interface_setup_dynip2(void *data, const char *bind_addr, uint16_t port, ctrl_cmd_lookup lookup, unsigned int node_count) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
Setup CTRL interface on a given address.
Definition: control_if.c:1003
ctrl_interface_setup2
struct ctrl_handle * ctrl_interface_setup2(void *data, uint16_t default_port, ctrl_cmd_lookup lookup, unsigned int node_count)
Initializes CTRL interface using the configured bind addr/port.
Definition: control_if.c:1052
ctrl_lookup_register
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:1065
ctrl_cmd_send
int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd) OSMO_DEPRECATED("Use ctrl_cmd_send2() instead.")
Encode a CTRL command and append it to the given ctrl_connection.
Definition: control_if.c:119
ctrl_cmd_send2
int ctrl_cmd_send2(struct ctrl_connection *ccon, struct ctrl_cmd *cmd)
Encode a CTRL command and append it to the given ctrl_connection.
Definition: control_if.c:129
ctrl_parse_get_num
int ctrl_parse_get_num(vector vline, int i, long *num)
Parse ascii-encoded decimal number at vline[i].
Definition: control_if.c:82
osmo_ctrl_conn_alloc
struct ctrl_connection * osmo_ctrl_conn_alloc(void *ctx, void *data)
Allocate CTRL connection.
Definition: control_if.c:517
ctrl_cmd_handle
int ctrl_cmd_handle(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data)
Definition: control_if.c:219
ctrl_interface_setup_dynip
struct ctrl_handle * ctrl_interface_setup_dynip(void *data, const char *bind_addr, uint16_t port, ctrl_cmd_lookup lookup) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
Setup CTRL interface on a given address.
Definition: control_if.c:1038
ctrl_handle_alloc
struct ctrl_handle * ctrl_handle_alloc(void *ctx, void *data, ctrl_cmd_lookup lookup)
Allocate a CTRL interface handle.
Definition: control_if.c:979
ctrl_cmd_lookup
int(* ctrl_cmd_lookup)(void *data, vector vline, int *node_type, void **node_data, int *i)
Definition: control_if.h:10
ctrl_handle_alloc2
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:952
ctrl_interface_setup
struct ctrl_handle * ctrl_interface_setup(void *data, uint16_t port, ctrl_cmd_lookup lookup)
Definition: control_if.c:891
ctrl_handle_msg
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:393
ctrl_cmd_send_trap
int ctrl_cmd_send_trap(struct ctrl_handle *ctrl, const char *name, char *value)
Send TRAP over given Control Interface.
Definition: control_if.c:157
ctrl_cmd_exec_from_string
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:1090
name
const char * name
node_type
node_type
data
uint8_t data[0]
OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
#define OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
OSMO_DEPRECATED
#define OSMO_DEPRECATED(text)
_vector
ctrl_cmd
Represents a single ctrl command after parsing.
Definition: control_cmd.h:68
ctrl_cmd::ccon
struct ctrl_connection * ccon
connection through which the command was received
Definition: control_cmd.h:70
ctrl_connection
Represents a single ctrl connection.
Definition: control_cmd.h:46
ctrl_handle
Definition: control_if.h:14
ctrl_handle::lookup
ctrl_cmd_lookup lookup
Definition: control_if.h:18
ctrl_handle::data
void * data
Definition: control_if.h:16
ctrl_handle::ccon_list
struct llist_head ccon_list
Definition: control_if.h:21
ctrl_handle::reply_cb
ctrl_cmd_reply_cb reply_cb
Definition: control_if.h:27
ctrl_handle::listen_fd
struct osmo_fd listen_fd
Definition: control_if.h:15
llist_head
msgb
osmo_fd
osmo_wqueue
write_queue.h