Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/scapy/libs/structures.py: 89%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

9 statements  

1# SPDX-License-Identifier: GPL-2.0-only 

2# This file is part of Scapy 

3# See https://scapy.net/ for more information 

4 

5""" 

6Commonly used structures shared across Scapy 

7""" 

8 

9import ctypes 

10 

11 

12class bpf_insn(ctypes.Structure): 

13 """"The BPF instruction data structure""" 

14 _fields_ = [("code", ctypes.c_ushort), 

15 ("jt", ctypes.c_ubyte), 

16 ("jf", ctypes.c_ubyte), 

17 ("k", ctypes.c_int)] 

18 

19 

20class bpf_program(ctypes.Structure): 

21 """"Structure for BIOCSETF""" 

22 _fields_ = [('bf_len', ctypes.c_int), 

23 ('bf_insns', ctypes.POINTER(bpf_insn))] 

24 

25 

26class sock_fprog(ctypes.Structure): 

27 """"Structure for SO_ATTACH_FILTER""" 

28 _fields_ = [('len', ctypes.c_ushort), 

29 ('filter', ctypes.POINTER(bpf_insn))]