ifnow/include/ifnow_now.h
2024-01-06 13:05:24 -08:00

28 lines
629 B
C

#ifndef __IFNOW_WLAN_H__
#define __IFNOW_WLAN_H__
#include <linux/filter.h>
#include <pthread.h>
#include <stdint.h>
#include "ifnow.h"
#define ERR_SOCKET_FAILED (-1)
#define ERR_IOCTL_FAILED (-2)
#define ERR_BIND_FAILED (-3)
#define ERR_FILTER_FAILED (-4)
typedef int (*ifnow_now_receive_cb)(void *now_cfg, uint8_t *buf, ssize_t len);
typedef struct {
int fd_if_socket;
char *if_name;
struct sock_fprog filter;
pthread_t thread_id;
ifnow_now_receive_cb receive;
} ifnow_now_cfg_t;
int ifnow_now_init(ifnow_now_cfg_t *now_cfg);
int ifnow_now_send(ifnow_now_cfg_t *now_cfg, uint8_t *buf, uint16_t len);
#endif