-
-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add header and CMake configuration for apfree wifidog eBPF traf…
…fic statistics Signed-off-by: Dengfeng Liu <[email protected]>
- Loading branch information
Showing
3 changed files
with
42 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
add_executable(aw-bpfctl aw-bpfctl.c) | ||
target_link_libraries(aw-bpfctl PRIVATE bpf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* aw-bpf.h - Header file for WiFiDog eBPF traffic statistics | ||
* Copyright (C) 2025 Dengfeng Liu <[email protected]> | ||
*/ | ||
|
||
#ifndef AW_BPF_H | ||
#define AW_BPF_H | ||
|
||
#ifdef __KERNEL__ | ||
#include <linux/types.h> | ||
#else | ||
#include <stdint.h> | ||
#endif | ||
|
||
/** | ||
* @struct counters | ||
* @brief Structure to hold network traffic counters | ||
*/ | ||
struct counters { | ||
__u32 cur_s_bytes; /* Current session bytes */ | ||
__u32 prev_s_bytes; /* Previous session bytes */ | ||
__u64 total_bytes; /* Total bytes transferred */ | ||
__u64 total_packets; /* Total packets count */ | ||
__u32 est_slot; /* Estimation time slot */ | ||
__u32 reserved; /* Reserved for future use */ | ||
} __attribute__((packed)); | ||
|
||
/** | ||
* @struct traffic_stats | ||
* @brief Structure to maintain both incoming and outgoing traffic statistics | ||
*/ | ||
struct traffic_stats { | ||
struct counters incoming; /* Incoming traffic counters */ | ||
struct counters outgoing; /* Outgoing traffic counters */ | ||
} __attribute__((packed)); | ||
|
||
/* Function declarations if any would go here */ | ||
|
||
#endif /* AW_BPF_H */ |