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))]