From 194a7025178821976f2c14be8e67621fe97ef413 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Wed, 31 Mar 2010 20:42:38 +0200 Subject: [PATCH] Work on Mobility Management: MM information procedure --- src/host/gsm48-andreas/gsm48_l3.h | 2 ++ src/host/gsm48-andreas/gsm48_mm.c | 48 ++++++++++++++++++------------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/host/gsm48-andreas/gsm48_l3.h b/src/host/gsm48-andreas/gsm48_l3.h index f2940a00d..469e886f6 100644 --- a/src/host/gsm48-andreas/gsm48_l3.h +++ b/src/host/gsm48-andreas/gsm48_l3.h @@ -242,6 +242,8 @@ struct gsm48_mmlayer { struct timer_list t3213; int t3212_value; struct llist_head mm_conn; + char name_short[32]; + char name_long[32]; }; /* MM connection types */ diff --git a/src/host/gsm48-andreas/gsm48_mm.c b/src/host/gsm48-andreas/gsm48_mm.c index e1c09d078..bccbcf690 100644 --- a/src/host/gsm48-andreas/gsm48_mm.c +++ b/src/host/gsm48-andreas/gsm48_mm.c @@ -578,6 +578,34 @@ static int gsm48_mm_rx_abort(struct osmocom_ms *ms, struct msgb *msg) return 0; } +/* 4.3.6.2 MM INFORMATION is received */ +static int gsm48_mm_rx_info(struct osmocom_ms *ms, struct msgb *msg) +{ + struct gsm48_hdr *gh = msgb_l3(msg); + unsigned int payload_len = msgb_l3len(msg) - sizeof(*gh); + struct tlv_parsed tp; + + if (payload_len < 0) + short: + DEBUGP(DMM, "Short read of location updating accept message error.\n"); + return -EINVAL; + } + tlv_parse(&tp, &rsl_att_tlvdef, gh->data, payload_len, 0, 0); + + /* long name */ + if (TLVP_PRESENT(&tp, GSM48_IE_NAME_LONG)) { + decode_network_name(mm->name_long, sizeof(mm->name_long), + TLVP_VAL(&tp, GSM48_IE_FACILITY)-1); + } + /* short name */ + if (TLVP_PRESENT(&tp, GSM48_IE_NAME_SHORT)) { + decode_network_name(mm->name_short, sizeof(mm->name_short), + TLVP_VAL(&tp, GSM48_IE_FACILITY)-1); + } + + return 0; +} + @@ -1056,26 +1084,6 @@ static int decode_lai(struct gsm48_loc_area_id *lai, u_int16_t *mcc, u_int16_t * *lac = ntohs(lai->lac); } -/* mm info is received from lower layer */ -static int gsm48_mm_rx_info(struct osmocom_ms *ms, struct msgb *msg) -{ - struct gsm48_hdr *gh = msgb_l3(msg); - unsigned int payload_len = msgb_l3len(msg) - sizeof(*gh); - struct tlv_parsed tp; - - tlv_parse(&tp, &rsl_att_tlvdef, gh->data, payload_len, 0, 0); - /* long name */ - if (TLVP_PRESENT(&tp, GSM48_IE_NAME_LONG)) { - decode_network_name(name_long, sizeof(name_long), - TLVP_VAL(&tp, GSM48_IE_FACILITY)-1); - } - /* short name */ - if (TLVP_PRESENT(&tp, GSM48_IE_NAME_SHORT)) { - decode_network_name(name_short, sizeof(name_short), - TLVP_VAL(&tp, GSM48_IE_FACILITY)-1); - } -} - /* location updating accept is received from lower layer */ static int gsm48_mm_rx_loc_upd_acc(struct osmocom_ms *ms, struct msgb *msg)