# 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('