ifnow/include/ifnow_tun.h
2024-01-05 13:12:09 -08:00

26 lines
551 B
C

#ifndef __IFNOW_TUN_H__
#define __IFNOW_TUN_H__
#include <arpa/inet.h>
#include <linux/filter.h>
#include <pthread.h>
#include <stdint.h>
#include "ifnow.h"
typedef int (*ifnow_tun_receive_cb)(void *tun_cfg, uint8_t *buf, uint32_t len);
typedef struct {
int fd_tuntap;
int fd_netlink;
struct in_addr addr;
char *addr_s;
char *if_name;
pthread_t thread_id;
ifnow_tun_receive_cb receive;
} ifnow_tun_cfg_t;
int ifnow_tun_init(ifnow_tun_cfg_t *tun_cfg);
int ifnow_tun_send(ifnow_tun_cfg_t *tun_cfg, uint8_t *buf, uint8_t len);
#endif