aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@netfilter.org>2009-10-19 22:11:11 +0200
committerHarald Welte <laforge@netfilter.org>2009-10-19 22:11:11 +0200
commit746d6091d921b066f000debb2f0a844e1c5c258c (patch)
tree7ddeae249866794ab851617b59426b7e87fdc58c
parentd004a6462a839372554021108c3ae77343f6c1d0 (diff)
[abis_nm] introduce and use abis_nm_ipaccess_rsl_connect()
-rw-r--r--openbsc/include/openbsc/abis_nm.h2
-rwxr-xr-xopenbsc/src/abis_nm.c30
-rw-r--r--openbsc/src/bsc_init.c9
3 files changed, 32 insertions, 9 deletions
diff --git a/openbsc/include/openbsc/abis_nm.h b/openbsc/include/openbsc/abis_nm.h
index 3e72321c5..c3b8e556b 100644
--- a/openbsc/include/openbsc/abis_nm.h
+++ b/openbsc/include/openbsc/abis_nm.h
@@ -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 {
diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c
index ff122dc8d..58dd2b86d 100755
--- a/openbsc/src/abis_nm.c
+++ b/openbsc/src/abis_nm.c
@@ -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)
{
diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c
index adf37ed7f..40047c24c 100644
--- a/openbsc/src/bsc_init.c
+++ b/openbsc/src/bsc_init.c
@@ -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,