libosmoctrl  1.9.2
Osmocom CTRL library
control_cmd.h File Reference

Go to the source code of this file.

Data Structures

struct  ctrl_connection
 Represents a single ctrl connection. More...
 
struct  ctrl_cmd
 Represents a single ctrl command after parsing. More...
 
struct  ctrl_cmd_struct
 
struct  ctrl_cmd_element
 Implementation of a given CTRL command. More...
 
struct  ctrl_cmd_map
 
struct  ctrl_cmd_def
 

Macros

#define CTRL_CMD_ERROR   -1
 
#define CTRL_CMD_HANDLED   0
 
#define CTRL_CMD_REPLY   1
 
#define CTRL_CMD_TRAP_ID   "0"
 
#define ctrl_cmd_reply_printf(cmd, fmt, args ...)   osmo_talloc_asprintf(cmd, cmd->reply, fmt, ## args)
 
#define CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, verify_name)
 Helper to generate static struct ctrl_cmd_element. More...
 
#define CTRL_HELPER_GET_INT(cmdname, dtype, element)
 Helper to generate static GET function for integer. More...
 
#define CTRL_HELPER_SET_INT(cmdname, dtype, element)
 Helper to generate static SET function for integer. More...
 
#define CTRL_HELPER_VERIFY_RANGE(cmdname, min, max)
 Helper to generate static VERIFY unction validating a numeric range. More...
 
#define CTRL_CMD_DEFINE_RANGE(cmdname, cmdstr, dtype, element, min, max)
 Helper to generate GET, SET, VERIFY + ctrl_cmd_element for integer. More...
 
#define CTRL_HELPER_GET_STRING(cmdname, dtype, element)
 Helper to generate static GET function for string. More...
 
#define CTRL_HELPER_SET_STRING(cmdname, dtype, element)
 Helper to generate static SET function for string. More...
 
#define CTRL_CMD_DEFINE_STRING(cmdname, cmdstr, dtype, element)
 Helper to generate GET, SET, VERIFY + ctrl_cmd_element for string. More...
 
#define CTRL_CMD_DEFINE(cmdname, cmdstr)
 Declare a read-write attribute. More...
 
#define CTRL_CMD_DEFINE_RO(cmdname, cmdstr)
 Define a read-only attribute. More...
 
#define CTRL_CMD_DEFINE_WO(cmdname, cmdstr)
 Define a write-only attribute. More...
 
#define CTRL_CMD_DEFINE_WO_NOVRF(cmdname, cmdstr)
 Define a write-only attribute without verify. More...
 

Enumerations

enum  ctrl_node_type {
  CTRL_NODE_ROOT,
  CTRL_NODE_BTS,
  CTRL_NODE_TRX,
  CTRL_NODE_TS,
  CTRL_NODE_FSM,
  CTRL_NODE_FSM_INST,
  _LAST_CTRL_NODE
}
 The class of node at which a ctrl command is registered to. More...
 
enum  ctrl_type {
  CTRL_TYPE_UNKNOWN,
  CTRL_TYPE_GET,
  CTRL_TYPE_SET,
  CTRL_TYPE_GET_REPLY,
  CTRL_TYPE_SET_REPLY,
  CTRL_TYPE_TRAP,
  CTRL_TYPE_ERROR
}
 Ctrl command types (GET, SET, ...) More...
 

Functions

struct ctrl_cmd_defctrl_cmd_def_make (const void *ctx, struct ctrl_cmd *cmd, void *data, unsigned int secs)
 Build a deferred control command state and keep it the per-connection list of deferred commands. More...
 
int ctrl_cmd_def_is_zombie (struct ctrl_cmd_def *cd)
 Determine if the given deferred control command is still alive or a zombie. More...
 
int ctrl_cmd_def_send (struct ctrl_cmd_def *cd)
 Send the response to a deferred ctrl command. More...
 
int ctrl_cmd_exec (vector vline, struct ctrl_cmd *command, vector node, void *data)
 Execute a given received command. More...
 
int ctrl_cmd_install (enum ctrl_node_type node, struct ctrl_cmd_element *cmd)
 Install a given command definition at a given CTRL node. More...
 
int ctrl_cmd_send (struct osmo_wqueue *queue, struct ctrl_cmd *cmd)
 Encode a CTRL command and append it to the given write queue. More...
 
int ctrl_cmd_send_to_all (struct ctrl_handle *ctrl, struct ctrl_cmd *cmd)
 Send a CTRL command to all connections. More...
 
struct ctrl_cmdctrl_cmd_parse3 (void *ctx, struct msgb *msg, bool *parse_failed)
 Parse/Decode CTRL from Message buffers into command struct. More...
 
struct ctrl_cmdctrl_cmd_parse2 (void *ctx, struct msgb *msg)
 Parse/Decode CTRL from Message buffers into command struct. More...
 
struct ctrl_cmdctrl_cmd_parse (void *ctx, struct msgb *msg)
 Parse/Decode CTRL from Message buffers into command struct. More...
 
struct msgbctrl_cmd_make (struct ctrl_cmd *cmd)
 Encode a given CTRL command from its parsed form into a message buffer. More...
 
struct ctrl_cmdctrl_cmd_cpy (void *ctx, struct ctrl_cmd *cmd)
 Perform a deepl copy of the given cmd, allocating memory from ctx. More...
 
struct ctrl_cmdctrl_cmd_create (void *ctx, enum ctrl_type)
 Allocate a control command of given type. More...
 
struct ctrl_cmdctrl_cmd_trap (struct ctrl_cmd *cmd)
 Copy given cmd and convert copy to CTRL_TYPE_TRAP. More...
 

Variables

const struct value_string ctrl_type_vals []
 human-readable string names for ctrl_type More...
 

Macro Definition Documentation

◆ CTRL_CMD_DEFINE

#define CTRL_CMD_DEFINE (   cmdname,
  cmdstr 
)
Value:
static int get_##cmdname(struct ctrl_cmd *cmd, void *data); \
static int set_##cmdname(struct ctrl_cmd *cmd, void *data); \
static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data); \
CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, verify_##cmdname)

Declare a read-write attribute.

Declares get, set, verify.

Parameters
[in]cmdnamesymbol name of the command related functions/structures
[in]cmdstrstring name exposed on CTRL

◆ CTRL_CMD_DEFINE_RANGE

#define CTRL_CMD_DEFINE_RANGE (   cmdname,
  cmdstr,
  dtype,
  element,
  min,
  max 
)
Value:
CTRL_HELPER_GET_INT(cmdname, dtype, element) \
CTRL_HELPER_SET_INT(cmdname, dtype, element) \
CTRL_HELPER_VERIFY_RANGE(cmdname, min, max) \
CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, verify_##cmdname)

