1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/native/include/tap.h

58 lines
1.3 KiB
C
Raw Normal View History

2013-08-29 14:41:55 +02:00
/**
* internal nativenet tap network layer interface
*
* Copyright (C) 2013 Ludwig Ortmann
*
* This file subject to the terms and conditions of the GNU Lesser General
* Public License. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @{
* @author Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
* @}
*/
#ifndef _TAP_H
#define _TAP_H
#include <net/ethernet.h>
2013-08-08 11:08:33 +02:00
#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
2013-08-29 14:41:55 +02:00
*
* On OSX a name has to be provided.
*/
int tap_init(char *name);
2013-08-08 11:08:33 +02:00
int send_buf(radio_packet_t *packet);
extern int _native_tap_fd;
extern unsigned char _native_tap_mac[ETHER_ADDR_LEN];
2013-08-21 19:22:32 +02:00
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;
2013-08-21 19:22:32 +02:00
struct nativenet_packet payload;
} field;
unsigned char buffer[ETHER_MAX_LEN];
2013-08-21 19:22:32 +02:00
} __attribute__((packed));
#endif /* _TAP_H */