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

Class L2CAP_CmdHdr

scapy/layers/bluetooth.py:323–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321
322
323class L2CAP_CmdHdr(Packet):
324 name = "L2CAP command header"
325 fields_desc = [
326 ByteEnumField("code", 8, {1: "rej",
327 2: "conn_req",
328 3: "conn_resp",
329 4: "conf_req",
330 5: "conf_resp",
331 6: "disconn_req",
332 7: "disconn_resp",
333 8: "echo_req",
334 9: "echo_resp",
335 10: "info_req",
336 11: "info_resp",
337 12: "create_channel_req",
338 13: "create_channel_resp",
339 14: "move_channel_req",
340 15: "move_channel_resp",
341 16: "move_channel_confirm_req",
342 17: "move_channel_confirm_resp",
343 18: "conn_param_update_req",
344 19: "conn_param_update_resp",
345 20: "LE_credit_based_conn_req",
346 21: "LE_credit_based_conn_resp",
347 22: "flow_control_credit_ind",
348 23: "credit_based_conn_req",
349 24: "credit_based_conn_resp",
350 25: "credit_based_reconf_req",
351 26: "credit_based_reconf_resp"}),
352 ByteField("id", 1),
353 LEShortField("len", None)]
354
355 def post_build(self, p, pay):
356 p += pay
357 if self.len is None:
358 p = p[:2] + struct.pack("<H", len(pay)) + p[4:]
359 return p
360
361 def answers(self, other):
362 if other.id == self.id:
363 if self.code == 1:
364 return 1
365 if other.code in [2, 4, 6, 8, 10, 18] and self.code == other.code + 1: # noqa: E501
366 if other.code == 8:
367 return 1
368 return self.payload.answers(other.payload)
369 return 0
370
371
372class L2CAP_ConnReq(Packet):

Callers 1

recvMethod · 0.85

Calls 3

ByteEnumFieldClass · 0.90
ByteFieldClass · 0.90
LEShortFieldClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…