github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/gadgets/trace/tcpdrop/tracer/tcpdrop_arm64_bpfel.go (about)

     1  // Code generated by bpf2go; DO NOT EDIT.
     2  //go:build arm64
     3  
     4  package tracer
     5  
     6  import (
     7  	"bytes"
     8  	_ "embed"
     9  	"fmt"
    10  	"io"
    11  
    12  	"github.com/cilium/ebpf"
    13  )
    14  
    15  type tcpdropEvent struct {
    16  	Saddr       [16]uint8
    17  	Daddr       [16]uint8
    18  	Timestamp   uint64
    19  	Af          uint16
    20  	Dport       uint16
    21  	Sport       uint16
    22  	State       uint8
    23  	Tcpflags    uint8
    24  	Reason      uint32
    25  	Netns       uint32
    26  	ProcCurrent struct {
    27  		MountNsId uint64
    28  		Pid       uint32
    29  		Tid       uint32
    30  		Uid       uint32
    31  		Gid       uint32
    32  		Task      [16]uint8
    33  	}
    34  	ProcSocket struct {
    35  		MountNsId uint64
    36  		Pid       uint32
    37  		Tid       uint32
    38  		Uid       uint32
    39  		Gid       uint32
    40  		Task      [16]uint8
    41  	}
    42  	_ [8]byte
    43  }
    44  
    45  // loadTcpdrop returns the embedded CollectionSpec for tcpdrop.
    46  func loadTcpdrop() (*ebpf.CollectionSpec, error) {
    47  	reader := bytes.NewReader(_TcpdropBytes)
    48  	spec, err := ebpf.LoadCollectionSpecFromReader(reader)
    49  	if err != nil {
    50  		return nil, fmt.Errorf("can't load tcpdrop: %w", err)
    51  	}
    52  
    53  	return spec, err
    54  }
    55  
    56  // loadTcpdropObjects loads tcpdrop and converts it into a struct.
    57  //
    58  // The following types are suitable as obj argument:
    59  //
    60  //	*tcpdropObjects
    61  //	*tcpdropPrograms
    62  //	*tcpdropMaps
    63  //
    64  // See ebpf.CollectionSpec.LoadAndAssign documentation for details.
    65  func loadTcpdropObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
    66  	spec, err := loadTcpdrop()
    67  	if err != nil {
    68  		return err
    69  	}
    70  
    71  	return spec.LoadAndAssign(obj, opts)
    72  }
    73  
    74  // tcpdropSpecs contains maps and programs before they are loaded into the kernel.
    75  //
    76  // It can be passed ebpf.CollectionSpec.Assign.
    77  type tcpdropSpecs struct {
    78  	tcpdropProgramSpecs
    79  	tcpdropMapSpecs
    80  }
    81  
    82  // tcpdropSpecs contains programs before they are loaded into the kernel.
    83  //
    84  // It can be passed ebpf.CollectionSpec.Assign.
    85  type tcpdropProgramSpecs struct {
    86  	IgTcpdrop *ebpf.ProgramSpec `ebpf:"ig_tcpdrop"`
    87  }
    88  
    89  // tcpdropMapSpecs contains maps before they are loaded into the kernel.
    90  //
    91  // It can be passed ebpf.CollectionSpec.Assign.
    92  type tcpdropMapSpecs struct {
    93  	Events        *ebpf.MapSpec `ebpf:"events"`
    94  	GadgetSockets *ebpf.MapSpec `ebpf:"gadget_sockets"`
    95  }
    96  
    97  // tcpdropObjects contains all objects after they have been loaded into the kernel.
    98  //
    99  // It can be passed to loadTcpdropObjects or ebpf.CollectionSpec.LoadAndAssign.
   100  type tcpdropObjects struct {
   101  	tcpdropPrograms
   102  	tcpdropMaps
   103  }
   104  
   105  func (o *tcpdropObjects) Close() error {
   106  	return _TcpdropClose(
   107  		&o.tcpdropPrograms,
   108  		&o.tcpdropMaps,
   109  	)
   110  }
   111  
   112  // tcpdropMaps contains all maps after they have been loaded into the kernel.
   113  //
   114  // It can be passed to loadTcpdropObjects or ebpf.CollectionSpec.LoadAndAssign.
   115  type tcpdropMaps struct {
   116  	Events        *ebpf.Map `ebpf:"events"`
   117  	GadgetSockets *ebpf.Map `ebpf:"gadget_sockets"`
   118  }
   119  
   120  func (m *tcpdropMaps) Close() error {
   121  	return _TcpdropClose(
   122  		m.Events,
   123  		m.GadgetSockets,
   124  	)
   125  }
   126  
   127  // tcpdropPrograms contains all programs after they have been loaded into the kernel.
   128  //
   129  // It can be passed to loadTcpdropObjects or ebpf.CollectionSpec.LoadAndAssign.
   130  type tcpdropPrograms struct {
   131  	IgTcpdrop *ebpf.Program `ebpf:"ig_tcpdrop"`
   132  }
   133  
   134  func (p *tcpdropPrograms) Close() error {
   135  	return _TcpdropClose(
   136  		p.IgTcpdrop,
   137  	)
   138  }
   139  
   140  func _TcpdropClose(closers ...io.Closer) error {
   141  	for _, closer := range closers {
   142  		if err := closer.Close(); err != nil {
   143  			return err
   144  		}
   145  	}
   146  	return nil
   147  }
   148  
   149  // Do not access this directly.
   150  //
   151  //go:embed tcpdrop_arm64_bpfel.o
   152  var _TcpdropBytes []byte