github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/socketenricher/socketenricher_x86_bpfel.go (about)

     1  // Code generated by bpf2go; DO NOT EDIT.
     2  //go:build 386 || amd64
     3  
     4  package socketenricher
     5  
     6  import (
     7  	"bytes"
     8  	_ "embed"
     9  	"fmt"
    10  	"io"
    11  
    12  	"github.com/cilium/ebpf"
    13  )
    14  
    15  type socketenricherSocketsKey struct {
    16  	Netns  uint32
    17  	Family uint16
    18  	Proto  uint8
    19  	_      [1]byte
    20  	Port   uint16
    21  	_      [2]byte
    22  }
    23  
    24  type socketenricherSocketsValue struct {
    25  	Mntns             uint64
    26  	PidTgid           uint64
    27  	UidGid            uint64
    28  	Task              [16]int8
    29  	Sock              uint64
    30  	DeletionTimestamp uint64
    31  	Ipv6only          int8
    32  	_                 [7]byte
    33  }
    34  
    35  // loadSocketenricher returns the embedded CollectionSpec for socketenricher.
    36  func loadSocketenricher() (*ebpf.CollectionSpec, error) {
    37  	reader := bytes.NewReader(_SocketenricherBytes)
    38  	spec, err := ebpf.LoadCollectionSpecFromReader(reader)
    39  	if err != nil {
    40  		return nil, fmt.Errorf("can't load socketenricher: %w", err)
    41  	}
    42  
    43  	return spec, err
    44  }
    45  
    46  // loadSocketenricherObjects loads socketenricher and converts it into a struct.
    47  //
    48  // The following types are suitable as obj argument:
    49  //
    50  //	*socketenricherObjects
    51  //	*socketenricherPrograms
    52  //	*socketenricherMaps
    53  //
    54  // See ebpf.CollectionSpec.LoadAndAssign documentation for details.
    55  func loadSocketenricherObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
    56  	spec, err := loadSocketenricher()
    57  	if err != nil {
    58  		return err
    59  	}
    60  
    61  	return spec.LoadAndAssign(obj, opts)
    62  }
    63  
    64  // socketenricherSpecs contains maps and programs before they are loaded into the kernel.
    65  //
    66  // It can be passed ebpf.CollectionSpec.Assign.
    67  type socketenricherSpecs struct {
    68  	socketenricherProgramSpecs
    69  	socketenricherMapSpecs
    70  }
    71  
    72  // socketenricherSpecs contains programs before they are loaded into the kernel.
    73  //
    74  // It can be passed ebpf.CollectionSpec.Assign.
    75  type socketenricherProgramSpecs struct {
    76  	IgBindIpv4E   *ebpf.ProgramSpec `ebpf:"ig_bind_ipv4_e"`
    77  	IgBindIpv4X   *ebpf.ProgramSpec `ebpf:"ig_bind_ipv4_x"`
    78  	IgBindIpv6E   *ebpf.ProgramSpec `ebpf:"ig_bind_ipv6_e"`
    79  	IgBindIpv6X   *ebpf.ProgramSpec `ebpf:"ig_bind_ipv6_x"`
    80  	IgFreeIpv4E   *ebpf.ProgramSpec `ebpf:"ig_free_ipv4_e"`
    81  	IgFreeIpv6E   *ebpf.ProgramSpec `ebpf:"ig_free_ipv6_e"`
    82  	IgTcpCoE      *ebpf.ProgramSpec `ebpf:"ig_tcp_co_e"`
    83  	IgTcpCoX      *ebpf.ProgramSpec `ebpf:"ig_tcp_co_x"`
    84  	IgUdp6Sendmsg *ebpf.ProgramSpec `ebpf:"ig_udp6_sendmsg"`
    85  	IgUdpSendmsg  *ebpf.ProgramSpec `ebpf:"ig_udp_sendmsg"`
    86  }
    87  
    88  // socketenricherMapSpecs contains maps before they are loaded into the kernel.
    89  //
    90  // It can be passed ebpf.CollectionSpec.Assign.
    91  type socketenricherMapSpecs struct {
    92  	GadgetSockets *ebpf.MapSpec `ebpf:"gadget_sockets"`
    93  	Start         *ebpf.MapSpec `ebpf:"start"`
    94  }
    95  
    96  // socketenricherObjects contains all objects after they have been loaded into the kernel.
    97  //
    98  // It can be passed to loadSocketenricherObjects or ebpf.CollectionSpec.LoadAndAssign.
    99  type socketenricherObjects struct {
   100  	socketenricherPrograms
   101  	socketenricherMaps
   102  }
   103  
   104  func (o *socketenricherObjects) Close() error {
   105  	return _SocketenricherClose(
   106  		&o.socketenricherPrograms,
   107  		&o.socketenricherMaps,
   108  	)
   109  }
   110  
   111  // socketenricherMaps contains all maps after they have been loaded into the kernel.
   112  //
   113  // It can be passed to loadSocketenricherObjects or ebpf.CollectionSpec.LoadAndAssign.
   114  type socketenricherMaps struct {
   115  	GadgetSockets *ebpf.Map `ebpf:"gadget_sockets"`
   116  	Start         *ebpf.Map `ebpf:"start"`
   117  }
   118  
   119  func (m *socketenricherMaps) Close() error {
   120  	return _SocketenricherClose(
   121  		m.GadgetSockets,
   122  		m.Start,
   123  	)
   124  }
   125  
   126  // socketenricherPrograms contains all programs after they have been loaded into the kernel.
   127  //
   128  // It can be passed to loadSocketenricherObjects or ebpf.CollectionSpec.LoadAndAssign.
   129  type socketenricherPrograms struct {
   130  	IgBindIpv4E   *ebpf.Program `ebpf:"ig_bind_ipv4_e"`
   131  	IgBindIpv4X   *ebpf.Program `ebpf:"ig_bind_ipv4_x"`
   132  	IgBindIpv6E   *ebpf.Program `ebpf:"ig_bind_ipv6_e"`
   133  	IgBindIpv6X   *ebpf.Program `ebpf:"ig_bind_ipv6_x"`
   134  	IgFreeIpv4E   *ebpf.Program `ebpf:"ig_free_ipv4_e"`
   135  	IgFreeIpv6E   *ebpf.Program `ebpf:"ig_free_ipv6_e"`
   136  	IgTcpCoE      *ebpf.Program `ebpf:"ig_tcp_co_e"`
   137  	IgTcpCoX      *ebpf.Program `ebpf:"ig_tcp_co_x"`
   138  	IgUdp6Sendmsg *ebpf.Program `ebpf:"ig_udp6_sendmsg"`
   139  	IgUdpSendmsg  *ebpf.Program `ebpf:"ig_udp_sendmsg"`
   140  }
   141  
   142  func (p *socketenricherPrograms) Close() error {
   143  	return _SocketenricherClose(
   144  		p.IgBindIpv4E,
   145  		p.IgBindIpv4X,
   146  		p.IgBindIpv6E,
   147  		p.IgBindIpv6X,
   148  		p.IgFreeIpv4E,
   149  		p.IgFreeIpv6E,
   150  		p.IgTcpCoE,
   151  		p.IgTcpCoX,
   152  		p.IgUdp6Sendmsg,
   153  		p.IgUdpSendmsg,
   154  	)
   155  }
   156  
   157  func _SocketenricherClose(closers ...io.Closer) error {
   158  	for _, closer := range closers {
   159  		if err := closer.Close(); err != nil {
   160  			return err
   161  		}
   162  	}
   163  	return nil
   164  }
   165  
   166  // Do not access this directly.
   167  //
   168  //go:embed socketenricher_x86_bpfel.o
   169  var _SocketenricherBytes []byte