- Fixed race condition: routing_add_conn called before etcp->normalizer was assigned - Moved routing_add_conn from pn_init to etcp_connection_create after normalizer init - Added routing.h include to etcp.c - Fixed tests: disable routing callback on output_queue to keep packets for test verification All 19 tests now pass.
47 lines
1.1 KiB
C
47 lines
1.1 KiB
C
// routing.h - Centralized routing module for utun
|
|
#ifndef ROUTING_H
|
|
#define ROUTING_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
// Forward declarations
|
|
struct ETCP_CONN;
|
|
struct UTUN_INSTANCE;
|
|
|
|
/**
|
|
* @brief Initialize routing module for instance
|
|
* @param instance UTUN instance
|
|
* @return 0 on success, -1 on error
|
|
*/
|
|
int routing_create(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);
|
|
|
|
#endif // ROUTING_H
|