1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00
RIOT/cpu/native/include/tap.h
2013-08-29 16:16:46 +02:00

41 lines
939 B
C

#ifndef _TAP_H
#define _TAP_H
#include <net/ethernet.h>
#include "radio/types.h"
/**
* create and/or open tap device "name"
*
* if "name" is an empty string, the kernel chooses a name
* if "name" is an existing device, that device is used
* otherwise a device named "name" is created
*/
int tap_init(char *name);
int send_buf(radio_packet_t *packet);
extern int _native_tap_fd;
extern unsigned char _native_tap_mac[ETHER_ADDR_LEN];
struct nativenet_header {
uint16_t length;
radio_address_t dst;
radio_address_t src;
} __attribute__((packed));
struct nativenet_packet {
struct nativenet_header nn_header;
unsigned char data[ETHERMTU - sizeof(struct nativenet_header)];
} __attribute__((packed));
union eth_frame {
struct {
struct ether_header header;
struct nativenet_packet payload;
} field;
unsigned char buffer[ETHER_MAX_LEN];
} __attribute__((packed));
#endif /* _TAP_H */