Debian Codegraph @

internal/efw/enums.go

raw symbols SCIP
1 //go:build windows
2
3 package efw
4
5 import (
6 "syscall"
7 "unsafe"
8
9 "golang.org/x/sys/windows"
10 )
11
12 /*
13 Converts an attach type enum into a GUID.
14
15 ebpf_result_t ebpf_get_ebpf_attach_type(
16 bpf_attach_type_t bpf_attach_type,
17 _Out_ ebpf_attach_type_t* ebpf_attach_type_t *ebpf_attach_type)
18 */
19 var ebpfGetEbpfAttachTypeProc = newProc("ebpf_get_ebpf_attach_type")
20
21 func EbpfGetEbpfAttachType(attachType uint32) (windows.GUID, error) {
22 addr, err := ebpfGetEbpfAttachTypeProc.Find()
23 if err != nil {
24 return windows.GUID{}, err
25 }
26
27 var attachTypeGUID windows.GUID
28 err = errorResult(syscall.SyscallN(addr,
29 uintptr(attachType),
30 uintptr(unsafe.Pointer(&attachTypeGUID)),
31 ))
32 return attachTypeGUID, err
33 }
34
35 /*
36 Retrieve a program type given a GUID.
37
38 bpf_prog_type_t ebpf_get_bpf_program_type(_In_ const ebpf_program_type_t* program_type)
39 */
40 var ebpfGetBpfProgramTypeProc = newProc("ebpf_get_bpf_program_type")
41
42 func EbpfGetBpfProgramType(programType windows.GUID) (uint32, error) {
43 addr, err := ebpfGetBpfProgramTypeProc.Find()
44 if err != nil {
45 return 0, err
46 }
47
48 return uint32Result(syscall.SyscallN(addr, uintptr(unsafe.Pointer(&programType)))), nil
49 }
50
51 /*
52 Retrieve an attach type given a GUID.
53
54 bpf_attach_type_t ebpf_get_bpf_attach_type(_In_ const ebpf_attach_type_t* ebpf_attach_type)
55 */
56 var ebpfGetBpfAttachTypeProc = newProc("ebpf_get_bpf_attach_type")
57
58 func EbpfGetBpfAttachType(attachType windows.GUID) (uint32, error) {
59 addr, err := ebpfGetBpfAttachTypeProc.Find()
60 if err != nil {
61 return 0, err
62 }
63
64 return uint32Result(syscall.SyscallN(addr, uintptr(unsafe.Pointer(&attachType)))), nil
65 }