Skip to content

sentinel-stack/sentinel-vmi/src/bridge.c

Name
structqueued_alert
structpid_policy_state
Name
const char *threat_type_from_level(uint32_t level)
doublethreat_confidence_from_level(uint32_t level)
intopen_bpf_map(void )
intwrite_alert_to_map(struct vmi_alert * alert)
intenv_enabled(const char * key, int default_value)
voidparse_stream_config(void )
voidstream_disconnect(void )
voidschedule_stream_reconnect(uint64_t now_ns)
intstream_connect_if_needed(uint64_t now_ns)
voidjson_escape_string(const char * src, char * dst, size_t dst_size)
intstream_send_alert(const struct vmi_alert * alert)
uint64_tget_timestamp_ns(void )
struct pid_policy_state *get_policy_state(uint32_t pid)
uint32_tapply_threat_policy(uint32_t pid, uint32_t requested_threat, uint64_t now_ns, int * suppress_emit, int * escalated)
intemit_alert(struct queued_alert * queued)
voidenqueue_alert(uint32_t pid, uint32_t threat_level, const char * reason, int immediate)
intbridge_init(void )
voidbridge_teardown(void )
voidbridge_signal_malicious(uint32_t pid, const char * reason)
voidbridge_signal_suspicious(uint32_t pid, const char * reason)
voidbridge_flush_alerts(void )
Name
struct queued_alert[256]alert_queue
intalert_count
intbpf_map_fd
uint64_ttotal_alerts_processed
struct pid_policy_state[1024]policy_table
intstream_enabled
intstream_fd
char[64]stream_host
uint16_tstream_port
char[16]stream_mode
char[256]stream_helper_cmd
FILE *stream_helper_fp
intstream_helper_include_metadata
uint64_tstream_next_reconnect_ns
uint64_tstream_reconnect_backoff_ns
Name
ALERT_QUEUE_SIZE
PID_POLICY_TABLE_SIZE
POLICY_ESCALATION_COUNT
POLICY_ESCALATION_WINDOW_NS
POLICY_DEDUP_WINDOW_NS
STREAM_DEFAULT_HOST
STREAM_DEFAULT_PORT
STREAM_MODE_TCP
STREAM_MODE_HELPER
STREAM_RECONNECT_BASE_NS
STREAM_RECONNECT_MAX_NS
static const char * threat_type_from_level(
uint32_t level
)
static double threat_confidence_from_level(
uint32_t level
)
static int open_bpf_map(
void
)
static int write_alert_to_map(
struct vmi_alert * alert
)
static int env_enabled(
const char * key,
int default_value
)
static void parse_stream_config(
void
)
static void stream_disconnect(
void
)
static void schedule_stream_reconnect(
uint64_t now_ns
)
static int stream_connect_if_needed(
uint64_t now_ns
)
static void json_escape_string(
const char * src,
char * dst,
size_t dst_size
)
static int stream_send_alert(
const struct vmi_alert * alert
)
static uint64_t get_timestamp_ns(
void
)
static struct pid_policy_state * get_policy_state(
uint32_t pid
)
static uint32_t apply_threat_policy(
uint32_t pid,
uint32_t requested_threat,
uint64_t now_ns,
int * suppress_emit,
int * escalated
)
static int emit_alert(
struct queued_alert * queued
)
static void enqueue_alert(
uint32_t pid,
uint32_t threat_level,
const char * reason,
int immediate
)
int bridge_init(
void
)
void bridge_teardown(
void
)
void bridge_signal_malicious(
uint32_t pid,
const char * reason
)
void bridge_signal_suspicious(
uint32_t pid,
const char * reason
)
void bridge_flush_alerts(
void
)
static struct queued_alert[256] alert_queue;
static int alert_count = 0;
static int bpf_map_fd = -1;
static uint64_t total_alerts_processed = 0;
static struct pid_policy_state[1024] policy_table;
static int stream_enabled = 0;
static int stream_fd = -1;
static char[64] stream_host;
static uint16_t stream_port = 8421U;
static char[16] stream_mode;
static char[256] stream_helper_cmd;
static FILE * stream_helper_fp = NULL;
static int stream_helper_include_metadata = 0;
static uint64_t stream_next_reconnect_ns = 0;
static uint64_t stream_reconnect_backoff_ns = (1ULL * 1000000000ULL);
#define ALERT_QUEUE_SIZE 256
#define PID_POLICY_TABLE_SIZE 1024
#define POLICY_ESCALATION_COUNT 3U
#define POLICY_ESCALATION_WINDOW_NS (10ULL * 1000000000ULL)
#define POLICY_DEDUP_WINDOW_NS (1ULL * 1000000000ULL)
#define STREAM_DEFAULT_HOST "127.0.0.1"
#define STREAM_DEFAULT_PORT 8421U
#define STREAM_MODE_TCP "tcp"
#define STREAM_MODE_HELPER "helper"
#define STREAM_RECONNECT_BASE_NS (1ULL * 1000000000ULL)
#define STREAM_RECONNECT_MAX_NS (30ULL * 1000000000ULL)

Updated on 2026-05-26 at 13:25:29 +0000