diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-12-30 09:23:48 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-12-30 09:25:30 +0100 |
commit | 7992867f4b54dc99d5dbf0e03226ca844a6dc550 (patch) | |
tree | 776d391cde7debc145bdf571706aefd2dc4a25d0 /openbsc | |
parent | 1356c08cc8f22b4b75a845ebd96651577c984744 (diff) |
[abis] Refactor sw descr generation to a new methods
* This is used in sw_load_init and sw_load_end and both needs
to be touche for every BTS. Move it into a common method.
* This was only verified on the nanoBTS.
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/src/abis_nm.c | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c index bb2455d37..f82dc6f39 100644 --- a/openbsc/src/abis_nm.c +++ b/openbsc/src/abis_nm.c @@ -1221,18 +1221,8 @@ struct abis_nm_sw { static struct abis_nm_sw g_sw; -/* 6.2.1 / 8.3.1: Load Data Initiate */ -static int sw_load_init(struct abis_nm_sw *sw) +static void sw_add_file_id_and_ver(struct abis_nm_sw *sw, struct msgb *msg) { - struct abis_om_hdr *oh; - struct msgb *msg = nm_msgb_alloc(); - u_int8_t len = 3*2 + sw->file_id_len + sw->file_version_len; - - oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE); - fill_om_fom_hdr(oh, len, NM_MT_LOAD_INIT, sw->obj_class, - sw->obj_instance[0], sw->obj_instance[1], - sw->obj_instance[2]); - if (sw->bts->type == GSM_BTS_TYPE_NANOBTS) { msgb_v_put(msg, NM_ATT_SW_DESCR); msgb_tl16v_put(msg, NM_ATT_FILE_ID, sw->file_id_len, sw->file_id); @@ -1243,8 +1233,23 @@ static int sw_load_init(struct abis_nm_sw *sw) msgb_tlv_put(msg, NM_ATT_FILE_VERSION, sw->file_version_len, sw->file_version); } else { - return -1; + LOGP(DNM, LOGL_ERROR, "Please implement this for the BTS.\n"); } +} + +/* 6.2.1 / 8.3.1: Load Data Initiate */ +static int sw_load_init(struct abis_nm_sw *sw) +{ + struct abis_om_hdr *oh; + struct msgb *msg = nm_msgb_alloc(); + u_int8_t len = 3*2 + sw->file_id_len + sw->file_version_len; + + oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE); + fill_om_fom_hdr(oh, len, NM_MT_LOAD_INIT, sw->obj_class, + sw->obj_instance[0], sw->obj_instance[1], + sw->obj_instance[2]); + + sw_add_file_id_and_ver(sw, msg); msgb_tv_put(msg, NM_ATT_WINDOW_SIZE, sw->window_size); return abis_nm_sendmsg(sw->bts, msg); @@ -1343,19 +1348,7 @@ static int sw_load_end(struct abis_nm_sw *sw) sw->obj_instance[0], sw->obj_instance[1], sw->obj_instance[2]); - if (sw->bts->type == GSM_BTS_TYPE_NANOBTS) { - msgb_v_put(msg, NM_ATT_SW_DESCR); - msgb_tl16v_put(msg, NM_ATT_FILE_ID, sw->file_id_len, sw->file_id); - msgb_tl16v_put(msg, NM_ATT_FILE_VERSION, sw->file_version_len, - sw->file_version); - } else if (sw->bts->type == GSM_BTS_TYPE_BS11) { - msgb_tlv_put(msg, NM_ATT_FILE_ID, sw->file_id_len, sw->file_id); - msgb_tlv_put(msg, NM_ATT_FILE_VERSION, sw->file_version_len, - sw->file_version); - } else { - return -1; - } - + sw_add_file_id_and_ver(sw, msg); return abis_nm_sendmsg(sw->bts, msg); } |