diff --git a/tests/hwsim/test_scs.py b/tests/hwsim/test_scs.py new file mode 100644 index 000000000..df63cbfdf --- /dev/null +++ b/tests/hwsim/test_scs.py @@ -0,0 +1,196 @@ +# Test cases for SCS +# Copyright (c) 2021, Jouni Malinen +# Copyright (c) 2021, The Linux Foundation +# +# 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_scs_req(hapd): + type = 0x00d0 + match = "1300" + 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_scs_req(hapd, wrong_dialog=False, status_code=0, twice=False, + short=False, scsid=1): + 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 != 0: + 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() + count = 1 + if short: + resp = struct.pack('BBB', 19, 1, dialog_token) + else: + resp = struct.pack('BBBB', 19, 1, dialog_token, count) + resp += struct.pack('