40 lines
1.3 KiB
C
40 lines
1.3 KiB
C
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include "packet.h"
|
|
|
|
enum packet_stage
|
|
{
|
|
PACKET_STAGE_PREROUTING,
|
|
PACKET_STAGE_INPUT,
|
|
PACKET_STAGE_FORWARD,
|
|
PACKET_STAGE_OUTPUT,
|
|
PACKET_STAGE_POSTROUTING,
|
|
PACKET_STAGE_MAX,
|
|
};
|
|
|
|
struct packet_manager;
|
|
struct packet_manager_schema;
|
|
struct packet_manager_runtime;
|
|
|
|
struct packet_manager_schema *packet_manager_get_schema(struct packet_manager *pkt_mgr);
|
|
struct packet_manager_runtime *packet_manager_get_runtime(struct packet_manager *pkt_mgr, uint16_t thr_idx);
|
|
|
|
typedef void on_packet_stage_callback(enum packet_stage stage, struct packet *pkt, void *args);
|
|
int packet_manager_schema_add_subscriber(struct packet_manager_schema *pkt_mgr_schema, enum packet_stage stage, on_packet_stage_callback cb, void *args);
|
|
|
|
// if two modules claim the same packet at the same stage, the second 'claim' fails.
|
|
// return 0 on success
|
|
// return -1 on failure
|
|
typedef void on_packet_claimed_callback(struct packet *pkt, void *args);
|
|
int packet_manager_runtime_claim_packet(struct packet_manager_runtime *pkt_mgr_rt, struct packet *pkt, on_packet_claimed_callback cb, void *args);
|
|
void packet_manager_runtime_schedule_packet(struct packet_manager_runtime *pkt_mgr_rt, struct packet *pkt, enum packet_stage stage);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|