Debian Codegraph @

examples/tcprtt_sockops/bpf_bpfel.go

raw symbols SCIP
1 // Code generated by bpf2go; DO NOT EDIT.
2 //go:build (386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 || wasm) && linux
3
4 package main
5
6 import (
7 "bytes"
8 _ "embed"
9 "fmt"
10 "io"
11 "structs"
12
13 "github.com/cilium/ebpf"
14 )
15
16 type bpfRttEvent struct {
17 _ structs.HostLayout
18 Sport uint16
19 Dport uint16
20 Saddr uint32
21 Daddr uint32
22 Srtt uint32
23 }
24
25 type bpfSkInfo struct {
26 _ structs.HostLayout
27 SkKey bpfSkKey
28 SkType uint8
29 _ [3]byte
30 }
31
32 type bpfSkKey struct {
33 _ structs.HostLayout
34 LocalIp4 uint32
35 RemoteIp4 uint32
36 LocalPort uint32
37 RemotePort uint32
38 }
39
40 // Names of all BPF objects in the ELF.
41 //
42 // Used for safe lookups in a Collection or CollectionSpec.
43 const (
44 bpfMapMapEstabSk = "map_estab_sk"
45 bpfMapRttEvents = "rtt_events"
46 bpfProgBpfSockopsCb = "bpf_sockops_cb"
47 )
48
49 // loadBpf returns the embedded CollectionSpec for bpf.
50 func loadBpf() (*ebpf.CollectionSpec, error) {
51 reader := bytes.NewReader(_BpfBytes)
52 spec, err := ebpf.LoadCollectionSpecFromReader(reader)
53 if err != nil {
54 return nil, fmt.Errorf("can't load bpf: %w", err)
55 }
56
57 return spec, err
58 }
59
60 // loadBpfObjects loads bpf and converts it into a struct.
61 //
62 // The following types are suitable as obj argument:
63 //
64 // *bpfObjects
65 // *bpfPrograms
66 // *bpfMaps
67 //
68 // See ebpf.CollectionSpec.LoadAndAssign documentation for details.
69 func loadBpfObjects(obj any, opts *ebpf.CollectionOptions) error {
70 spec, err := loadBpf()
71 if err != nil {
72 return err
73 }
74
75 return spec.LoadAndAssign(obj, opts)
76 }
77
78 // bpfSpecs contains maps and programs before they are loaded into the kernel.
79 //
80 // It can be passed ebpf.CollectionSpec.Assign.
81 type bpfSpecs struct {
82 bpfProgramSpecs
83 bpfMapSpecs
84 bpfVariableSpecs
85 }
86
87 // bpfProgramSpecs contains programs before they are loaded into the kernel.
88 //
89 // It can be passed ebpf.CollectionSpec.Assign.
90 type bpfProgramSpecs struct {
91 BpfSockopsCb *ebpf.ProgramSpec `ebpf:"bpf_sockops_cb"`
92 }
93
94 // bpfMapSpecs contains maps before they are loaded into the kernel.
95 //
96 // It can be passed ebpf.CollectionSpec.Assign.
97 type bpfMapSpecs struct {
98 MapEstabSk *ebpf.MapSpec `ebpf:"map_estab_sk"`
99 RttEvents *ebpf.MapSpec `ebpf:"rtt_events"`
100 }
101
102 // bpfVariableSpecs contains global variables before they are loaded into the kernel.
103 //
104 // It can be passed ebpf.CollectionSpec.Assign.
105 type bpfVariableSpecs struct {
106 }
107
108 // bpfObjects contains all objects after they have been loaded into the kernel.
109 //
110 // It can be passed to loadBpfObjects or ebpf.CollectionSpec.LoadAndAssign.
111 type bpfObjects struct {
112 bpfPrograms
113 bpfMaps
114 bpfVariables
115 }
116
117 func (o *bpfObjects) Close() error {
118 return _BpfClose(
119 &o.bpfPrograms,
120 &o.bpfMaps,
121 )
122 }
123
124 // bpfMaps contains all maps after they have been loaded into the kernel.
125 //
126 // It can be passed to loadBpfObjects or ebpf.CollectionSpec.LoadAndAssign.
127 type bpfMaps struct {
128 MapEstabSk *ebpf.Map `ebpf:"map_estab_sk"`
129 RttEvents *ebpf.Map `ebpf:"rtt_events"`
130 }
131
132 func (m *bpfMaps) Close() error {
133 return _BpfClose(
134 m.MapEstabSk,
135 m.RttEvents,
136 )
137 }
138
139 // bpfVariables contains all global variables after they have been loaded into the kernel.
140 //
141 // It can be passed to loadBpfObjects or ebpf.CollectionSpec.LoadAndAssign.
142 type bpfVariables struct {
143 }
144
145 // bpfPrograms contains all programs after they have been loaded into the kernel.
146 //
147 // It can be passed to loadBpfObjects or ebpf.CollectionSpec.LoadAndAssign.
148 type bpfPrograms struct {
149 BpfSockopsCb *ebpf.Program `ebpf:"bpf_sockops_cb"`
150 }
151
152 func (p *bpfPrograms) Close() error {
153 return _BpfClose(
154 p.BpfSockopsCb,
155 )
156 }
157
158 func _BpfClose(closers ...io.Closer) error {
159 for _, closer := range closers {
160 if err := closer.Close(); err != nil {
161 return err
162 }
163 }
164 return nil
165 }
166
167 // Do not access this directly.
168 //
169 //go:embed bpf_bpfel.o
170 var _BpfBytes []byte