示例#1
0
 def destroy_radio(self, radio_id):
     attrs = [netlink.U32Attr(HWSIM_ATTR_RADIO_ID, radio_id)]
     msg = netlink.GenlMessage(self._fid, HWSIM_CMD_DESTROY_RADIO,
                               flags = netlink.NLM_F_REQUEST |
                                       netlink.NLM_F_ACK,
                               attrs = attrs)
     msg.send_and_recv(self._conn)
示例#2
0
 def nrc_inject_mgmt_frame(self, stype):
     attrs = []
     attrs.append(netlink.U8Attr(NL_MGMT_FRAME_INJECTION_STYPE, stype))
     req = netlink.GenlMessage(self._fid,
                               NL_MGMT_FRAME_INJECTION,
                               flags=netlink.NLM_F_REQUEST
                               | netlink.NLM_F_ACK,
                               attrs=attrs)
     resp = req.send_and_recv(self._conn)
示例#3
0
文件: hwsim.py 项目: sjp01/hostapd
 def create_radio(self, n_channels=None):
     attrs = []
     if n_channels:
         attrs.append(netlink.U32Attr(HWSIM_ATTR_CHANNELS, n_channels))
     msg = netlink.GenlMessage(self._fid, HWSIM_CMD_CREATE_RADIO,
                               flags = netlink.NLM_F_REQUEST |
                                       netlink.NLM_F_ACK,
                               attrs = attrs)
     return msg.send_and_recv(self._conn).ret
示例#4
0
 def nrc_shell_cmd(self, cmd):
     attrs = []
     attrs.append(netlink.AddrAttr(NL_SHELL_RUN_CMD, cmd))
     req = netlink.GenlMessage(self._fid,
                               NL_SHELL_RUN,
                               flags=netlink.NLM_F_REQUEST
                               | netlink.NLM_F_ACK,
                               attrs=attrs)
     resp = req.send_and_recv(self._conn)
     resp_attrs = netlink.parse_attributes(resp.payload[4:])
     return resp_attrs[NL_SHELL_RUN_CMD_RESP].str()
示例#5
0
 def sec_trigger_mmic_failure(self):
     attrs = []
     # use default TID and TA
     req = netlink.GenlMessage(self._fid,
                               NL_TEST_MMIC_FAILURE,
                               flags=netlink.NLM_F_REQUEST
                               | netlink.NLM_F_ACK,
                               attrs=attrs)
     resp = req.send_and_recv(self._conn)
     resp_attrs = netlink.parse_attributes(resp.payload[4:])
     return resp_attrs[NL_WFA_CAPI_PARAM_RESP].nulstr()
示例#6
0
 def destroy_radio(self, radio_id):
     try:
         int(radio_id)
         attrs = [netlink.U32Attr(HWSIM_ATTR_RADIO_ID, int(radio_id))]
     except ValueError:
         attrs = [netlink.NulStrAttr(HWSIM_ATTR_RADIO_NAME, radio_id)]
     msg = netlink.GenlMessage(self._fid, HWSIM_CMD_DESTROY_RADIO,
                               flags = netlink.NLM_F_REQUEST |
                                       netlink.NLM_F_ACK,
                               attrs = attrs)
     msg.send_and_recv(self._conn)
示例#7
0
    def wfa_capi_sta_send_addba_tid(self, tid):
        attrs = []
        attrs.append(netlink.U8Attr(NL_WFA_CAPI_PARAM_TID, tid))

        req = netlink.GenlMessage(self._fid,
                                  NL_WFA_CAPI_STA_SEND_ADDBA,
                                  flags=netlink.NLM_F_REQUEST
                                  | netlink.NLM_F_ACK,
                                  attrs=attrs)
        resp = req.send_and_recv(self._conn)
        resp_attrs = netlink.parse_attributes(resp.payload[4:])
        return resp_attrs[NL_WFA_CAPI_PARAM_RESP].nulstr()