Helper to generate GET, SET, VERIFY + ctrl_cmd_element for integer.

Parameters
[in]cmdnamesymbol name of the command related function
[in]cmdstrstring name exposed on CTRL
[in]dtypename of outer struct of user data
[in]elementname of field within dtype
[in]minminimum permitted integer value
[in]maxmaximum permitted integer value

◆ CTRL_CMD_DEFINE_RO

#define CTRL_CMD_DEFINE_RO (   cmdname,
  cmdstr 
)
Value:
static int get_##cmdname(struct ctrl_cmd *cmd, void *data); \
static int set_##cmdname(struct ctrl_cmd *cmd, void *data) \
{ \
cmd->reply = "Read Only attribute"; \
return CTRL_CMD_ERROR; \
} \
static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data) \
{ \
cmd->reply = "Read Only attribute"; \
return 1; \
} \
CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, verify_##cmdname)

Define a read-only attribute.

Declares get, implements set+verify

Parameters
[in]cmdnamesymbol name of the command related functions/structures
[in]cmdstrstring name exposed on CTRL

◆ CTRL_CMD_DEFINE_STRING

#define CTRL_CMD_DEFINE_STRING (   cmdname,
  cmdstr,
  dtype,
  element 
)
Value:
CTRL_HELPER_GET_STRING(cmdname, dtype, element) \
CTRL_HELPER_SET_STRING(cmdname, dtype, element) \
CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, NULL)

Helper to generate GET, SET, VERIFY + ctrl_cmd_element for string.

Parameters
[in]cmdnamesymbol name of the command related function
[in]cmdstrstring name exposed on CTRL
[in]dtypename of outer struct of user data
[in]elementname of field within dtype

◆ CTRL_CMD_DEFINE_STRUCT

#define CTRL_CMD_DEFINE_STRUCT (   cmdname,
  cmdstr,
  verify_name 
)
Value:
static struct ctrl_cmd_element cmd_##cmdname = { \
.name = cmdstr, \
.get = &get_##cmdname, \
.set = &set_##cmdname, \
.verify = verify_name, \
}

Helper to generate static struct ctrl_cmd_element.

Parameters
[in]cmdnamesymbol name of the command related functions/structures
[in]cmdstrstring name exposed on CTRL
[in]verify_namefull symbol name of verification function

◆ CTRL_CMD_DEFINE_WO

#define CTRL_CMD_DEFINE_WO (   cmdname,
  cmdstr 
)
Value:
static int set_##cmdname(struct ctrl_cmd *cmd, void *data); \
static int get_##cmdname(struct ctrl_cmd *cmd, void *data) \
{ \
cmd->reply = "Write Only attribute"; \
return CTRL_CMD_ERROR; \
} \
static int verify_##cmdname(struct ctrl_cmd *cmd, const char *val, void *data); \
CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, verify_##cmdname)

Define a write-only attribute.

Declares set+verify, implements read call-back

Parameters
[in]cmdnamesymbol name of the command related functions/structures
[in]cmdstrstring name exposed on CTRL

◆ CTRL_CMD_DEFINE_WO_NOVRF

#define CTRL_CMD_DEFINE_WO_NOVRF (   cmdname,
  cmdstr 
)
Value:
static int set_##cmdname(struct ctrl_cmd *cmd, void *data); \
static int get_##cmdname(struct ctrl_cmd *cmd, void *data) \
{ \
cmd->reply = "Write Only attribute"; \
return CTRL_CMD_ERROR; \
} \
static int verify_##cmdname(struct ctrl_cmd *cmd, const char *val, void *data) \
{ \
return 0; \
} \
CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, verify_##cmdname)

Define a write-only attribute without verify.

Declares set, implements read+verify

Parameters
[in]cmdnamesymbol name of the command related functions/structures
[in]cmdstrstring name exposed on CTRL

◆ CTRL_CMD_ERROR

#define CTRL_CMD_ERROR   -1

◆ CTRL_CMD_HANDLED

#define CTRL_CMD_HANDLED   0

◆ CTRL_CMD_REPLY

#define CTRL_CMD_REPLY   1

◆ ctrl_cmd_reply_printf

#define ctrl_cmd_reply_printf (   cmd,
  fmt,
  args ... 
)    osmo_talloc_asprintf(cmd, cmd->reply, fmt, ## args)

◆ CTRL_CMD_TRAP_ID

#define CTRL_CMD_TRAP_ID   "0"

◆ CTRL_HELPER_GET_INT

#define CTRL_HELPER_GET_INT (   cmdname,
  dtype,
  element 
)
Value:
static int get_##cmdname(struct ctrl_cmd *cmd, void *_data) \
{ \
dtype *node = cmd->node; \
cmd->reply = talloc_asprintf(cmd, "%i", node->element); \
if (!cmd->reply) { \
cmd->reply = "OOM"; \
return CTRL_CMD_ERROR; \
} \
return CTRL_CMD_REPLY; \
}

Helper to generate static GET function for integer.

Parameters
[in]cmdnamesymbol name of the command related function
[in]dtypename of outer struct of user data
[in]elementname of field within dtype

◆ CTRL_HELPER_GET_STRING

#define CTRL_HELPER_GET_STRING (   cmdname,
  dtype,
  element 
)
Value:
static int get_##cmdname(struct ctrl_cmd *cmd, void *_data) \
{ \
dtype *data = cmd->node; \
cmd->reply = talloc_asprintf(cmd, "%s", data->element); \
if (!cmd->reply) { \
cmd->reply = "OOM"; \
return CTRL_CMD_ERROR; \
} \
return CTRL_CMD_REPLY; \
}

Helper to generate static GET function for string.

Parameters
[in]cmdnamesymbol name of the command related function
[in]dtypename of outer struct of user data
[in]elementname of field within dtype

◆ CTRL_HELPER_SET_INT

#define CTRL_HELPER_SET_INT (   cmdname,
  dtype,
  element 
)
Value:
static int set_##cmdname(struct ctrl_cmd *cmd, void *_data) \
{ \
dtype *node = cmd->node; \
int tmp = atoi(cmd->value); \
node->element = tmp; \
return get_##cmdname(cmd, _data); \
}

Helper to generate static SET function for integer.

Parameters
[in]cmdnamesymbol name of the command related function
[in]dtypename of outer struct of user data
[in]elementname of field within dtype

◆ CTRL_HELPER_SET_STRING

#define CTRL_HELPER_SET_STRING (   cmdname,
  dtype,
  element 
)
Value:
static int set_##cmdname(struct ctrl_cmd *cmd, void *_data) \
{ \
dtype *data = cmd->node; \
osmo_talloc_replace_string(cmd->node, &data->element, cmd->value); \
return get_##cmdname(cmd, _data); \
}

Helper to generate static SET function for string.

