| 1 | //go:build windows |
| 2 | |
| 3 | // Package efw contains support code for eBPF for Windows. |
| 4 | package efw |
| 5 | |
| 6 | import ( |
| 7 | "golang.org/x/sys/windows" |
| 8 | ) |
| 9 | |
| 10 | // module is the global handle for the eBPF for Windows user-space API. |
| 11 | var module = windows.NewLazyDLL("ebpfapi.dll") |
| 12 | |
| 13 | // FD is the equivalent of fd_t. |
| 14 | // |
| 15 | // See https://github.com/microsoft/ebpf-for-windows/blob/54632eb360c560ebef2f173be1a4a4625d540744/include/ebpf_api.h#L24 |
| 16 | type FD int32 |
| 17 | |
| 18 | // Size is the equivalent of size_t. |
| 19 | // |
| 20 | // This is correct on amd64 and arm64 according to tests on godbolt.org. |
| 21 | type Size uint64 |
| 22 | |
| 23 | // Int is the equivalent of int on MSVC (am64, arm64) and MinGW (gcc, clang). |
| 24 | type Int int32 |
| 25 | |
| 26 | // ObjectType is the equivalent of ebpf_object_type_t. |
| 27 | // |
| 28 | // See https://github.com/microsoft/ebpf-for-windows/blob/44f5de09ec0f3f7ad176c00a290c1cb7106cdd5e/include/ebpf_core_structs.h#L41 |
| 29 | type ObjectType uint32 |
| 30 | |
| 31 | const ( |
| 32 | EBPF_OBJECT_UNKNOWN ObjectType = iota |
| 33 | EBPF_OBJECT_MAP |
| 34 | EBPF_OBJECT_LINK |
| 35 | EBPF_OBJECT_PROGRAM |
| 36 | ) |