Example #1
0
	def create_nested(self, attr, aid):
		try:
			if aid in self.nest_attr_map.keys():
				(nest_class, max_nest, nest_policy) = self.nest_attr_map[aid]
			e, nattr = py_nla_parse_nested(max_nest, attr, nest_policy)
			return factory.get_inst().create(nest_class, nattr, nest_policy)
		except Exception as e:
			return nla_type(attr)
Example #2
0
 def create_nested(self, attr, aid):
     try:
         if aid in self.nest_attr_map.keys():
             (nest_class, max_nest, nest_policy) = self.nest_attr_map[aid]
         e, nattr = nl.py_nla_parse_nested(max_nest, attr, nest_policy)
         return factory.get_inst().create(nest_class, nattr, nest_policy)
     except Exception as e:
         return nl.nla_type(attr)
Example #3
0
	def handle(self, msg, arg):
		try:
			e, attrs = py_genlmsg_parse(nlmsg_hdr(msg), 0, nl80211.ATTR_MAX, None)
			sta = factory.get_inst().create(station, self._ifidx, None, self._access, attrs)
			s = self.store_station(sta)
			return NL_SKIP
		except Exception as e:
			(t,v,tb) = sys.exc_info()
			print v.message
			traceback.print_tb(tb)
Example #4
0
	def handle(self, msg, arg):
		try:
			e, attrs = genl.py_genlmsg_parse(nl.nlmsg_hdr(msg), 0, nl80211.ATTR_MAX, None)
			if not nl80211.ATTR_BSS in attrs:
				return
			e, nattrs = nl.py_nla_parse_nested(len(bss_policy), attrs[nl80211.ATTR_BSS], bss_policy)
			self._bss.append(factory.get_inst().create(bss, nattrs, bss_policy))
		except Exception as e:
			(t,v,tb) = sys.exc_info()
			print v.message
			traceback.print_tb(tb)
		return nl.NL_SKIP
Example #5
0
	def handle(self, msg, arg):
		try:
			e, attrs = genl.py_genlmsg_parse(nl.nlmsg_hdr(msg), 0, nl80211.ATTR_MAX, None)
			if nl80211.ATTR_WDEV in attrs:
				wdevid = nl.nla_get_u64(attrs[nl80211.ATTR_WDEV])
				if wdevid in self._iface.keys():
					self._iface[wdevid].store_attrs(attrs)
				else:
					iface = factory.get_inst().create(interface, self._access, attrs)
					self._iface[iface.wdevid] = iface
			return nl.NL_SKIP
		except Exception as e:
			(t,v,tb) = sys.exc_info()
			print v.message
			traceback.print_tb(tb)
Example #6
0
	def handle(self, msg, arg):
		try:
			e, attrs = genl.py_genlmsg_parse(nl.nlmsg_hdr(msg), 0, nl80211.ATTR_MAX, None)
			if nl80211.ATTR_WIPHY in attrs:
				phynum = nl.nla_get_u32(attrs[nl80211.ATTR_WIPHY])
				if phynum in self._wiphy.keys():
					self._wiphy[phynum].store_attrs(attrs)
				else:
					phy = factory.get_inst().create(wiphy, self._access, attrs)
					self._wiphy[phy.phynum] = phy
			return nl.NL_SKIP
		except Exception as e:
			(t,v,tb) = sys.exc_info()
			print v.message
			traceback.print_tb(tb)
Example #7
0
 def handle(self, msg, arg):
     try:
         e, attrs = py_genlmsg_parse(nlmsg_hdr(msg), 0, nl80211.ATTR_MAX,
                                     None)
         if not nl80211.ATTR_BSS in attrs:
             return
         e, nattrs = py_nla_parse_nested(len(bss_policy),
                                         attrs[nl80211.ATTR_BSS],
                                         bss_policy)
         self._bss.append(factory.get_inst().create(bss, nattrs,
                                                    bss_policy))
     except Exception as e:
         (t, v, tb) = sys.exc_info()
         print(v.message)
         traceback.print_tb(tb)
     return NL_SKIP
Example #8
0
 def handle(self, msg, arg):
     try:
         e, attrs = py_genlmsg_parse(nlmsg_hdr(msg), 0, nl80211.ATTR_MAX,
                                     None)
         if nl80211.ATTR_WDEV in attrs:
             wdevid = nla_get_u64(attrs[nl80211.ATTR_WDEV])
             if wdevid in self._iface.keys():
                 self._iface[wdevid].store_attrs(attrs)
             else:
                 iface = factory.get_inst().create(interface, self._access,
                                                   attrs)
                 self._iface[iface.wdevid] = iface
         return NL_SKIP
     except Exception as e:
         (t, v, tb) = sys.exc_info()
         print v.message
         traceback.print_tb(tb)
Example #9
0
 def post_store_attrs(self, attrs):
     if nl80211.STA_INFO_STA_FLAGS in attrs:
         flags = factory.get_inst().create(
             sta_flags, self.attrs[nl80211.STA_INFO_STA_FLAGS])
         self._attrs[nl80211.STA_INFO_STA_FLAGS] = flags
Example #10
0
	def post_store_attrs(self, attrs):
		if nl80211.STA_INFO_STA_FLAGS in attrs:
			flags = factory.get_inst().create(sta_flags, self.attrs[nl80211.STA_INFO_STA_FLAGS])
			self._attrs[nl80211.STA_INFO_STA_FLAGS] = flags