diff --git a/tests/hwsim/test_mscs.py b/tests/hwsim/test_mscs.py new file mode 100644 index 000000000..b200550b3 --- /dev/null +++ b/tests/hwsim/test_mscs.py @@ -0,0 +1,231 @@ +# Test cases for MSCS +# Copyright (c) 2021, Jouni Malinen +# +# This software may be distributed under the terms of the BSD license. +# See README for more details. + +import struct +import time + +import hostapd +from utils import * + +def register_mcsc_req(hapd): + type = 0x00d0 + match = "1304" + if "OK" not in hapd.request("REGISTER_FRAME %04x %s" % (type, match)): + raise Exception("Could not register frame reception for Robust AV Streaming") + +def handle_mscs_req(hapd, wrong_dialog=False, status_code=0): + msg = hapd.mgmt_rx() + if msg['subtype'] != 13: + logger.info("RX:" + str(msg)) + raise Exception("Received unexpected Management frame") + categ, act, dialog_token = struct.unpack('BBB', msg['payload'][0:3]) + if categ != 19 or act != 4: + logger.info("RX:" + str(msg)) + raise Exception("Received unexpected Action frame") + + if wrong_dialog: + dialog_token = (dialog_token + 1) % 256 + msg['da'] = msg['sa'] + msg['sa'] = hapd.own_addr() + msg['payload'] = struct.pack('