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

     1  // Code generated by bpf2go; DO NOT EDIT.
     2  //go:build 386 || amd64
     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 tcpconnectEvent struct {
    16  	SaddrV6   [16]uint8
    17  	DaddrV6   [16]uint8
    18  	Task      [16]uint8
    19  	Timestamp uint64
    20  	Pid       uint32
    21  	Uid       uint32
    22  	Gid       uint32
    23  	Af        uint16
    24  	Dport     uint16
    25  	Sport     uint16
    26  	_         [6]byte
    27  	MntnsId   uint64
    28  	Latency   uint64
    29  }
    30  
    31  type tcpconnectIpv4FlowKey struct {
    32  	Saddr uint32
    33  	Daddr uint32
    34  	Dport uint16
    35  	_     [2]byte
    36  }
    37  
    38  type tcpconnectIpv6FlowKey struct {
    39  	Saddr [16]uint8
    40  	Daddr [16]uint8
    41  	Dport uint16
    42  }
    43  
    44  type tcpconnectPiddata struct {
    45  	Comm    [16]int8
    46  	Ts      uint64
    47  	Pid     uint32
    48  	Tid     uint32
    49  	MntnsId uint64
    50  }
    51  
    52  // loadTcpconnect returns the embedded CollectionSpec for tcpconnect.
    53  func loadTcpconnect() (*ebpf.CollectionSpec, error) {
    54  	reader := bytes.NewReader(_TcpconnectBytes)
    55  	spec, err := ebpf.LoadCollectionSpecFromReader(reader)
    56  	if err != nil {
    57  		return nil, fmt.Errorf("can't load tcpconnect: %w", err)
    58  	}
    59  
    60  	return spec, err
    61  }
    62  
    63  // loadTcpconnectObjects loads tcpconnect and converts it into a struct.
    64  //
    65  // The following types are suitable as obj argument:
    66  //
    67  //	*tcpconnectObjects
    68  //	*tcpconnectPrograms
    69  //	*tcpconnectMaps
    70  //
    71  // See ebpf.CollectionSpec.LoadAndAssign documentation for details.
    72  func loadTcpconnectObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
    73  	spec, err := loadTcpconnect()
    74  	if err != nil {
    75  		return err
    76  	}
    77  
    78  	return spec.LoadAndAssign(obj, opts)
    79  }
    80  
    81  // tcpconnectSpecs contains maps and programs before they are loaded into the kernel.
    82  //
    83  // It can be passed ebpf.CollectionSpec.Assign.
    84  type tcpconnectSpecs struct {
    85  	tcpconnectProgramSpecs
    86  	tcpconnectMapSpecs
    87  }
    88  
    89  // tcpconnectSpecs contains programs before they are loaded into the kernel.
    90  //
    91  // It can be passed ebpf.CollectionSpec.Assign.
    92  type tcpconnectProgramSpecs struct {
    93  	IgTcpDestroy *ebpf.ProgramSpec `ebpf:"ig_tcp_destroy"`
    94  	IgTcpRsp     *ebpf.ProgramSpec `ebpf:"ig_tcp_rsp"`
    95  	IgTcpcV4CoE  *ebpf.ProgramSpec `ebpf:"ig_tcpc_v4_co_e"`
    96  	IgTcpcV4CoX  *ebpf.ProgramSpec `ebpf:"ig_tcpc_v4_co_x"`
    97  	IgTcpcV6CoE  *ebpf.ProgramSpec `ebpf:"ig_tcpc_v6_co_e"`
    98  	IgTcpcV6CoX  *ebpf.ProgramSpec `ebpf:"ig_tcpc_v6_co_x"`
    99  }
   100  
   101  // tcpconnectMapSpecs contains maps before they are loaded into the kernel.
   102  //
   103  // It can be passed ebpf.CollectionSpec.Assign.
   104  type tcpconnectMapSpecs struct {
   105  	Events               *ebpf.MapSpec `ebpf:"events"`
   106  	GadgetMntnsFilterMap *ebpf.MapSpec `ebpf:"gadget_mntns_filter_map"`
   107  	Ipv4Count            *ebpf.MapSpec `ebpf:"ipv4_count"`
   108  	Ipv6Count            *ebpf.MapSpec `ebpf:"ipv6_count"`
   109  	SocketsLatency       *ebpf.MapSpec `ebpf:"sockets_latency"`
   110  	SocketsPerProcess    *ebpf.MapSpec `ebpf:"sockets_per_process"`
   111  }
   112  
   113  // tcpconnectObjects contains all objects after they have been loaded into the kernel.
   114  //
   115  // It can be passed to loadTcpconnectObjects or ebpf.CollectionSpec.LoadAndAssign.
   116  type tcpconnectObjects struct {
   117  	tcpconnectPrograms
   118  	tcpconnectMaps
   119  }
   120  
   121  func (o *tcpconnectObjects) Close() error {
   122  	return _TcpconnectClose(
   123  		&o.tcpconnectPrograms,
   124  		&o.tcpconnectMaps,
   125  	)
   126  }
   127  
   128  // tcpconnectMaps contains all maps after they have been loaded into the kernel.
   129  //
   130  // It can be passed to loadTcpconnectObjects or ebpf.CollectionSpec.LoadAndAssign.
   131  type tcpconnectMaps struct {
   132  	Events               *ebpf.Map `ebpf:"events"`
   133  	GadgetMntnsFilterMap *ebpf.Map `ebpf:"gadget_mntns_filter_map"`
   134  	Ipv4Count            *ebpf.Map `ebpf:"ipv4_count"`
   135  	Ipv6Count            *ebpf.Map `ebpf:"ipv6_count"`
   136  	SocketsLatency       *ebpf.Map `ebpf:"sockets_latency"`
   137  	SocketsPerProcess    *ebpf.Map `ebpf:"sockets_per_process"`
   138  }
   139  
   140  func (m *tcpconnectMaps) Close() error {
   141  	return _TcpconnectClose(
   142  		m.Events,
   143  		m.GadgetMntnsFilterMap,
   144  		m.Ipv4Count,
   145  		m.Ipv6Count,
   146  		m.SocketsLatency,
   147  		m.SocketsPerProcess,
   148  	)
   149  }
   150  
   151  // tcpconnectPrograms contains all programs after they have been loaded into the kernel.
   152  //
   153  // It can be passed to loadTcpconnectObjects or ebpf.CollectionSpec.LoadAndAssign.
   154  type tcpconnectPrograms struct {
   155  	IgTcpDestroy *ebpf.Program `ebpf:"ig_tcp_destroy"`
   156  	IgTcpRsp     *ebpf.Program `ebpf:"ig_tcp_rsp"`
   157  	IgTcpcV4CoE  *ebpf.Program `ebpf:"ig_tcpc_v4_co_e"`
   158  	IgTcpcV4CoX  *ebpf.Program `ebpf:"ig_tcpc_v4_co_x"`
   159  	IgTcpcV6CoE  *ebpf.Program `ebpf:"ig_tcpc_v6_co_e"`
   160  	IgTcpcV6CoX  *ebpf.Program `ebpf:"ig_tcpc_v6_co_x"`
   161  }
   162  
   163  func (p *tcpconnectPrograms) Close() error {
   164  	return _TcpconnectClose(
   165  		p.IgTcpDestroy,
   166  		p.IgTcpRsp,
   167  		p.IgTcpcV4CoE,
   168  		p.IgTcpcV4CoX,
   169  		p.IgTcpcV6CoE,
   170  		p.IgTcpcV6CoX,
   171  	)
   172  }
   173  
   174  func _TcpconnectClose(closers ...io.Closer) error {
   175  	for _, closer := range closers {
   176  		if err := closer.Close(); err != nil {
   177  			return err
   178  		}
   179  	}
   180  	return nil
   181  }
   182  
   183  // Do not access this directly.
   184  //
   185  //go:embed tcpconnect_x86_bpfel.o
   186  var _TcpconnectBytes []byte