Parameters
[in]cmdnamesymbol name of the command related function
[in]dtypename of outer struct of user data
[in]elementname of field within dtype

◆ CTRL_HELPER_VERIFY_RANGE

#define CTRL_HELPER_VERIFY_RANGE (   cmdname,
  min,
  max 
)
Value:
static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *_data) \
{ \
int tmp = atoi(value); \
if ((tmp >= min)&&(tmp <= max)) { \
return 0; \
} \
cmd->reply = "Input not within the range"; \
return -1; \
}

Helper to generate static VERIFY unction validating a numeric range.

Parameters
[in]cmdnamesymbol name of the command related function
[in]minminimum permitted integer value
[in]maxmaximum permitted integer value

Enumeration Type Documentation

◆ ctrl_node_type

The class of node at which a ctrl command is registered to.

Enumerator
CTRL_NODE_ROOT 
CTRL_NODE_BTS 
CTRL_NODE_TRX 
CTRL_NODE_TS 
CTRL_NODE_FSM 
CTRL_NODE_FSM_INST 
_LAST_CTRL_NODE 

◆ ctrl_type

enum ctrl_type

Ctrl command types (GET, SET, ...)

Enumerator
CTRL_TYPE_UNKNOWN 
CTRL_TYPE_GET 
CTRL_TYPE_SET 
CTRL_TYPE_GET_REPLY 
CTRL_TYPE_SET_REPLY 
CTRL_TYPE_TRAP 
CTRL_TYPE_ERROR 

Function Documentation

◆ ctrl_cmd_cpy()

struct ctrl_cmd* ctrl_cmd_cpy ( void *  ctx,
struct ctrl_cmd cmd 
)

Perform a deepl copy of the given cmd, allocating memory from ctx.

