MCPcopy Create free account
hub / github.com/secdev/scapy / Dot15d4Beacon

Class Dot15d4Beacon

scapy/layers/dot15d4.py:264–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262
263
264class Dot15d4Beacon(Packet):
265 name = "802.15.4 Beacon"
266 fields_desc = [
267 XLEShortField("src_panid", 0x0),
268 dot15d4AddressField("src_addr", None, length_of="fcf_srcaddrmode"),
269 # Security field present if fcf_security == True
270 ConditionalField(PacketField("aux_sec_header", Dot15d4AuxSecurityHeader(), Dot15d4AuxSecurityHeader), # noqa: E501
271 lambda pkt:pkt.underlayer.getfieldval("fcf_security") is True), # noqa: E501
272
273 # Superframe spec field:
274 BitField("sf_sforder", 15, 4), # not used by ZigBee
275 BitField("sf_beaconorder", 15, 4), # not used by ZigBee
276 BitEnumField("sf_assocpermit", 0, 1, [False, True]),
277 BitEnumField("sf_pancoord", 0, 1, [False, True]),
278 BitField("sf_reserved", 0, 1), # not used by ZigBee
279 BitEnumField("sf_battlifeextend", 0, 1, [False, True]), # not used by ZigBee # noqa: E501
280 BitField("sf_finalcapslot", 15, 4), # not used by ZigBee
281
282 # GTS Fields
283 # GTS Specification (1 byte)
284 BitEnumField("gts_spec_permit", 1, 1, [False, True]), # GTS spec bit 7, true=1 iff PAN cord is accepting GTS requests # noqa: E501
285 BitField("gts_spec_reserved", 0, 4), # GTS spec bits 3-6
286 BitField("gts_spec_desccount", 0, 3), # GTS spec bits 0-2
287 # GTS Directions (0 or 1 byte)
288 ConditionalField(BitField("gts_dir_reserved", 0, 1), lambda pkt:pkt.getfieldval("gts_spec_desccount") != 0), # noqa: E501
289 ConditionalField(BitField("gts_dir_mask", 0, 7), lambda pkt:pkt.getfieldval("gts_spec_desccount") != 0), # noqa: E501
290 # GTS List (variable size)
291 # TODO add a Packet/FieldListField tied to 3bytes per count in gts_spec_desccount # noqa: E501
292
293 # Pending Address Fields:
294 # Pending Address Specification (1 byte)
295 BitField("pa_reserved_1", 0, 1),
296 BitField("pa_num_long", 0, 3), # number of long addresses pending
297 BitField("pa_reserved_2", 0, 1),
298 BitField("pa_num_short", 0, 3), # number of short addresses pending
299 # Address List (var length)
300 FieldListField("pa_short_addresses", [],
301 XLEShortField("", 0x0000),
302 count_from=lambda pkt: pkt.pa_num_short),
303 FieldListField("pa_long_addresses", [],
304 dot15d4AddressField("", 0, adjust=lambda pkt, x: 8),
305 count_from=lambda pkt: pkt.pa_num_long),
306 # TODO beacon payload
307 ]
308
309 def mysummary(self):
310 return self.sprintf("802.15.4 Beacon ( %Dot15d4Beacon.src_panid%:%Dot15d4Beacon.src_addr% ) assocPermit(%Dot15d4Beacon.sf_assocpermit%) panCoord(%Dot15d4Beacon.sf_pancoord%)") # noqa: E501
311
312
313class Dot15d4Cmd(Packet):

Callers

nothing calls this directly

Calls 9

XLEShortFieldClass · 0.90
ConditionalFieldClass · 0.90
PacketFieldClass · 0.90
BitFieldClass · 0.90
BitEnumFieldClass · 0.90
FieldListFieldClass · 0.90
dot15d4AddressFieldClass · 0.85
getfieldvalMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…