github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/socketenricher/socketsiter_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 socketsiterSocketsKey struct { 16 Netns uint32 17 Family uint16 18 Proto uint8 19 _ [1]byte 20 Port uint16 21 _ [2]byte 22 } 23 24 type socketsiterSocketsValue 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 // loadSocketsiter returns the embedded CollectionSpec for socketsiter. 36 func loadSocketsiter() (*ebpf.CollectionSpec, error) { 37 reader := bytes.NewReader(_SocketsiterBytes) 38 spec, err := ebpf.LoadCollectionSpecFromReader(reader) 39 if err != nil { 40 return nil, fmt.Errorf("can't load socketsiter: %w", err) 41 } 42 43 return spec, err 44 } 45 46 // loadSocketsiterObjects loads socketsiter and converts it into a struct. 47 // 48 // The following types are suitable as obj argument: 49 // 50 // *socketsiterObjects 51 // *socketsiterPrograms 52 // *socketsiterMaps 53 // 54 // See ebpf.CollectionSpec.LoadAndAssign documentation for details. 55 func loadSocketsiterObjects(obj interface{}, opts *ebpf.CollectionOptions) error { 56 spec, err := loadSocketsiter() 57 if err != nil { 58 return err 59 } 60 61 return spec.LoadAndAssign(obj, opts) 62 } 63 64 // socketsiterSpecs contains maps and programs before they are loaded into the kernel. 65 // 66 // It can be passed ebpf.CollectionSpec.Assign. 67 type socketsiterSpecs struct { 68 socketsiterProgramSpecs 69 socketsiterMapSpecs 70 } 71 72 // socketsiterSpecs contains programs before they are loaded into the kernel. 73 // 74 // It can be passed ebpf.CollectionSpec.Assign. 75 type socketsiterProgramSpecs struct { 76 IgSkCleanup *ebpf.ProgramSpec `ebpf:"ig_sk_cleanup"` 77 IgSocketsIt *ebpf.ProgramSpec `ebpf:"ig_sockets_it"` 78 } 79 80 // socketsiterMapSpecs contains maps before they are loaded into the kernel. 81 // 82 // It can be passed ebpf.CollectionSpec.Assign. 83 type socketsiterMapSpecs struct { 84 GadgetSockets *ebpf.MapSpec `ebpf:"gadget_sockets"` 85 } 86 87 // socketsiterObjects contains all objects after they have been loaded into the kernel. 88 // 89 // It can be passed to loadSocketsiterObjects or ebpf.CollectionSpec.LoadAndAssign. 90 type socketsiterObjects struct { 91 socketsiterPrograms 92 socketsiterMaps 93 } 94 95 func (o *socketsiterObjects) Close() error { 96 return _SocketsiterClose( 97 &o.socketsiterPrograms, 98 &o.socketsiterMaps, 99 ) 100 } 101 102 // socketsiterMaps contains all maps after they have been loaded into the kernel. 103 // 104 // It can be passed to loadSocketsiterObjects or ebpf.CollectionSpec.LoadAndAssign. 105 type socketsiterMaps struct { 106 GadgetSockets *ebpf.Map `ebpf:"gadget_sockets"` 107 } 108 109 func (m *socketsiterMaps) Close() error { 110 return _SocketsiterClose( 111 m.GadgetSockets, 112 ) 113 } 114 115 // socketsiterPrograms contains all programs after they have been loaded into the kernel. 116 // 117 // It can be passed to loadSocketsiterObjects or ebpf.CollectionSpec.LoadAndAssign. 118 type socketsiterPrograms struct { 119 IgSkCleanup *ebpf.Program `ebpf:"ig_sk_cleanup"` 120 IgSocketsIt *ebpf.Program `ebpf:"ig_sockets_it"` 121 } 122 123 func (p *socketsiterPrograms) Close() error { 124 return _SocketsiterClose( 125 p.IgSkCleanup, 126 p.IgSocketsIt, 127 ) 128 } 129 130 func _SocketsiterClose(closers ...io.Closer) error { 131 for _, closer := range closers { 132 if err := closer.Close(); err != nil { 133 return err 134 } 135 } 136 return nil 137 } 138 139 // Do not access this directly. 140 // 141 //go:embed socketsiter_x86_bpfel.o 142 var _SocketsiterBytes []byte