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.
58 lines
1.4 KiB
58 lines
1.4 KiB
#ifndef UTUN_INSTANCE_H |
|
#define UTUN_INSTANCE_H |
|
|
|
#include <stdint.h> |
|
#include <stdbool.h> |
|
#include <stdio.h> |
|
#include "../lib/memory_pool.h" |
|
#include "secure_channel.h" |
|
#include "tun_if.h" |
|
|
|
// Forward declarations |
|
struct utun_config; |
|
struct uasync_s; |
|
struct routing_table; |
|
struct ETCP_CONN; |
|
struct ETCP_SOCKET; |
|
|
|
// uTun instance configuration |
|
struct UTUN_INSTANCE { |
|
// Configuration (moved from utun_state) |
|
struct utun_config *config; |
|
|
|
// TUN interface |
|
struct tun_config tun; |
|
void *tun_socket_id; // Socket ID from uasync_add_socket |
|
|
|
// Identification |
|
uint64_t node_id; |
|
|
|
struct SC_MYKEYS my_keys; |
|
|
|
// Main async context |
|
struct UASYNC* ua; |
|
|
|
// State |
|
int running; |
|
FILE *log_fp; |
|
|
|
struct memory_pool* pkt_pool; |
|
// Routing |
|
struct routing_table *routing_table; |
|
|
|
// Connections |
|
struct ETCP_CONN* connections;// linked-list |
|
int connections_count; // Number of connections |
|
|
|
// Active sockets |
|
struct ETCP_SOCKET* etcp_sockets;// linked-list |
|
}; |
|
|
|
// Functions |
|
struct UTUN_INSTANCE* utun_instance_create(struct UASYNC* ua, const char* config_file, const char* log_file); |
|
void utun_instance_destroy(struct UTUN_INSTANCE* instance); |
|
int utun_instance_init(struct UTUN_INSTANCE *instance); |
|
void utun_instance_run(struct UTUN_INSTANCE *instance); |
|
void utun_instance_stop(struct UTUN_INSTANCE *instance); |
|
|
|
#endif // UTUN_INSTANCE_H
|
|
|