github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/gadgets/trace/tcp/tracer/tcptracer_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 tcptracerEvent struct { 16 Saddr [16]uint8 17 Daddr [16]uint8 18 Task [16]uint8 19 MntnsId uint64 20 Timestamp uint64 21 TsUs uint64 22 Pid uint32 23 Uid uint32 24 Gid uint32 25 Netns uint32 26 Af uint16 27 Dport uint16 28 Sport uint16 29 Type tcptracerEventType 30 _ [1]byte 31 } 32 33 type tcptracerEventType uint8 34 35 const ( 36 tcptracerEventTypeTCP_EVENT_TYPE_CONNECT tcptracerEventType = 0 37 tcptracerEventTypeTCP_EVENT_TYPE_ACCEPT tcptracerEventType = 1 38 tcptracerEventTypeTCP_EVENT_TYPE_CLOSE tcptracerEventType = 2 39 ) 40 41 // loadTcptracer returns the embedded CollectionSpec for tcptracer. 42 func loadTcptracer() (*ebpf.CollectionSpec, error) { 43 reader := bytes.NewReader(_TcptracerBytes) 44 spec, err := ebpf.LoadCollectionSpecFromReader(reader) 45 if err != nil { 46 return nil, fmt.Errorf("can't load tcptracer: %w", err) 47 } 48 49 return spec, err 50 } 51 52 // loadTcptracerObjects loads tcptracer and converts it into a struct. 53 // 54 // The following types are suitable as obj argument: 55 // 56 // *tcptracerObjects 57 // *tcptracerPrograms 58 // *tcptracerMaps 59 // 60 // See ebpf.CollectionSpec.LoadAndAssign documentation for details. 61 func loadTcptracerObjects(obj interface{}, opts *ebpf.CollectionOptions) error { 62 spec, err := loadTcptracer() 63 if err != nil { 64 return err 65 } 66 67 return spec.LoadAndAssign(obj, opts) 68 } 69 70 // tcptracerSpecs contains maps and programs before they are loaded into the kernel. 71 // 72 // It can be passed ebpf.CollectionSpec.Assign. 73 type tcptracerSpecs struct { 74 tcptracerProgramSpecs 75 tcptracerMapSpecs 76 } 77 78 // tcptracerSpecs contains programs before they are loaded into the kernel. 79 // 80 // It can be passed ebpf.CollectionSpec.Assign. 81 type tcptracerProgramSpecs struct { 82 IgTcpAccept *ebpf.ProgramSpec `ebpf:"ig_tcp_accept"` 83 IgTcpClose *ebpf.ProgramSpec `ebpf:"ig_tcp_close"` 84 IgTcpState *ebpf.ProgramSpec `ebpf:"ig_tcp_state"` 85 IgTcpV4CoE *ebpf.ProgramSpec `ebpf:"ig_tcp_v4_co_e"` 86 IgTcpV4CoX *ebpf.ProgramSpec `ebpf:"ig_tcp_v4_co_x"` 87 IgTcpV6CoE *ebpf.ProgramSpec `ebpf:"ig_tcp_v6_co_e"` 88 IgTcpV6CoX *ebpf.ProgramSpec `ebpf:"ig_tcp_v6_co_x"` 89 } 90 91 // tcptracerMapSpecs contains maps before they are loaded into the kernel. 92 // 93 // It can be passed ebpf.CollectionSpec.Assign. 94 type tcptracerMapSpecs struct { 95 Events *ebpf.MapSpec `ebpf:"events"` 96 GadgetMntnsFilterMap *ebpf.MapSpec `ebpf:"gadget_mntns_filter_map"` 97 Sockets *ebpf.MapSpec `ebpf:"sockets"` 98 Tuplepid *ebpf.MapSpec `ebpf:"tuplepid"` 99 } 100 101 // tcptracerObjects contains all objects after they have been loaded into the kernel. 102 // 103 // It can be passed to loadTcptracerObjects or ebpf.CollectionSpec.LoadAndAssign. 104 type tcptracerObjects struct { 105 tcptracerPrograms 106 tcptracerMaps 107 } 108 109 func (o *tcptracerObjects) Close() error { 110 return _TcptracerClose( 111 &o.tcptracerPrograms, 112 &o.tcptracerMaps, 113 ) 114 } 115 116 // tcptracerMaps contains all maps after they have been loaded into the kernel. 117 // 118 // It can be passed to loadTcptracerObjects or ebpf.CollectionSpec.LoadAndAssign. 119 type tcptracerMaps struct { 120 Events *ebpf.Map `ebpf:"events"` 121 GadgetMntnsFilterMap *ebpf.Map `ebpf:"gadget_mntns_filter_map"` 122 Sockets *ebpf.Map `ebpf:"sockets"` 123 Tuplepid *ebpf.Map `ebpf:"tuplepid"` 124 } 125 126 func (m *tcptracerMaps) Close() error { 127 return _TcptracerClose( 128 m.Events, 129 m.GadgetMntnsFilterMap, 130 m.Sockets, 131 m.Tuplepid, 132 ) 133 } 134 135 // tcptracerPrograms contains all programs after they have been loaded into the kernel. 136 // 137 // It can be passed to loadTcptracerObjects or ebpf.CollectionSpec.LoadAndAssign. 138 type tcptracerPrograms struct { 139 IgTcpAccept *ebpf.Program `ebpf:"ig_tcp_accept"` 140 IgTcpClose *ebpf.Program `ebpf:"ig_tcp_close"` 141 IgTcpState *ebpf.Program `ebpf:"ig_tcp_state"` 142 IgTcpV4CoE *ebpf.Program `ebpf:"ig_tcp_v4_co_e"` 143 IgTcpV4CoX *ebpf.Program `ebpf:"ig_tcp_v4_co_x"` 144 IgTcpV6CoE *ebpf.Program `ebpf:"ig_tcp_v6_co_e"` 145 IgTcpV6CoX *ebpf.Program `ebpf:"ig_tcp_v6_co_x"` 146 } 147 148 func (p *tcptracerPrograms) Close() error { 149 return _TcptracerClose( 150 p.IgTcpAccept, 151 p.IgTcpClose, 152 p.IgTcpState, 153 p.IgTcpV4CoE, 154 p.IgTcpV4CoX, 155 p.IgTcpV6CoE, 156 p.IgTcpV6CoX, 157 ) 158 } 159 160 func _TcptracerClose(closers ...io.Closer) error { 161 for _, closer := range closers { 162 if err := closer.Close(); err != nil { 163 return err 164 } 165 } 166 return nil 167 } 168 169 // Do not access this directly. 170 // 171 //go:embed tcptracer_arm64_bpfel.o 172 var _TcptracerBytes []byte