diff options
Diffstat (limited to 'include/osmocom/ctrl')
-rw-r--r-- | include/osmocom/ctrl/Makefile.am | 13 | ||||
-rw-r--r-- | include/osmocom/ctrl/control_cmd.h | 6 | ||||
-rw-r--r-- | include/osmocom/ctrl/control_if.h | 17 | ||||
-rw-r--r-- | include/osmocom/ctrl/control_vty.h | 5 | ||||
-rw-r--r-- | include/osmocom/ctrl/ports.h | 8 |
5 files changed, 42 insertions, 7 deletions
diff --git a/include/osmocom/ctrl/Makefile.am b/include/osmocom/ctrl/Makefile.am new file mode 100644 index 00000000..416e3ab4 --- /dev/null +++ b/include/osmocom/ctrl/Makefile.am @@ -0,0 +1,13 @@ +osmoctrl_HEADERS = \ + control_cmd.h \ + control_if.h \ + ports.h \ + $(NULL) + +if ENABLE_VTY +osmoctrl_HEADERS += \ + control_vty.h \ + $(NULL) +endif + +osmoctrldir = $(includedir)/osmocom/ctrl diff --git a/include/osmocom/ctrl/control_cmd.h b/include/osmocom/ctrl/control_cmd.h index 276a7def..e4f78fa2 100644 --- a/include/osmocom/ctrl/control_cmd.h +++ b/include/osmocom/ctrl/control_cmd.h @@ -24,6 +24,7 @@ enum ctrl_node_type { CTRL_NODE_TS, /* TS specific (net.btsN.trxM.tsI.) */ CTRL_NODE_FSM, /* Finite State Machine (description) */ CTRL_NODE_FSM_INST, /* Finite State Machine (instance) */ + CTRL_NODE_LCHAN, /* LCHAN specific (net.btsN.trxM.tsI.lchanL) */ _LAST_CTRL_NODE }; @@ -123,6 +124,7 @@ int ctrl_cmd_def_send(struct ctrl_cmd_def *cd); int ctrl_cmd_exec(vector vline, struct ctrl_cmd *command, vector node, void *data); int ctrl_cmd_install(enum ctrl_node_type node, struct ctrl_cmd_element *cmd); +/* ctrl_cmd_send is also declared in control_if.h, but legacy openbsc.git expects it here */ int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd); int ctrl_cmd_send_to_all(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd); struct ctrl_cmd *ctrl_cmd_parse3(void *ctx, struct msgb *msg, bool *parse_failed); @@ -234,9 +236,7 @@ static int set_##cmdname(struct ctrl_cmd *cmd, void *_data) \ * \param[in] cmdname symbol name of the command related function * \param[in] cmdstr string name exposed on CTRL * \param[in] dtype name of outer struct of user data - * \param[in] element name of field within \a dtype - * \param[in] min minimum permitted integer value - * \param[in] max maximum permitted integer value */ + * \param[in] element name of field within \a dtype */ #define CTRL_CMD_DEFINE_STRING(cmdname, cmdstr, dtype, element) \ CTRL_HELPER_GET_STRING(cmdname, dtype, element) \ CTRL_HELPER_SET_STRING(cmdname, dtype, element) \ diff --git a/include/osmocom/ctrl/control_if.h b/include/osmocom/ctrl/control_if.h index 5fa9588d..e262d9e2 100644 --- a/include/osmocom/ctrl/control_if.h +++ b/include/osmocom/ctrl/control_if.h @@ -9,6 +9,7 @@ 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); +typedef void (*ctrl_cmd_reply_cb)(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data); struct ctrl_handle { struct osmo_fd listen_fd; @@ -18,10 +19,17 @@ struct ctrl_handle { /* List of control connections */ struct llist_head ccon_list; + + /* User defined GET/SET REPLY handler. User can set cmd->defer to 1 in + order to own and keep the cmd pointer and free it after the function + returns. "data" param is the user data pointer supplied during + ctrl_handle allocation */ + ctrl_cmd_reply_cb reply_cb; }; -int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd); +int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd) OSMO_DEPRECATED("Use ctrl_cmd_send2() instead."); +int ctrl_cmd_send2(struct ctrl_connection *ccon, struct ctrl_cmd *cmd); int ctrl_cmd_send_trap(struct ctrl_handle *ctrl, const char *name, char *value); struct ctrl_handle *ctrl_handle_alloc(void *ctx, void *data, ctrl_cmd_lookup lookup); struct ctrl_handle *ctrl_handle_alloc2(void *ctx, void *data, @@ -29,19 +37,20 @@ struct ctrl_handle *ctrl_handle_alloc2(void *ctx, void *data, unsigned int node_count); struct ctrl_handle *ctrl_interface_setup(void *data, uint16_t port, ctrl_cmd_lookup lookup); +struct ctrl_handle *ctrl_interface_setup2(void *data, uint16_t default_port, ctrl_cmd_lookup lookup, + unsigned int node_count); struct ctrl_handle *ctrl_interface_setup_dynip(void *data, const char *bind_addr, uint16_t port, - ctrl_cmd_lookup lookup); + ctrl_cmd_lookup lookup) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE; struct ctrl_handle *ctrl_interface_setup_dynip2(void *data, const char *bind_addr, uint16_t port, ctrl_cmd_lookup lookup, - unsigned int node_count); + unsigned int node_count) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE; struct ctrl_connection *osmo_ctrl_conn_alloc(void *ctx, void *data); int ctrl_cmd_handle(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data); struct ctrl_cmd *ctrl_cmd_exec_from_string(struct ctrl_handle *ch, const char *cmdstr); int ctrl_lookup_register(ctrl_cmd_lookup lookup); - int ctrl_handle_msg(struct ctrl_handle *ctrl, struct ctrl_connection *ccon, struct msgb *msg); diff --git a/include/osmocom/ctrl/control_vty.h b/include/osmocom/ctrl/control_vty.h index af9ee991..a6cd012e 100644 --- a/include/osmocom/ctrl/control_vty.h +++ b/include/osmocom/ctrl/control_vty.h @@ -2,6 +2,8 @@ #pragma once +#include <stdint.h> + /* Add the 'ctrl' section to VTY, containing the 'bind' command. */ int ctrl_vty_init(void *ctx); @@ -9,3 +11,6 @@ int ctrl_vty_init(void *ctx); * This should be fed to ctrl_interface_setup() once the configuration has been * read. */ const char *ctrl_vty_get_bind_addr(void); + +/* Returns configured port passed to the 'line ctrl'/'bind' command or default_port. */ +uint16_t ctrl_vty_get_bind_port(uint16_t default_port); diff --git a/include/osmocom/ctrl/ports.h b/include/osmocom/ctrl/ports.h index 4c3b77f9..b4bceef3 100644 --- a/include/osmocom/ctrl/ports.h +++ b/include/osmocom/ctrl/ports.h @@ -12,6 +12,7 @@ #define OSMO_CTRL_PORT_TRX 4236 /* 4237 used by VTY interface */ #define OSMO_CTRL_PORT_BTS 4238 +#define OSMO_CTRL_PORT_BSC_NEIGH 4248 /* osmo-bsc Neighbor Resloution Service */ #define OSMO_CTRL_PORT_NITB_BSC 4249 #define OSMO_CTRL_PORT_BSC_NAT 4250 #define OSMO_CTRL_PORT_SGSN 4251 @@ -26,4 +27,11 @@ #define OSMO_CTRL_PORT_CBC 4265 /* 4266 used by D-GSM mDNS */ #define OSMO_CTRL_PORT_MGW 4267 +#define OSMO_CTRL_PORT_SMLC 4272 +/* 4273 used by VTY interface */ +#define OSMO_CTRL_PORT_HNODEB 4274 +/* 4275: OSMO_VTY_PORT_UPF */ +#define OSMO_CTRL_PORT_UPF 4276 +/* 4277: OSMO_VTY_PORT_PFCP_TOOL */ +#define OSMO_CTRL_PORT_PFCP_TOOL 4278 /* When adding/changing port numbers, keep docs and wiki in sync. See above. */ |