You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.6 KiB
68 lines
1.6 KiB
// routing.h - Centralized routing module for utun |
|
#ifndef ROUTING_H |
|
#define ROUTING_H |
|
|
|
#ifdef __cplusplus |
|
extern "C" { |
|
#endif |
|
|
|
|
|
#include <stdint.h> |
|
#include <stddef.h> |
|
|
|
// Forward declarations |
|
struct ETCP_CONN; |
|
struct UTUN_INSTANCE; |
|
struct ll_entry; |
|
|
|
/** |
|
* @brief Initialize routing module for instance (route table only) |
|
* @param instance UTUN instance |
|
* @return 0 on success, -1 on error |
|
*/ |
|
int routing_create(struct UTUN_INSTANCE* instance); |
|
|
|
/** |
|
* @brief Bind DATA handler via etcp_router (must be called after etcp_router_init) |
|
* @param instance UTUN instance |
|
* @return 0 on success, -1 on error |
|
*/ |
|
int routing_bind(struct UTUN_INSTANCE* instance); |
|
|
|
/** |
|
* @brief Destroy routing module for instance |
|
* @param instance UTUN instance |
|
*/ |
|
void routing_destroy(struct UTUN_INSTANCE* instance); |
|
|
|
/** |
|
* @brief Register ETCP connection with routing |
|
* Called from pn_init() to register connection's normalizer output queue |
|
* @param etcp ETCP connection |
|
*/ |
|
void routing_add_conn(struct ETCP_CONN* etcp); |
|
|
|
/** |
|
* @brief Unregister ETCP connection from routing |
|
* Called from pn_deinit() to unregister connection's normalizer output queue |
|
* @param etcp ETCP connection |
|
*/ |
|
void routing_del_conn(struct ETCP_CONN* etcp); |
|
|
|
/** |
|
* @brief Set TUN interface for routing |
|
* Called from utun_instance_init() after tun_init() |
|
* @param instance UTUN instance with configured tun |
|
*/ |
|
void routing_set_tun(struct UTUN_INSTANCE* instance); |
|
|
|
/** |
|
* @brief Route a single packet (exposed for NAT module interception) |
|
*/ |
|
void route_pkt(struct UTUN_INSTANCE* instance, struct ll_entry* entry, uint64_t src_node_id); |
|
|
|
|
|
#ifdef __cplusplus |
|
} |
|
#endif |
|
#endif // ROUTING_H
|
|
|