[abis_nm] introduce and use abis_nm_ipaccess_rsl_connect()

This commit is contained in:
Harald Welte 2009-10-19 22:11:11 +02:00
parent d004a6462a
commit 746d6091d9
3 changed files with 32 additions and 9 deletions

View File

@ -748,6 +748,8 @@ int abis_nm_ipaccess_msg(struct gsm_bts *bts, u_int8_t msg_type,
int abis_nm_ipaccess_set_nvattr(struct gsm_bts *bts, u_int8_t *attr,
int attr_len);
int abis_nm_ipaccess_restart(struct gsm_bts *bts);
int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx,
u_int32_t ip, u_int16_t port, u_int8_t stream);
/* Functions calling into other code parts */
enum nm_evt {

View File

@ -2479,7 +2479,7 @@ static int abis_nm_rx_ipacc(struct msgb *msg)
foh->obj_inst.bts_nr, foh->obj_inst.trx_nr,
foh->obj_inst.ts_nr);
DEBUGP(DNM, "IPACCESS(0x%02x): ", foh->msg_type);
DEBUGPC(DNM, "IPACCESS(0x%02x): ", foh->msg_type);
switch (foh->msg_type) {
case NM_MT_IPACC_RSL_CONNECT_ACK:
@ -2602,6 +2602,34 @@ int abis_nm_ipaccess_set_nvattr(struct gsm_bts *bts, u_int8_t *attr,
attr_len);
}
int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx,
u_int32_t ip, u_int16_t port, u_int8_t stream)
{
struct in_addr ia;
u_int8_t attr[] = { NM_ATT_IPACC_STREAM_ID, 0,
NM_ATT_IPACC_DST_IP_PORT, 0, 0,
NM_ATT_IPACC_DST_IP, 0, 0, 0, 0 };
int attr_len = sizeof(attr);
ia.s_addr = htonl(ip);
attr[1] = stream;
attr[3] = port >> 8;
attr[4] = port & 0xff;
*(u_int32_t *)(attr+6) = ia.s_addr;
/* if ip == 0, we use the default IP */
if (ip == 0)
attr_len -= 5;
DEBUGP(DNM, "ip.access RSL CONNECT IP=%s PORT=%u STREAM=0x%02x\n",
inet_ntoa(ia), htons(port), stream);
return abis_nm_ipaccess_msg(trx->bts, NM_MT_IPACC_RSL_CONNECT,
NM_OC_BASEB_TRANSC, trx->bts->bts_nr,
trx->nr, 0xff, attr, attr_len);
}
/* restart / reboot an ip.access nanoBTS */
int abis_nm_ipaccess_restart(struct gsm_bts *bts)
{

View File

@ -338,11 +338,6 @@ static unsigned char nanobts_attr_radio[] = {
NM_ATT_ARFCN_LIST, 0x00, 0x02, HARDCODED_ARFCN >> 8, HARDCODED_ARFCN & 0xff,
};
static unsigned char nanobts_attr_e0[] = {
NM_ATT_IPACC_STREAM_ID, 0x00,
NM_ATT_IPACC_DST_IP_PORT, 0x0b, 0xbb, /* TCP PORT for RSL */
};
/* Callback function to be called whenever we get a GSM 12.21 state change event */
int nm_state_event(enum nm_evt evt, u_int8_t obj_class, void *obj,
struct gsm_nm_state *old_state, struct gsm_nm_state *new_state)
@ -414,9 +409,7 @@ static int sw_activ_rep(struct msgb *mb)
switch (foh->obj_class) {
case NM_OC_BASEB_TRANSC:
/* TRX software is active, tell it to initiate RSL Link */
abis_nm_ipaccess_msg(trx->bts, 0xe0, NM_OC_BASEB_TRANSC,
trx->bts->bts_nr, trx->nr, 0xff,
nanobts_attr_e0, sizeof(nanobts_attr_e0));
abis_nm_ipaccess_rsl_connect(trx, 0, 3003, 0);
abis_nm_opstart(trx->bts, NM_OC_BASEB_TRANSC,
trx->bts->bts_nr, trx->nr, 0xff);
abis_nm_chg_adm_state(trx->bts, NM_OC_BASEB_TRANSC,