def recv(conn): msgs = conn.recv() packet = msgs[0].payload dcb_family, cmd = struct.unpack("BBxx", packet[:4]) dcbnlmsg = DcbNlMessage(dcb_family, cmd) dcbnlmsg.attrs = parse_attributes(packet[4:]) return dcbnlmsg
def recv(conn): msg = conn.recv() packet = msg.payload hdr = _genl_hdr_parse(packet[:4]) genlmsg = GeNlMessage(msg.type, hdr.cmd, [], msg.flags) genlmsg.attrs = parse_attributes(packet[4:]) genlmsg.version = hdr.version return genlmsg
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()
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()
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()
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
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()
def recv(conn): msgs = conn.recv() genlmsgs = [] for msg in msgs: packet = msg.payload try: hdr = _genl_hdr_parse(packet[:4]) except: return genlmsgs genlmsgs.append(GeNlMessage(msg.type, hdr.cmd, [], msg.flags)) genlmsgs[-1].attrs = parse_attributes(packet[4:]) genlmsgs[-1].version = hdr.version return genlmsgs
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()
def recv(conn): msgs = conn.recv() genlmsgs = []; for msg in msgs: packet = msg.payload try: hdr = _genl_hdr_parse(packet[:4]) except: return genlmsgs genlmsgs.append(GeNlMessage(msg.type, hdr.cmd, [], msg.flags)) genlmsgs[-1].attrs = parse_attributes(packet[4:]) genlmsgs[-1].version = hdr.version return genlmsgs
def recv(conn, multiple = False): msgs = conn.recv(multiple = multiple) genlmsgs = [] if not multiple: msgs = [msgs] for msg in msgs: packet = msg.payload hdr = _genl_hdr_parse(packet[:4]) genlmsg = GeNlMessage(msg.type, hdr.cmd, [], msg.flags) genlmsg.attrs = parse_attributes(packet[4:]) genlmsg.version = hdr.version genlmsgs.append(genlmsg) if not multiple: return genlmsgs[0] return genlmsgs
def recv(conn, multiple=False): msgs = conn.recv(multiple=multiple) genlmsgs = [] if not multiple: msgs = [msgs] for msg in msgs: packet = msg.payload if not packet: continue hdr = _genl_hdr_parse(packet[:4]) genlmsg = GeNlMessage(msg.type, hdr.cmd, [], msg.flags) genlmsg.attrs = parse_attributes(packet[4:]) genlmsg.version = hdr.version genlmsgs.append(genlmsg) if not multiple: return genlmsgs[0] return genlmsgs