#ifndef _RAW_SOCKET_H
#define _RAW_SOCKET_H

#ifdef __cpluscplus
extern "C"
{
#endif

#include <stdint.h>
#include <sys/types.h>
#include <linux/if_packet.h>
#include <net/ethernet.h>

struct raw_socket
{
    int sockfd;
    char interface[16];
    struct ether_addr mac_addr;
    struct sockaddr_ll sockaddr;
};

struct raw_socket *raw_socket_create(const char *interface, int fd_so_mask);
void raw_socket_destory(struct raw_socket *raw);
int raw_socket_send(struct raw_socket *raw, const char *data, int data_len);
int raw_socket_recv(struct raw_socket *raw, char *buff, int buff_size);

#ifdef __cpluscplus
}
#endif

#endif
