netdev_tap.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for
6  * more details.
7  */
8 
20 #ifndef NETDEV_TAP_H
21 #define NETDEV_TAP_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include <stdint.h>
28 #include <stdbool.h>
29 #include "net/netdev.h"
30 
31 #include "net/ethernet/hdr.h"
32 
33 #include "net/if.h"
34 
35 /* MARK: - Low-level ethernet driver for native tap interfaces */
43 typedef struct netdev_tap {
45  char tap_name[IFNAMSIZ];
46  int tap_fd;
48  bool promiscuous;
49  bool wired;
51 
55 typedef struct {
56  char **tap_name;
58  bool wired;
61 
70 void netdev_tap_setup(netdev_tap_t *dev, const netdev_tap_params_t *params, int index);
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif /* NETDEV_TAP_H */
Definitions low-level network driver interface.
void netdev_tap_setup(netdev_tap_t *dev, const netdev_tap_params_t *params, int index)
Setup netdev_tap_t structure.
struct netdev_tap netdev_tap_t
tap interface state
#define ETHERNET_ADDR_LEN
Length of an Ethernet address.
Definition: hdr.h:32
Ethernet header definitions.
tap interface initialization parameters
Definition: netdev_tap.h:55
char ** tap_name
Name of the host system's tap interface to bind to.
Definition: netdev_tap.h:56
bool wired
Interface should behave like a wired interface.
Definition: netdev_tap.h:58
tap interface state
Definition: netdev_tap.h:43
bool promiscuous
Flag for promiscuous mode.
Definition: netdev_tap.h:48
int tap_fd
host file descriptor for the TAP
Definition: netdev_tap.h:46
bool wired
Flag for wired mode.
Definition: netdev_tap.h:49
netdev_t netdev
netdev internal member
Definition: netdev_tap.h:44
char tap_name[IFNAMSIZ]
host dev file name
Definition: netdev_tap.h:45
uint8_t addr[ETHERNET_ADDR_LEN]
The MAC address of the TAP.
Definition: netdev_tap.h:47
Structure to hold driver state.
Definition: netdev.h:365