summaryrefslogtreecommitdiffstats
path: root/openbsc/include/openbsc
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2014-08-20 23:47:15 +0200
committerHarald Welte <laforge@gnumonks.org>2014-08-21 15:34:28 +0200
commitba874b82be0ad1752b46009ba403f9b7bf24492d (patch)
tree0677b2490d0a916f14321ef81dd4b91b131884c4 /openbsc/include/openbsc
parent0e167fc9740793cf4a3c82747919146073255486 (diff)
move libctrl from openbsc to libosmoctrl (libosmocore.git)
Diffstat (limited to 'openbsc/include/openbsc')
-rw-r--r--openbsc/include/openbsc/Makefile.am6
-rw-r--r--openbsc/include/openbsc/control_cmd.h179
-rw-r--r--openbsc/include/openbsc/control_if.h29
-rw-r--r--openbsc/include/openbsc/ctrl.h3
-rw-r--r--openbsc/include/openbsc/ipaccess.h11
5 files changed, 6 insertions, 222 deletions
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am
index e1bef4c03..7c6bcbe17 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/include/openbsc/Makefile.am
@@ -1,18 +1,18 @@
noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \
gsm_subscriber.h gsm_04_11.h debug.h signal.h \
- misdn.h chan_alloc.h paging.h \
+ misdn.h chan_alloc.h paging.h ctrl.h \
trau_mux.h rs232.h openbscdefines.h rtp_proxy.h \
bsc_rll.h mncc.h transaction.h ussd.h gsm_04_80.h \
silent_call.h mgcp.h meas_rep.h rest_octets.h \
system_information.h handover.h mgcp_internal.h \
vty.h socket.h e1_config.h trau_upqueue.h token_auth.h \
- handover_decision.h rrlp.h control_if.h \
+ handover_decision.h rrlp.h
crc24.h gprs_llc.h gprs_gmm.h \
gb_proxy.h gprs_sgsn.h gsm_04_08_gprs.h sgsn.h \
auth.h osmo_msc.h bsc_msc.h bsc_nat.h \
osmo_bsc_rf.h osmo_bsc.h network_listen.h bsc_nat_sccp.h \
osmo_msc_data.h osmo_bsc_grace.h sms_queue.h abis_om2000.h \
- bss.h gsm_data_shared.h control_cmd.h ipaccess.h mncc_int.h \
+ bss.h gsm_data_shared.h ipaccess.h mncc_int.h \
arfcn_range_encode.h nat_rewrite_trie.h bsc_nat_callstats.h \
osmux.h mgcp_transcode.h rtp.h gprs_utils.h
diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h
deleted file mode 100644
index 2e6863a94..000000000
--- a/openbsc/include/openbsc/control_cmd.h
+++ /dev/null
@@ -1,179 +0,0 @@
-#ifndef _CONTROL_CMD_H
-#define _CONTROL_CMD_H
-
-#include <osmocom/core/msgb.h>
-#include <osmocom/core/talloc.h>
-#include <osmocom/core/write_queue.h>
-
-#include <osmocom/vty/vector.h>
-
-#include <openbsc/vty.h>
-
-#define CTRL_CMD_ERROR -1
-#define CTRL_CMD_HANDLED 0
-#define CTRL_CMD_REPLY 1
-
-struct ctrl_handle;
-
-enum ctrl_node_type {
- CTRL_NODE_ROOT, /* Root elements */
- CTRL_NODE_BTS, /* BTS specific (net.btsN.) */
- CTRL_NODE_TRX, /* TRX specific (net.btsN.trxM.) */
- CTRL_NODE_TS, /* TS specific (net.btsN.trxM.tsI.) */
- _LAST_CTRL_NODE
-};
-
-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
-};
-
-struct ctrl_connection {
- struct llist_head list_entry;
-
- /* The queue for sending data back */
- struct osmo_wqueue write_queue;
-
- /* Buffer for partial input data */
- struct msgb *pending_msg;
-
- /* Callback if the connection was closed */
- void (*closed_cb)(struct ctrl_connection *conn);
-
- /* Pending commands for this connection */
- struct llist_head cmds;
-};
-
-struct ctrl_cmd {
- struct ctrl_connection *ccon;
- enum ctrl_type type;
- char *id;
- void *node;
- char *variable;
- char *value;
- char *reply;
-};
-
-struct ctrl_cmd_struct {
- int nr_commands;
- char **command;
-};
-
-struct ctrl_cmd_element {
- const char *name;
- struct ctrl_cmd_struct strcmd;
- int (*set)(struct ctrl_cmd *cmd, void *data);
- int (*get)(struct ctrl_cmd *cmd, void *data);
- int (*verify)(struct ctrl_cmd *cmd, const char *value, void *data);
-};
-
-struct ctrl_cmd_map {
- char *cmd;
- enum ctrl_type type;
-};
-
-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);
-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_parse(void *ctx, struct msgb *msg);
-struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd);
-struct ctrl_cmd *ctrl_cmd_cpy(void *ctx, struct ctrl_cmd *cmd);
-struct ctrl_cmd *ctrl_cmd_create(void *ctx, enum ctrl_type);
-struct ctrl_cmd *ctrl_cmd_trap(struct ctrl_cmd *cmd);
-
-#define CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, verify_name) \
-static struct ctrl_cmd_element cmd_##cmdname = { \
- .name = cmdstr, \
- .get = &get_##cmdname, \
- .set = &set_##cmdname, \
- .verify = verify_name, \
-}
-
-#define CTRL_HELPER_GET_INT(cmdname, dtype, element) \
-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; \
-}
-#define CTRL_HELPER_SET_INT(cmdname, dtype, element) \
-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); \
-}
-#define CTRL_HELPER_VERIFY_RANGE(cmdname, min, max) \
-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; \
-}
-
-#define CTRL_CMD_DEFINE_RANGE(cmdname, cmdstr, dtype, element, min, max) \
- 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)
-
-#define CTRL_HELPER_GET_STRING(cmdname, dtype, element) \
-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; \
-}
-#define CTRL_HELPER_SET_STRING(cmdname, dtype, element) \
-static int set_##cmdname(struct ctrl_cmd *cmd, void *_data) \
-{ \
- dtype *data = cmd->node; \
- bsc_replace_string(cmd->node, &data->element, cmd->value); \
- return get_##cmdname(cmd, _data); \
-}
-#define CTRL_CMD_DEFINE_STRING(cmdname, cmdstr, dtype, element) \
- CTRL_HELPER_GET_STRING(cmdname, dtype, element) \
- CTRL_HELPER_SET_STRING(cmdname, dtype, element) \
-CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, NULL)
-
-#define CTRL_CMD_DEFINE(cmdname, cmdstr) \
-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)
-
-#define CTRL_CMD_DEFINE_RO(cmdname, cmdstr) \
-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)
-
-struct gsm_network;
-
-#endif /* _CONTROL_CMD_H */
diff --git a/openbsc/include/openbsc/control_if.h b/openbsc/include/openbsc/control_if.h
deleted file mode 100644
index d103332a9..000000000
--- a/openbsc/include/openbsc/control_if.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef _CONTROL_IF_H
-#define _CONTROL_IF_H
-
-#include <osmocom/core/write_queue.h>
-#include <openbsc/control_cmd.h>
-#include <openbsc/gsm_data.h>
-
-typedef int (*ctrl_cmd_handler)(struct ctrl_cmd *, void *);
-
-struct ctrl_handle {
- struct osmo_fd listen_fd;
- struct gsm_network *gsmnet;
-
- ctrl_cmd_handler handler;
-
- /* List of control connections */
- struct llist_head ccon_list;
-};
-
-
-int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd);
-struct ctrl_handle *controlif_setup(struct gsm_network *, uint16_t port,
- ctrl_cmd_handler handler);
-struct ctrl_handle *bsc_controlif_setup(struct gsm_network *gsmnet, uint16_t port);
-
-int bsc_ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data);
-
-#endif /* _CONTROL_IF_H */
-
diff --git a/openbsc/include/openbsc/ctrl.h b/openbsc/include/openbsc/ctrl.h
new file mode 100644
index 000000000..38fa054db
--- /dev/null
+++ b/openbsc/include/openbsc/ctrl.h
@@ -0,0 +1,3 @@
+#pragma once
+
+struct ctrl_handle *bsc_controlif_setup(struct gsm_network *net, uint16_t port);
diff --git a/openbsc/include/openbsc/ipaccess.h b/openbsc/include/openbsc/ipaccess.h
index f4a0946d6..4853aa123 100644
--- a/openbsc/include/openbsc/ipaccess.h
+++ b/openbsc/include/openbsc/ipaccess.h
@@ -27,17 +27,6 @@ struct ipac_ext_lac_cmd {
uint8_t data[0];
} __attribute__((packed));
-/*
- * methods for parsing and sending a message
- */
-void ipaccess_prepend_header(struct msgb *msg, int proto);
-void ipaccess_prepend_header_ext(struct msgb *msg, int proto);
-int ipaccess_send_pong(int fd);
-int ipaccess_send_id_ack(int fd);
-int ipaccess_send_id_req(int fd);
-
-const char *ipaccess_idtag_name(uint8_t tag);
-
int ipaccess_drop_oml(struct gsm_bts *bts);
int ipaccess_drop_rsl(struct gsm_bts_trx *trx);