27 lines
551 B
C
27 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
|