support packet_manager_register_node(), remove packet_manager_subscribe()
This commit is contained in:
@@ -2,6 +2,5 @@ install(FILES stellar/utils.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
|
||||
install(FILES stellar/packet.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
|
||||
install(FILES stellar/session.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
|
||||
install(FILES stellar/stellar.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
|
||||
install(FILES stellar/mq.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
|
||||
install(FILES stellar/exdata.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
|
||||
install(FILES stellar/log.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
|
||||
@@ -16,6 +16,7 @@ extern "C"
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/mpls.h>
|
||||
|
||||
#include "stellar/packet_tag.h"
|
||||
#include "stellar/exdata.h"
|
||||
#include "stellar/module.h"
|
||||
|
||||
@@ -167,8 +168,18 @@ enum packet_type
|
||||
PACKET_TYPE_PSEUDO = 1,
|
||||
};
|
||||
|
||||
enum packet_type packet_get_type(const struct packet *pkt);
|
||||
enum packet_stage
|
||||
{
|
||||
PACKET_STAGE_PREROUTING,
|
||||
PACKET_STAGE_INPUT,
|
||||
PACKET_STAGE_FORWARD,
|
||||
PACKET_STAGE_OUTPUT,
|
||||
PACKET_STAGE_POSTROUTING,
|
||||
PACKET_STAGE_MAX,
|
||||
};
|
||||
|
||||
void packet_set_type(struct packet *pkt, enum packet_type type);
|
||||
enum packet_type packet_get_type(const struct packet *pkt);
|
||||
|
||||
void packet_set_action(struct packet *pkt, enum packet_action action);
|
||||
enum packet_action packet_get_action(const struct packet *pkt);
|
||||
@@ -188,33 +199,27 @@ void *packet_get_exdata(const struct packet *pkt, int idx);
|
||||
void packet_tag_set(struct packet *pkt, uint64_t key_bits, uint64_t val_bits);
|
||||
void packet_tag_get(const struct packet *pkt, uint64_t *key_bits, uint64_t *val_bits);
|
||||
|
||||
int packet_get_ip_proto(const struct packet *pkt);
|
||||
enum packet_stage packet_get_stage(const struct packet *pkt);
|
||||
|
||||
/******************************************************************************
|
||||
* packet manager
|
||||
******************************************************************************/
|
||||
|
||||
enum packet_stage
|
||||
{
|
||||
PACKET_STAGE_PREROUTING,
|
||||
PACKET_STAGE_INPUT,
|
||||
PACKET_STAGE_FORWARD,
|
||||
PACKET_STAGE_OUTPUT,
|
||||
PACKET_STAGE_POSTROUTING,
|
||||
PACKET_STAGE_MAX,
|
||||
};
|
||||
|
||||
#define PACKET_MANAGER_MODULE_NAME "packet_manager_module"
|
||||
struct packet_manager;
|
||||
struct packet_manager *module_to_packet_manager(struct module *mod);
|
||||
int packet_manager_new_packet_exdata_index(struct packet_manager *pkt_mgr, const char *name, exdata_free *func, void *arg);
|
||||
|
||||
typedef void on_packet_stage_callback(struct packet *pkt, enum packet_stage stage, void *arg);
|
||||
int packet_manager_subscribe(struct packet_manager *pkt_mgr, enum packet_stage stage, on_packet_stage_callback *cb, void *arg);
|
||||
|
||||
typedef void on_packet_callback(struct packet *pkt, void *arg);
|
||||
int packet_manager_register_node(struct packet_manager *pkt_mgr, const char *name, enum packet_stage stage,
|
||||
uint64_t interested_tag_key_bits,
|
||||
uint64_t interested_tag_val_bits,
|
||||
on_packet_callback *cb, void *arg);
|
||||
// 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 *arg);
|
||||
int packet_manager_claim_packet(struct packet_manager *pkt_mgr, uint16_t thread_id, struct packet *pkt, on_packet_claimed_callback cb, void *arg);
|
||||
int packet_manager_claim_packet(struct packet_manager *pkt_mgr, uint16_t thread_id, struct packet *pkt, on_packet_callback *cb, void *arg);
|
||||
void packet_manager_schedule_packet(struct packet_manager *pkt_mgr, uint16_t thread_id, struct packet *pkt, enum packet_stage stage);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user