From 6fec79da189d049010d92ef11462df7c3822b91b Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 12 Feb 2011 14:57:17 +0100 Subject: OM2000: Add VTY commands for connect/disconnect and op_info --- openbsc/include/openbsc/abis_om2000.h | 10 +++++++--- openbsc/src/abis_om2000.c | 28 +++++++++++++++++++++------- openbsc/src/abis_om2000_vty.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 10 deletions(-) (limited to 'openbsc') diff --git a/openbsc/include/openbsc/abis_om2000.h b/openbsc/include/openbsc/abis_om2000.h index 94e00e5d5..ed8c1f3b6 100644 --- a/openbsc/include/openbsc/abis_om2000.h +++ b/openbsc/include/openbsc/abis_om2000.h @@ -35,9 +35,13 @@ int abis_om2k_rcvmsg(struct msgb *msg); extern const struct abis_om2k_mo om2k_mo_cf; -int abis_om2k_tx_reset_cmd(struct gsm_bts *bts, struct abis_om2k_mo *mo); -int abis_om2k_tx_start_req(struct gsm_bts *bts, struct abis_om2k_mo *mo); -int abis_om2k_tx_status_req(struct gsm_bts *bts, struct abis_om2k_mo *mo); +int abis_om2k_tx_reset_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo); +int abis_om2k_tx_start_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo); +int abis_om2k_tx_status_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo); +int abis_om2k_tx_connect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo); +int abis_om2k_tx_disconnect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo); +int abis_om2k_tx_op_info(struct gsm_bts *bts, const struct abis_om2k_mo *mo, + uint8_t operational); int abis_om2k_vty_init(void); diff --git a/openbsc/src/abis_om2000.c b/openbsc/src/abis_om2000.c index a2a69a2b4..f85c0226e 100644 --- a/openbsc/src/abis_om2000.c +++ b/openbsc/src/abis_om2000.c @@ -76,6 +76,10 @@ enum abis_om2k_msgtype { OM2K_MSGT_CONNECT_COMPL = 0x001e, OM2K_MSGT_CONNECT_REJ = 0x001f, + OM2K_MSGT_DISCONNECT_CMD = 0x0030, + OM2K_MSGT_DISCONNECT_COMPL = 0x0032, + OM2K_MSGT_DISCONNECT_REJ = 0x0033, + OM2K_MSGT_FAULT_REP_ACK = 0x0040, OM2K_MSGT_FAULT_REP_NACK = 0x0041, OM2K_MSGT_FAULT_REP = 0x0042, @@ -512,7 +516,7 @@ static int abis_om2k_cal_time_resp(struct gsm_bts *bts) return abis_om2k_sendmsg(bts, msg); } -static int abis_om2k_tx_simple(struct gsm_bts *bts, struct abis_om2k_mo *mo, +static int abis_om2k_tx_simple(struct gsm_bts *bts, const struct abis_om2k_mo *mo, uint8_t msg_type) { struct msgb *msg = om2k_msgb_alloc(); @@ -527,23 +531,33 @@ static int abis_om2k_tx_simple(struct gsm_bts *bts, struct abis_om2k_mo *mo, return abis_om2k_sendmsg(bts, msg); } -int abis_om2k_tx_reset_cmd(struct gsm_bts *bts, struct abis_om2k_mo *mo) +int abis_om2k_tx_reset_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo) { return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_RESET_CMD); } -int abis_om2k_tx_start_req(struct gsm_bts *bts, struct abis_om2k_mo *mo) +int abis_om2k_tx_start_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo) { return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_START_REQ); } -int abis_om2k_tx_status_req(struct gsm_bts *bts, struct abis_om2k_mo *mo) +int abis_om2k_tx_status_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo) { return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_STATUS_REQ); } -static int abis_om2k_tx_op_info(struct gsm_bts *bts, struct abis_om2k_mo *mo, - uint8_t operational) +int abis_om2k_tx_connect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo) +{ + return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_CONNECT_CMD); +} + +int abis_om2k_tx_disconnect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo) +{ + return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_DISCONNECT_CMD); +} + +int abis_om2k_tx_op_info(struct gsm_bts *bts, const struct abis_om2k_mo *mo, + uint8_t operational) { struct msgb *msg = om2k_msgb_alloc(); struct abis_om2k_hdr *o2k; @@ -559,7 +573,7 @@ static int abis_om2k_tx_op_info(struct gsm_bts *bts, struct abis_om2k_mo *mo, return abis_om2k_sendmsg(bts, msg); } -static int abis_om2k_tx_negot_req_ack(struct gsm_bts *bts, struct abis_om2k_mo *mo, +static int abis_om2k_tx_negot_req_ack(struct gsm_bts *bts, const struct abis_om2k_mo *mo, uint8_t *data, unsigned int len) { struct msgb *msg = om2k_msgb_alloc(); diff --git a/openbsc/src/abis_om2000_vty.c b/openbsc/src/abis_om2000_vty.c index 4d3ca584c..ce5991a66 100644 --- a/openbsc/src/abis_om2000_vty.c +++ b/openbsc/src/abis_om2000_vty.c @@ -166,6 +166,38 @@ DEFUN(om2k_status, om2k_status_cmd, return CMD_SUCCESS; } +DEFUN(om2k_connect, om2k_connect_cmd, + "connect-command", + "Connect the MO\n") +{ + struct oml_node_state *oms = vty->index; + + abis_om2k_tx_connect_cmd(oms->bts, &oms->mo); + return CMD_SUCCESS; +} + +DEFUN(om2k_disconnect, om2k_disconnect_cmd, + "disconnect-command", + "Disconnect the MO\n") +{ + struct oml_node_state *oms = vty->index; + + abis_om2k_tx_disconnect_cmd(oms->bts, &oms->mo); + return CMD_SUCCESS; +} + +DEFUN(om2k_op_info, om2k_op_info_cmd, + "operational-info <0-1>", + "Set operational information\n") +{ + struct oml_node_state *oms = vty->index; + int oper = atoi(argv[0]); + + abis_om2k_tx_op_info(oms->bts, &oms->mo, oper); + return CMD_SUCCESS; +} + + int abis_om2k_vty_init(void) { install_element(ENABLE_NODE, &om2k_class_inst_cmd); @@ -177,6 +209,9 @@ int abis_om2k_vty_init(void) install_element(OM2K_NODE, &om2k_reset_cmd); install_element(OM2K_NODE, &om2k_start_cmd); install_element(OM2K_NODE, &om2k_status_cmd); + install_element(OM2K_NODE, &om2k_connect_cmd); + install_element(OM2K_NODE, &om2k_disconnect_cmd); + install_element(OM2K_NODE, &om2k_op_info_cmd); return 0; } -- cgit v1.2.3