diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-03-25 10:00:18 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-03-25 11:16:07 +0100 |
commit | 63bb41152266fb61ed10f5972b37a7dcebe8d479 (patch) | |
tree | 5616455335c36ef5f4be22bf3662bd085c547483 /src | |
parent | 6cd4e9521d30f2c7291b6c153258ceebe6f0f185 (diff) |
bss patching: Add test cases for assignment and assignment complete patching
* Chosen Channel and Speech Version are both optional. Patch them
separately if they are present.
* Add testcase for the assignment request patching.
Diffstat (limited to 'src')
-rw-r--r-- | src/bss_patch.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/bss_patch.c b/src/bss_patch.c index be5aaf2..c05def5 100644 --- a/src/bss_patch.c +++ b/src/bss_patch.c @@ -80,22 +80,22 @@ static void patch_ass_cmpl(struct msgb *msg, int length) } tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 1, length - 1, 0, 0); - if (!TLVP_PRESENT(&tp, GSM0808_IE_CHOSEN_CHANNEL)) { + + /* Now patch chosen channel and speech version */ + + if (TLVP_PRESENT(&tp, GSM0808_IE_CHOSEN_CHANNEL)) { + data = (uint8_t *) TLVP_VAL(&tp, GSM0808_IE_CHOSEN_CHANNEL); + data[0] = 0x09; + } else { LOGP(DMSC, LOGL_ERROR, "Chosen Channel not in the MSG.\n"); - return; } - if (!TLVP_PRESENT(&tp, GSM0808_IE_SPEECH_VERSION)) { + if (TLVP_PRESENT(&tp, GSM0808_IE_SPEECH_VERSION)) { + data = (uint8_t *) TLVP_VAL(&tp, GSM0808_IE_SPEECH_VERSION); + data[0] = GSM0808_PERM_HR3; + } else { LOGP(DMSC, LOGL_ERROR, "Speech version not in the MSG.\n"); - return; } - - /* claim to have a TCH/H with no mode indication */ - data = (uint8_t *) TLVP_VAL(&tp, GSM0808_IE_CHOSEN_CHANNEL); - data[0] = 0x09; - - data = (uint8_t *) TLVP_VAL(&tp, GSM0808_IE_SPEECH_VERSION); - data[0] = GSM0808_PERM_HR3; } int bss_patch_filter_msg(struct msgb *msg, struct sccp_parse_result *sccp, int dir) |