示例#8
0
    def wfa_capi_sta_get_info(self):
        attrs = []
        attrs.append(netlink.NulStrAttr(NL_WFA_CAPI_INTF_ID, b'test'))
        req = netlink.GenlMessage(self._fid,
                                  NL_WFA_CAPI_STA_GET_INFO,
                                  flags=netlink.NLM_F_REQUEST
                                  | netlink.NLM_F_ACK,
                                  attrs=attrs)

        resp = req.send_and_recv(self._conn)
        resp_attrs = netlink.parse_attributes(resp.payload[4:])
        return resp_attrs
示例#9
0
 def wfa_halow_set(self, cmd, value):
     attrs = []
     attrs.append(netlink.NulStrAttr(NL_HALOW_PARAM_NAME, cmd))
     attrs.append(netlink.NulStrAttr(NL_HALOW_PARAM_STR_VAL, value))
     req = netlink.GenlMessage(self._fid,
                               NL_HALOW_SET_DUT,
                               flags=netlink.NLM_F_REQUEST
                               | netlink.NLM_F_ACK,
                               attrs=attrs)
     resp = req.send_and_recv(self._conn)
     resp_attrs = netlink.parse_attributes(resp.payload[4:])
     return resp_attrs[NL_HALOW_RESPONSE].nulstr()
示例#10
0
 def wfa_capi_sta_set_11n(self, cmd, value):
     attrs = []
     attrs.append(netlink.NulStrAttr(NL_WFA_CAPI_INTF_ID, b'test'))
     attrs.append(netlink.NulStrAttr(NL_WFA_CAPI_PARAM_NAME, cmd))
     attrs.append(netlink.NulStrAttr(NL_WFA_CAPI_PARAM_STR_VAL, value))
     req = netlink.GenlMessage(self._fid,
                               NL_WFA_CAPI_STA_SET_11N,
                               flags=netlink.NLM_F_REQUEST
                               | netlink.NLM_F_ACK,
                               attrs=attrs)
     resp = req.send_and_recv(self._conn)
     resp_attrs = netlink.parse_attributes(resp.payload[4:])
     return resp_attrs[NL_WFA_CAPI_PARAM_RESP].nulstr()
示例#11
0
    def create_radio(self, n_channels=None, use_chanctx=False,
                     use_p2p_device=False):
        attrs = []
        if n_channels:
            attrs.append(netlink.U32Attr(HWSIM_ATTR_CHANNELS, n_channels))
        if use_chanctx:
            attrs.append(netlink.FlagAttr(HWSIM_ATTR_USE_CHANCTX))
        if use_p2p_device:
            attrs.append(netlink.FlagAttr(HWSIM_ATTR_SUPPORT_P2P_DEVICE))

        msg = netlink.GenlMessage(self._fid, HWSIM_CMD_CREATE_RADIO,
                                  flags = netlink.NLM_F_REQUEST |
                                          netlink.NLM_F_ACK,
                                  attrs = attrs)
        return msg.send_and_recv(self._conn).ret
示例#12
0
    def create_radio(self, n_channels=None, use_chanctx=False, hwname=None, no_vdev=False):
        attrs = []
        if n_channels:
            attrs.append(netlink.U32Attr(HWSIM_ATTR_CHANNELS, n_channels))
        if use_chanctx:
            attrs.append(netlink.FlagAttr(HWSIM_ATTR_USE_CHANCTX))
        if hwname:
            attrs.append(netlink.NulStrAttr(HWSIM_ATTR_RADIO_NAME, hwname))
        if no_vdev:
            attrs.append(netlink.FlagAttr(HWSIM_ATTR_NO_VDEV))

        msg = netlink.GenlMessage(self._fid, HWSIM_CMD_CREATE_RADIO,
                                  flags = netlink.NLM_F_REQUEST |
                                          netlink.NLM_F_ACK,
                                  attrs = attrs)
        return msg.send_and_recv(self._conn).ret