Parameters
[in]ctxtalloc context from which to allocate
[incmd CTRL command to be copied
Returns
deep copy of cmd on success; NULL on error

References ctrl_cmd::id, ctrl_cmd::reply, ctrl_cmd::type, ctrl_cmd::value, and ctrl_cmd::variable.

Referenced by ctrl_cmd_trap().

◆ ctrl_cmd_create()

struct ctrl_cmd* ctrl_cmd_create ( void *  ctx,
enum ctrl_type  type 
)

Allocate a control command of given type.

Parameters
[in]ctxtalloc context from which to allocate
[in]typecommand type to set after allocation
Returns
callee-allocated ctrl_cmd. Caller must talloc_free() it.

References type, and ctrl_cmd::type.

Referenced by ctrl_cmd_send_trap().

◆ ctrl_cmd_def_is_zombie()

int ctrl_cmd_def_is_zombie ( struct ctrl_cmd_def cd)

Determine if the given deferred control command is still alive or a zombie.

Parameters
[in]cddeferred ctrl command state
Returns
0 is cd is still alive; 1 if it's a zombie

References ctrl_cmd_def::cmd, ctrl_cmd_def::list, and llist_del().

◆ ctrl_cmd_def_make()

struct ctrl_cmd_def* ctrl_cmd_def_make ( const void *  ctx,
struct ctrl_cmd cmd,
void *  data,
unsigned int  secs 
)

Build a deferred control command state and keep it the per-connection list of deferred commands.

This function is typically called by a ctrl command handler that wishes to defer returning a response. The reutnred state can later be used to check if the deferred command is still alive, and to respond to the specific command. This only works to defer the response to GET and SET.

Parameters
[in]ctxtalloc context from whihc to allocate the ctrl_cmd_def
[in]cmdthe control command whose response is deferred
[in]dataopaque, user-defined pointer
[in]secsnumber of seconds until the command times out
Returns
callee-allocated ctrl_cmd_def

References ctrl_cmd::ccon, ctrl_cmd_def::cmd, data, ctrl_cmd_def::data, ctrl_connection::def_cmds, ctrl_cmd::defer, ctrl_cmd_def::list, and llist_add().

◆ ctrl_cmd_def_send()

int ctrl_cmd_def_send ( struct ctrl_cmd_def cd)

Send the response to a deferred ctrl command.

The command can only be a resply to a SET or a GET operation.

Parameters
[in]cddeferred ctrl command state
Returns
0 if command sent successfully; negative on error

References ctrl_cmd::ccon, ctrl_cmd_def::cmd, ctrl_cmd_send(), CTRL_TYPE_ERROR, CTRL_TYPE_GET, CTRL_TYPE_GET_REPLY, CTRL_TYPE_SET, CTRL_TYPE_SET_REPLY, ctrl_cmd_def::list, llist_del(), ctrl_cmd::type, and ctrl_connection::write_queue.

◆ ctrl_cmd_exec()

int ctrl_cmd_exec ( vector  vline,
struct ctrl_cmd command,
vector  node,
void *  data 
)

Execute a given received command.

Parameters
[in]vlinevector representing the available/registered commands
[in,out]commandparsed received command to be executed
[in]nodeCTRL interface node
[in]dataopaque data passed to verify(), get() and set() call-backs
Returns
CTRL_CMD_HANDLED or CTRL_CMD_REPLY; CTRL_CMD_ERROR on error

References CTRL_CMD_ERROR, ctrl_cmd_get_element_match(), CTRL_CMD_REPLY, CTRL_TYPE_ERROR, CTRL_TYPE_GET, CTRL_TYPE_GET_REPLY, CTRL_TYPE_SET, CTRL_TYPE_SET_REPLY, data, ctrl_cmd_element::get, node, ctrl_cmd::reply, ctrl_cmd_element::set, ctrl_cmd::type, ctrl_cmd::value, and ctrl_cmd_element::verify.

Referenced by ctrl_cmd_handle().

◆ ctrl_cmd_install()

int ctrl_cmd_install ( enum ctrl_node_type  node,
struct ctrl_cmd_element cmd 
)

Install a given command definition at a given CTRL node.

Parameters
[in]nodeCTRL node at which cmd is to be installed
[in]cmdcommand definition to be installed
Returns
0 on success; negative on error

References create_cmd_struct(), ctrl_node_vec, DLCTRL, LOGL_ERROR, LOGP, ctrl_cmd_element::name, node, ctrl_cmd_element::strcmd, vector_init(), vector_lookup_ensure(), vector_set(), and vector_set_index().

Referenced by ctrl_init(), and osmo_fsm_ctrl_cmds_install().

◆ ctrl_cmd_make()

struct msgb* ctrl_cmd_make ( struct ctrl_cmd cmd)

Encode a given CTRL command from its parsed form into a message buffer.

Parameters
[in]cmddecoded/parsed form of to-be-encoded command
Returns
callee-allocated message buffer containing the encoded cmd; NULL on error

References CTRL_TYPE_ERROR, CTRL_TYPE_GET, CTRL_TYPE_GET_REPLY, CTRL_TYPE_SET, CTRL_TYPE_SET_REPLY, CTRL_TYPE_TRAP, ctrl_type_vals, DLCTRL, get_value_string(), ctrl_cmd::id, len(), LOGL_ERROR, LOGL_NOTICE, LOGP, msg, msgb_alloc_headroom(), msgb_put(), ctrl_cmd::reply, type, ctrl_cmd::type, ctrl_cmd::value, and ctrl_cmd::variable.

Referenced by ctrl_cmd_send().

◆ ctrl_cmd_parse()

struct ctrl_cmd* ctrl_cmd_parse ( void *  ctx,
struct msgb msg 
)

Parse/Decode CTRL from Message buffers into command struct.

Parameters
[in]ctxtalloc context from which to allocate
[in]msgmessage buffer containing command to be decoded
Returns
callee-allocated decoded CTRL command; NULL on allocation or other failure The caller is responsible to talloc_free() the returned struct pointer.

References ctrl_cmd_parse2(), CTRL_TYPE_ERROR, msg, and res.

◆ ctrl_cmd_parse2()

struct ctrl_cmd* ctrl_cmd_parse2 ( void *  ctx,
struct msgb msg 
)

Parse/Decode CTRL from Message buffers into command struct.

Parameters
[in]ctxtalloc context from which to allocate
[in]msgmessage buffer containing command to be decoded
Returns
callee-allocated decoded CTRL command; NULL on allocation failure, ctrl->type == CTRL_TYPE_ERROR and an error message in ctrl->reply on any error. The caller is responsible to talloc_free() the returned struct pointer. If information of the origin of the ERROR cmd returned is required (received or local parsing failure), use ctrl_cmd_parse3 instead.

References ctrl_cmd_parse3(), and msg.

Referenced by ctrl_cmd_exec_from_string(), and ctrl_cmd_parse().

◆ ctrl_cmd_parse3()

struct ctrl_cmd* ctrl_cmd_parse3 ( void *  ctx,
struct msgb msg,
bool *  parse_failed 
)

Parse/Decode CTRL from Message buffers into command struct.

Parameters
[in]ctxtalloc context from which to allocate
[in]msgmessage buffer containing command to be decoded
[out]parse_failedWhether returned ERROR cmd was generatd locally (due to parse failure) or was received.
Returns
callee-allocated decoded CTRL command; NULL on allocation failure, ctrl->type == CTRL_TYPE_ERROR and an error message in ctrl->reply on any error. The caller is responsible to talloc_free() the returned struct pointer.

References CTRL_TYPE_ERROR, CTRL_TYPE_GET, CTRL_TYPE_GET_REPLY, CTRL_TYPE_SET, CTRL_TYPE_SET_REPLY, CTRL_TYPE_TRAP, CTRL_TYPE_UNKNOWN, ctrl_type_vals, DLCTRL, get_string_value(), get_value_string(), ctrl_cmd::id, id_str_valid(), LOGL_DEBUG, LOGL_ERROR, LOGL_NOTICE, LOGP, msg, msgb_put_u8(), OSMO_ASSERT, osmo_escape_str(), osmo_separated_identifiers_valid(), ctrl_cmd::reply, REPLY_CASE, ctrl_cmd::type, ctrl_cmd::value, and ctrl_cmd::variable.

Referenced by ctrl_cmd_parse2(), and ctrl_handle_msg().

◆ ctrl_cmd_send()

int ctrl_cmd_send ( struct osmo_wqueue queue,
struct ctrl_cmd cmd 
)

Encode a CTRL command and append it to the given write queue.

Parameters
[in,out]queuewrite queue to which encoded cmd shall be appended
[in]cmddecoded command representation
Returns
0 in case of success; negative on error

Referenced by ctrl_cmd_def_send().

◆ ctrl_cmd_send_to_all()

int ctrl_cmd_send_to_all ( struct ctrl_handle ctrl,
struct ctrl_cmd cmd 
)

Send a CTRL command to all connections.

Parameters
[in]ctrlglobal control handle
[in]cmdcommand to send to all connections in ctrl
Returns
number of times the command has been sent

References ctrl_cmd::ccon, ctrl_handle::ccon_list, ctrl_cmd_send(), ctrl_connection::list_entry, llist_for_each_entry, and ctrl_connection::write_queue.

Referenced by ctrl_cmd_send_trap().

◆ ctrl_cmd_trap()

struct ctrl_cmd* ctrl_cmd_trap ( struct ctrl_cmd cmd)

Copy given cmd and convert copy to CTRL_TYPE_TRAP.

Parameters
[in]cmdcommand to be copied
Returns
pointer to newly-allocated copy of type TRAP. Allocated as sibling of cmd

References ctrl_cmd::ccon, ctrl_cmd_cpy(), CTRL_TYPE_TRAP, and ctrl_cmd::type.

Variable Documentation

◆ ctrl_type_vals

const struct value_string ctrl_type_vals[]

human-readable string names for ctrl_type

Referenced by ctrl_cmd_handle(), ctrl_cmd_make(), and ctrl_cmd_parse3().

ctrl_cmd_reply_printf
#define ctrl_cmd_reply_printf(cmd, fmt, args ...)
Definition: control_cmd.h:85
ctrl_cmd_exec
int ctrl_cmd_exec(vector vline, struct ctrl_cmd *command, vector node, void *data)
Execute a given received command.
Definition: control_cmd.c:94
osmo_stat_item_get_last
int32_t osmo_stat_item_get_last(const struct osmo_stat_item *item)
vty::index
void * index
ctrl_node_vec
vector ctrl_node_vec
Definition: control_if.c:68
ctrl_cmd_parse2
struct ctrl_cmd * ctrl_cmd_parse2(void *ctx, struct msgb *msg)
Parse/Decode CTRL from Message buffers into command struct.
Definition: control_cmd.c:328
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)
Setup CTRL interface on a given address.
Definition: control_if.c:991
RATE_CTR_INTV_HOUR
RATE_CTR_INTV_HOUR
control_write_cb
static int control_write_cb(struct osmo_fd *bfd, struct msgb *msg)
Definition: control_if.c:473
ctrl_cmd_send_to_all
int ctrl_cmd_send_to_all(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd)
Send a CTRL command to all connections.
Definition: control_if.c:101
rate_ctr_group_desc::ctr_desc
const struct rate_ctr_desc * ctr_desc
ctrl_cmd::reply
char * reply
respnse message string
Definition: control_cmd.h:80
_vector
msgb_alloc_headroom
static struct msgb * msgb_alloc_headroom(uint16_t size, uint16_t headroom, const char *name)
ctrl_cmd_parse
struct ctrl_cmd * ctrl_cmd_parse(void *ctx, struct msgb *msg)
Parse/Decode CTRL from Message buffers into command struct.
Definition: control_cmd.c:301
ctrl_cmd_exec
int ctrl_cmd_exec(vector vline, struct ctrl_cmd *command, vector node, void *data)
Execute a given received command.
Definition: control_cmd.c:94
ctrl_connection::write_queue
struct osmo_wqueue write_queue
The queue for sending data back.
Definition: control_cmd.h:49
vector_set_index
int vector_set_index(vector v, unsigned int i, void *val)
ctrl_cmd_make
struct msgb * ctrl_cmd_make(struct ctrl_cmd *cmd)
Encode a given CTRL command from its parsed form into a message buffer.
Definition: control_cmd.c:523
ipa_ccm_send_pong
int ipa_ccm_send_pong(int fd)
ctrl_cmd_trap
struct ctrl_cmd * ctrl_cmd_trap(struct ctrl_cmd *cmd)
Copy given cmd and convert copy to CTRL_TYPE_TRAP.
Definition: control_if.c:165
control_close_conn
static void control_close_conn(struct ctrl_connection *ccon)
Definition: control_if.c:178
CTRL_HELPER_GET_STRING
#define CTRL_HELPER_GET_STRING(cmdname, dtype, element)
Helper to generate static GET function for string.
Definition: control_cmd.h:209
ctrl_cmd_send
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:119
get_value_string
const char * get_value_string(const struct value_string *vs, uint32_t val)
node
uint16_t node
rate_ctr_group::desc
const struct rate_ctr_group_desc * desc
ctrl_cmd::variable
char * variable
name of the variable
Definition: control_cmd.h:76
ctrl_cmd_element::strcmd
struct ctrl_cmd_struct strcmd
Definition: control_cmd.h:98
len
static size_t len(const char *str)
ctrl_cmd_parse3
struct ctrl_cmd * ctrl_cmd_parse3(void *ctx, struct msgb *msg, bool *parse_failed)
Parse/Decode CTRL from Message buffers into command struct.
Definition: control_cmd.c:342
get_fsm_inst_state
static int get_fsm_inst_state(struct ctrl_cmd *cmd, void *data)
Definition: fsm_ctrl_commands.c:80
create_cmd_struct
static void create_cmd_struct(struct ctrl_cmd_struct *cmd, const char *name)
Definition: control_cmd.c:172
ctrl_init
static int ctrl_init(unsigned int node_count)
Definition: control_if.c:888
ipaccess_head::proto
uint8_t proto
OSMO_ASSERT
#define OSMO_ASSERT(exp)
ctrl_cmd_struct
Definition: control_cmd.h:88
get_stat_item
static int get_stat_item(struct ctrl_cmd *cmd, void *data)
Definition: control_if.c:732
osmo_stat_item_get_by_name
const struct osmo_stat_item * osmo_stat_item_get_by_name(const struct osmo_stat_item_group *statg, const char *name)
osmo_stat_item_group
msgb_put
static unsigned char * msgb_put(struct msgb *msgb, unsigned int len)
ctrl_cmd::id
char * id
Definition: control_cmd.h:72
utils.h
ctrl_type_vals
const struct value_string ctrl_type_vals[]
human-readable string names for ctrl_type
Definition: control_cmd.c:43
ctrl_vty_get_bind_addr
const char * ctrl_vty_get_bind_addr(void)
Definition: control_vty.c:46
osmo_wqueue::write_cb
int(* write_cb)(struct osmo_fd *fd, struct msgb *msg)
ctrl_connection::pending_msg
struct msgb * pending_msg
Buffer for partial input data.
Definition: control_cmd.h:52
vector_active
#define vector_active(V)
lookup_helper::lookup
ctrl_cmd_lookup lookup
Definition: control_if.c:73
ipaccess_head_ext
rate_ctr_per_intv::rate
uint64_t rate
osmo_stat_item
osmo_fd_register
int osmo_fd_register(struct osmo_fd *fd)
osmo_escape_str
const char * osmo_escape_str(const char *str, int in_len)
osmo_fsm_inst::children
struct llist_head children
osmo_fd::cb
int(* cb)(struct osmo_fd *fd, unsigned int what)
cmd_free_strvec
void cmd_free_strvec(vector v)
IPAC_PROTO_IPACCESS
IPAC_PROTO_IPACCESS
control_vty.h
VTY_NEWLINE
#define VTY_NEWLINE
msgb.h
node_type
node_type
CTRL_NODE_ROOT
@ CTRL_NODE_ROOT
Definition: control_cmd.h:21
osmo_separated_identifiers_valid
bool osmo_separated_identifiers_valid(const char *str, const char *sep_chars)
msg
uint8_t msg[0]
llist_for_each_entry_safe
#define llist_for_each_entry_safe(pos, n, head, member)
IPAC_MSGT_PING
IPAC_MSGT_PING
vector_lookup
void * vector_lookup(vector v, unsigned int i)
osmo_fsm_inst::proc
struct osmo_fsm_inst::@0 proc
osmo_fsm_inst::child
struct llist_head child
get_string_value
int get_string_value(const struct value_string *vs, const char *str)
RATE_CTR_INTV_MIN
RATE_CTR_INTV_MIN
osmo_sock_get_name
char * osmo_sock_get_name(const void *ctx, int fd)
msgb_tailroom
static int msgb_tailroom(const struct msgb *msgb)
rate_ctr.h
ctrl_cmd_handle
int ctrl_cmd_handle(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data)
Definition: control_if.c:209
ctrl_handle::lookup
ctrl_cmd_lookup lookup
Definition: control_if.h:18
osmo_fd_unregister
void osmo_fd_unregister(struct osmo_fd *fd)
ctrl_connection::closed_cb
void(* closed_cb)(struct ctrl_connection *conn)
Callback if the connection was closed.
Definition: control_cmd.h:55
tall_vty_vec_ctx
void * tall_vty_vec_ctx
ctrl_handle
Definition: control_if.h:14
ctrl_cmd_parse2
struct ctrl_cmd * ctrl_cmd_parse2(void *ctx, struct msgb *msg)
Parse/Decode CTRL from Message buffers into command struct.
Definition: control_cmd.c:328
OSMO_FD_READ
#define OSMO_FD_READ
IPAC_MSGT_ID_ACK
IPAC_MSGT_ID_ACK
add_word
static void add_word(struct ctrl_cmd_struct *cmd, const char *start, const char *end)
Definition: control_cmd.c:155
INIT_LLIST_HEAD
#define INIT_LLIST_HEAD(ptr)
osmo_strlcpy
size_t osmo_strlcpy(char *dst, const char *src, size_t siz)
ctrl_initialized
static int ctrl_initialized
Definition: control_if.c:885
osmo_fsm_ctrl_cmds_install
int osmo_fsm_ctrl_cmds_install(void)
Definition: fsm_ctrl_commands.c:168
ctrl_type_vals
const struct value_string ctrl_type_vals[]
human-readable string names for ctrl_type
Definition: control_cmd.c:43
ctrl_interface_setup
struct ctrl_handle * ctrl_interface_setup(void *data, uint16_t port, ctrl_cmd_lookup lookup)
Definition: control_if.c:879
container_of
#define container_of(ptr, type, member)
ctrl_cmd_make
struct msgb * ctrl_cmd_make(struct ctrl_cmd *cmd)
Encode a given CTRL command from its parsed form into a message buffer.
Definition: control_cmd.c:523
start
uint32_t start
vector_lookup_ensure
void * vector_lookup_ensure(vector v, unsigned int i)
IPAC_PROTO_OSMO
IPAC_PROTO_OSMO
osmo_fsm_inst
CTRL_HELPER_GET_INT
#define CTRL_HELPER_GET_INT(cmdname, dtype, element)
Helper to generate static GET function for integer.
Definition: control_cmd.h:152
cmd_node
osmo_counter
ctrl_cmd::value
char * value
value of the specified CTRL variable
Definition: control_cmd.h:78
osmo_fsm
CTRL_TYPE_UNKNOWN
@ CTRL_TYPE_UNKNOWN
Definition: control_cmd.h:32
llist_del
static void llist_del(struct llist_head *entry)
ctrl_cmd_def
Definition: control_cmd.h:113
ipa_ccm_send_id_ack
int ipa_ccm_send_id_ack(int fd)
data
uint8_t data[0]
get_counter
static int get_counter(struct ctrl_cmd *cmd, void *data)
Definition: control_if.c:823
IPAC_PROTO_EXT_CTRL
IPAC_PROTO_EXT_CTRL
osmo_sock_init_ofd
int osmo_sock_init_ofd(struct osmo_fd *ofd, int family, int type, int proto, const char *host, uint16_t port, unsigned int flags)
get_fsm_inst_dump
static int get_fsm_inst_dump(struct ctrl_cmd *cmd, void *data)
Definition: fsm_ctrl_commands.c:130
msgb
LOGL_INFO
#define LOGL_INFO
install_node
void install_node(struct cmd_node *node, int(*func)(struct vty *))
ctrl_vty_get_bind_addr
const char * ctrl_vty_get_bind_addr(void)
Definition: control_vty.c:46
CONFIG_NODE
CONFIG_NODE
L_CTRL_NODE
L_CTRL_NODE
rate_ctr_get_by_name
const struct rate_ctr * rate_ctr_get_by_name(const struct rate_ctr_group *ctrg, const char *name)
vector_init
vector vector_init(unsigned int size)
ctrl_vty_ctx
static void * ctrl_vty_ctx
Definition: control_vty.c:27
osmo_wqueue::read_cb
int(* read_cb)(struct osmo_fd *fd)
ctrl_handle::data
void * data
Definition: control_if.h:16
res
uint8_t res[16]
vector_free
void vector_free(vector v)
CTRL_NODE_FSM
@ CTRL_NODE_FSM
Definition: control_cmd.h:25
CTRL_TYPE_SET
@ CTRL_TYPE_SET
Definition: control_cmd.h:34
ctrl_bind_port
static int ctrl_bind_port
Definition: control_vty.c:30
ipaccess_head
get_rate_ctr_value
static uint64_t get_rate_ctr_value(const struct rate_ctr *ctr, int intv, const char *grp)
Definition: control_if.c:577
osmo_fsm_find_by_name
struct osmo_fsm * osmo_fsm_find_by_name(const char *name)
ctrl_handle::reply_cb
ctrl_cmd_reply_cb reply_cb
Definition: control_if.h:27
rate_ctr_group
ctrl_cmd_element::get
int(* get)(struct ctrl_cmd *cmd, void *data)
call-back function implementing the GET operation
Definition: control_cmd.h:102
vector_slot
#define vector_slot(V, I)
msgb_free
void msgb_free(struct msgb *m)
vty
rate_ctr_get_group_by_name_idx
struct rate_ctr_group * rate_ctr_get_group_by_name_idx(const char *name, const unsigned int idx)
set_counter
static int set_counter(struct ctrl_cmd *cmd, void *data)
Definition: control_if.c:866
CTRL_CMD_TRAP_ID
#define CTRL_CMD_TRAP_ID
Definition: control_cmd.h:15
ctrl_vty_get_bind_port
uint16_t ctrl_vty_get_bind_port(uint16_t default_port)
Definition: control_vty.c:53
osmo_wqueue_enqueue
int osmo_wqueue_enqueue(struct osmo_wqueue *queue, struct msgb *data)
osmo_fsm_inst::parent
struct osmo_fsm_inst * parent
DLCTRL
#define DLCTRL
ipa_msg_recv_buffered
int ipa_msg_recv_buffered(int fd, struct msgb **rmsg, struct msgb **tmp_msg)
ctrl_cmd_def::data
void * data
Definition: control_cmd.h:116
ctrl_cmd_element::set
int(* set)(struct ctrl_cmd *cmd, void *data)
call-back function implementing the SET operation
Definition: control_cmd.h:100
ctrl_type
ctrl_type
Ctrl command types (GET, SET, ...)
Definition: control_cmd.h:31
ctrl_vty_init
int ctrl_vty_init(void *ctx)
Definition: control_vty.c:87
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:1053
ctrl_handle::listen_fd
struct osmo_fd listen_fd
Definition: control_if.h:15
osmo_wqueue
vty::node
int node
rate_ctr_group_desc::num_ctr
unsigned int num_ctr
handle_control_read
static int handle_control_read(struct osmo_fd *bfd)
Definition: control_if.c:342
control_if.h
osmo_fd::when
unsigned int when
config_write_ctrl
static int config_write_ctrl(struct vty *vty)
Definition: control_vty.c:74
ipaccess.h
ctrl_cmd_def::cmd
struct ctrl_cmd * cmd
Definition: control_cmd.h:115
ctrl_node
static struct cmd_node ctrl_node
Definition: control_vty.c:58
ctrl_cmd_struct::nr_commands
int nr_commands
Definition: control_cmd.h:89
lookup_helper
Definition: control_if.c:71
osmo_fsm_inst::name
const char * name
osmo_fsm_inst::state
uint32_t state
rate_ctr_desc::name
const char * name
id_str_valid
static bool id_str_valid(const char *str)
Definition: control_cmd.c:311
ctrl_cmd_install
int ctrl_cmd_install(enum ctrl_node_type node, struct ctrl_cmd_element *cmd)
Install a given command definition at a given CTRL node.
Definition: control_cmd.c:209
CTRL_CMD_REPLY
#define CTRL_CMD_REPLY
Definition: control_cmd.h:14
talloc.h
name
const char * name
ctrl_cmd
Represents a single ctrl command after parsing.
Definition: control_cmd.h:67
rate_ctr_group_get_ctr
struct rate_ctr * rate_ctr_group_get_ctr(struct rate_ctr_group *grp, unsigned int idx)
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:147
ipa_prepend_header
void ipa_prepend_header(struct msgb *msg, int proto)
llist_head
ctrl_cmd::type
enum ctrl_type type
command type
Definition: control_cmd.h:71
if
if(vty->type==VTY_SHELL_SERV)
ipaccess_head_ext::proto
uint8_t proto
REPLY_CASE
#define REPLY_CASE(TYPE, NAME)
ctrl_cmd_element
Implementation of a given CTRL command.
Definition: control_cmd.h:95
ctrl_cmd::node
void * node
node of the specified variable
Definition: control_cmd.h:74
osmo_fsm_inst::T
int T
osmo_str_to_int64
int osmo_str_to_int64(int64_t *result, const char *str, int base, int64_t min_val, int64_t max_val)
osmo_wqueue_init
void osmo_wqueue_init(struct osmo_wqueue *queue, int max_length)
ctrl_cmd_def_send
int ctrl_cmd_def_send(struct ctrl_cmd_def *cd)
Send the response to a deferred ctrl command.
Definition: control_cmd.c:631
ctrl_cmd_def_is_zombie
int ctrl_cmd_def_is_zombie(struct ctrl_cmd_def *cd)
Determine if the given deferred control command is still alive or a zombie.
Definition: control_cmd.c:614
LLIST_HEAD
static LLIST_HEAD(ctrl_lookup_helpers)
rate_ctr_group_desc::group_name_prefix
const char * group_name_prefix
CTRL_CMD_DEFINE_RO
CTRL_CMD_DEFINE_RO(stat_item, "stat_item *")
ipaccess_head::data
uint8_t data[0]
lookup_helper::list
struct llist_head list
Definition: control_if.c:72
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:967
listen_fd_cb
static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
Definition: control_if.c:525
llist_for_each_entry
#define llist_for_each_entry(pos, head, member)
osmo_fsm_inst::id
const char * id
osmo_stat_item_get_group_by_name_idx
struct osmo_stat_item_group * osmo_stat_item_get_group_by_name_idx(const char *name, const unsigned int idx)
LOGL_NOTICE
#define LOGL_NOTICE
ctrl_interface_setup_dynip
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:1026
llist_add
static void llist_add(struct llist_head *_new, struct llist_head *head)
desc
osmo_ctrl_conn_alloc
struct ctrl_connection * osmo_ctrl_conn_alloc(void *ctx, void *data)
Allocate CTRL connection.
Definition: control_if.c:505
osmo_counter_get_by_name
struct osmo_counter * osmo_counter_get_by_name(const char *name)
value_string
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:1078
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_cmd_create
struct ctrl_cmd * ctrl_cmd_create(void *ctx, enum ctrl_type type)
Allocate a control command of given type.
Definition: control_cmd.c:244
control_cmd.h
ctrl_vty_get_bind_port
uint16_t ctrl_vty_get_bind_port(uint16_t default_port)
Definition: control_vty.c:53
ctrl_handle::ccon_list
struct llist_head ccon_list
Definition: control_if.h:21
ctrl_cmd_def_make
struct ctrl_cmd_def * ctrl_cmd_def_make(const void *ctx, struct ctrl_cmd *cmd, void *data, unsigned int secs)
Build a deferred control command state and keep it the per-connection list of deferred commands.
Definition: control_cmd.c:592
CTRL_TYPE_GET
@ CTRL_TYPE_GET
Definition: control_cmd.h:33
msgb_hexdump
const char * msgb_hexdump(const struct msgb *msg)
CTRL_TYPE_GET_REPLY
@ CTRL_TYPE_GET_REPLY
Definition: control_cmd.h:35
ctrl_cmd_element::verify
int(* verify)(struct ctrl_cmd *cmd, const char *value, void *data)
call-back function to validate a value; called before SET
Definition: control_cmd.h:104
osmo_fsm_inst::fsm
struct osmo_fsm * fsm
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:383
llist_add_tail
static void llist_add_tail(struct llist_head *_new, struct llist_head *head)
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:1053
counter.h
osmo_wqueue::bfd
struct osmo_fd bfd
argv
argv
ctrl_connection::def_cmds
struct llist_head def_cmds
Pending deferred command responses for this connection.
Definition: control_cmd.h:61
ctrl_node_type
ctrl_node_type
The class of node at which a ctrl command is registered to.
Definition: control_cmd.h:20
ctrl_cmd_struct::command
char ** command
Definition: control_cmd.h:90
install_lib_element
void install_lib_element(int ntype, struct cmd_element *cmd)
CTRL_CMD_ERROR
#define CTRL_CMD_ERROR
Definition: control_cmd.h:12
_LAST_CTRL_NODE
@ _LAST_CTRL_NODE
Definition: control_cmd.h:27
rate_ctr::current
uint64_t current
ctrl_cmd::ccon
struct ctrl_connection * ccon
connection through which the command was received
Definition: control_cmd.h:69
argc
argc
ctrl_cmd_install
int ctrl_cmd_install(enum ctrl_node_type node, struct ctrl_cmd_element *cmd)
Install a given command definition at a given CTRL node.
Definition: control_cmd.c:209
ipaccess_head_ext::data
uint8_t data[0]
ctrl_connection::cmds
struct llist_head cmds
Pending commands for this connection.
Definition: control_cmd.h:58
ctrl_connection
Represents a single ctrl connection.
Definition: control_cmd.h:45
msgb_pull
static unsigned char * msgb_pull(struct msgb *msgb, unsigned int len)
rate_ctr::intv
struct rate_ctr_per_intv intv[RATE_CTR_INTV_NUM]
CTRL_NODE_FSM_INST
@ CTRL_NODE_FSM_INST
Definition: control_cmd.h:26
ipa_prepend_header_ext
void ipa_prepend_header_ext(struct msgb *msg, int proto)
ctrl_rate_ctr_group_handler
static int ctrl_rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *data)
Definition: control_if.c:608
set_rate_ctr
static int set_rate_ctr(struct ctrl_cmd *cmd, void *data)
Definition: control_if.c:715
osmo_fsm_inst_find_by_name
struct osmo_fsm_inst * osmo_fsm_inst_find_by_name(const struct osmo_fsm *fsm, const char *name)
ctrl_node_vec
vector ctrl_node_vec
Definition: control_if.c:68
verify_rate_ctr
static int verify_rate_ctr(struct ctrl_cmd *cmd, const char *value, void *data)
Definition: control_if.c:722
ctrl_cmd_send
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:119
osmo_fd
log_level_str
const char * log_level_str(unsigned int lvl)
ctrl_cmd_create
struct ctrl_cmd * ctrl_cmd_create(void *ctx, enum ctrl_type)
Allocate a control command of given type.
Definition: control_cmd.c:244
cmd_make_descvec
vector cmd_make_descvec(const char *string, const char *descstr)
LOGP
#define LOGP(ss, level, fmt, args...)
msgb_alloc
struct msgb * msgb_alloc(uint16_t size, const char *name)
ctrl_cmd_cpy
struct ctrl_cmd * ctrl_cmd_cpy(void *ctx, struct ctrl_cmd *cmd)
Perform a deepl copy of the given cmd, allocating memory from ctx.
Definition: control_cmd.c:260
type
enum osmo_sub_auth_type type
ctrl_cmd::defer
struct ctrl_cmd_def * defer
state representing deferred (async) response, if any
Definition: control_cmd.h:82
fsm.h
ipa.h
osmo_fsm_state_name
const char * osmo_fsm_state_name(const struct osmo_fsm *fsm, uint32_t state)
verify_counter
static int verify_counter(struct ctrl_cmd *cmd, const char *value, void *data)
Definition: control_if.c:874
get_rate_ctr
static int get_rate_ctr(struct ctrl_cmd *cmd, void *data)
Definition: control_if.c:623
msgb_put_u8
static void msgb_put_u8(struct msgb *msgb, uint8_t word)
RATE_CTR_INTV_NUM
#define RATE_CTR_INTV_NUM
rate_ctr_for_each_group
int rate_ctr_for_each_group(rate_ctr_group_handler_t handle_group, void *data)
msg_type
uint8_t msg_type
CMD_SUCCESS
return CMD_SUCCESS
DEFUN
DEFUN(cfg_ctrl_bind_addr, cfg_ctrl_bind_addr_cmd, "bind A.B.C.D [<0-65535>]", "Set bind address to listen for Control connections\n" "Local IP address (default 127.0.0.1)\n" "Local TCP port number\n")
Definition: control_vty.c:32
get_rate_ctr_group_idx
static int get_rate_ctr_group_idx(struct rate_ctr_group *ctrg, int intv, struct ctrl_cmd *cmd)
Definition: control_if.c:593
list
struct llist_head list
RATE_CTR_INTV_DAY
RATE_CTR_INTV_DAY
osmo_timer_remaining
int osmo_timer_remaining(const struct osmo_timer_list *timer, const struct timeval *now, struct timeval *remaining)
CTRL_CMD_HANDLED
#define CTRL_CMD_HANDLED
Definition: control_cmd.h:13
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
fsm_ctrl_node_lookup
static int fsm_ctrl_node_lookup(void *data, vector vline, int *node_type, void **node_data, int *i)
control interface lookup function for FSM's
Definition: fsm_ctrl_commands.c:24
command.h
osmo_fd::fd
int fd
socket.h
get_fsm_inst_parent_name
static int get_fsm_inst_parent_name(struct ctrl_cmd *cmd, void *data)
Definition: fsm_ctrl_commands.c:94
CTRL_CMD_DEFINE
CTRL_CMD_DEFINE(rate_ctr, "rate_ctr *")
osmo_counter::value
unsigned long value
LOGL_DEBUG
#define LOGL_DEBUG
select.h
ctrl_vty_bind_addr
static const char * ctrl_vty_bind_addr
Definition: control_vty.c:28
vector.h
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:940
CTRL_TYPE_ERROR
@ CTRL_TYPE_ERROR
Definition: control_cmd.h:38
OSMO_SOCK_F_BIND
#define OSMO_SOCK_F_BIND
IPAC_MSGT_PONG
IPAC_MSGT_PONG
CTRL_CMD_DEFINE_RO
CTRL_CMD_DEFINE_RO(fsm_inst_state, "state")
osmo_fd::data
void * data
CTRL_TYPE_TRAP
@ CTRL_TYPE_TRAP
Definition: control_cmd.h:37
LOGL_ERROR
#define LOGL_ERROR
RATE_CTR_INTV_SEC
RATE_CTR_INTV_SEC
osmo_stat_item_get_group_by_name_idxname
struct osmo_stat_item_group * osmo_stat_item_get_group_by_name_idxname(const char *group_name, const char *idx_name)
vector_set
int vector_set(vector v, void *val)
cmdvec
vector cmdvec
ctrl_cmd_def::list
struct llist_head list
Definition: control_cmd.h:114
ctrl_cmd_element::name
const char * name
textual name/id of the CTRL command
Definition: control_cmd.h:97
rate_ctr
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:1040
get_fsm_inst_timer
static int get_fsm_inst_timer(struct ctrl_cmd *cmd, void *data)
Definition: fsm_ctrl_commands.c:111
osmo_fsm_inst::timer
struct osmo_timer_list timer
vty_out
vty_out(vty, "!%s", VTY_NEWLINE)
ctrl_connection::list_entry
struct llist_head list_entry
Definition: control_cmd.h:46
osmo_fsm_inst_find_by_id
struct osmo_fsm_inst * osmo_fsm_inst_find_by_id(const struct osmo_fsm *fsm, const char *id)
fd
const struct osmo_fd * fd
CTRL_TYPE_SET_REPLY
@ CTRL_TYPE_SET_REPLY
Definition: control_cmd.h:36
ctrl_cmd_parse3
struct ctrl_cmd * ctrl_cmd_parse3(void *ctx, struct msgb *msg, bool *parse_failed)
Parse/Decode CTRL from Message buffers into command struct.
Definition: control_cmd.c:342
ctrl_cmd_get_element_match
static struct ctrl_cmd_element * ctrl_cmd_get_element_match(vector vline, vector node)
Definition: control_cmd.c:58
stat_item.h
ctrl_cmd_cpy
struct ctrl_cmd * ctrl_cmd_cpy(void *ctx, struct ctrl_cmd *cmd)
Perform a deepl copy of the given cmd, allocating memory from ctx.
Definition: control_cmd.c:260
osmo_str_to_int
int osmo_str_to_int(int *result, const char *str, int base, int min_val, int max_val)
osmo_fsm_inst::log_level
int log_level
osmo_wqueue_clear
void osmo_wqueue_clear(struct osmo_wqueue *queue)
cmd_make_strvec
vector cmd_make_strvec(const char *string)
rate_ctr_group::idx
unsigned int idx
DLINP
#define DLINP
osmo_fsm_ctrl_cmds_install
int osmo_fsm_ctrl_cmds_install(void)
Definition: fsm_ctrl_commands.c:168