OM2000: Add VTY commands for connect/disconnect and op_info

This commit is contained in:
Harald Welte 2011-02-12 14:57:17 +01:00
parent 51c8238024
commit 6fec79da18
3 changed files with 63 additions and 10 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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;
}