netdev_tap.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2015 Kaspar Schleiser <kaspar@schleiser.de>
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #include <stdint.h>
25 #include <stdbool.h>
26 #include "net/netdev.h"
27 
28 #include "net/ethernet/hdr.h"
29 
30 #include "net/if.h"
31 
32 /* MARK: - Low-level ethernet driver for native tap interfaces */
40 typedef struct netdev_tap {
42  char tap_name[IFNAMSIZ];
43  int tap_fd;
45  bool promiscuous;
46  bool wired;
48 
52 typedef struct {
53  char **tap_name;
55  bool wired;
58 
67 void netdev_tap_setup(netdev_tap_t *dev, const netdev_tap_params_t *params, int index);
70 #ifdef __cplusplus
71 }
72 #endif
73 
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:31
Ethernet header definitions.
tap interface initialization parameters
Definition: netdev_tap.h:52
char ** tap_name
Name of the host system's tap interface to bind to.
Definition: netdev_tap.h:53
bool wired
Interface should behave like a wired interface.
Definition: netdev_tap.h:55
tap interface state
Definition: netdev_tap.h:40
bool promiscuous
Flag for promiscuous mode.
Definition: netdev_tap.h:45
int tap_fd
host file descriptor for the TAP
Definition: netdev_tap.h:43
bool wired
Flag for wired mode.
Definition: netdev_tap.h:46
netdev_t netdev
netdev internal member
Definition: netdev_tap.h:41
char tap_name[IFNAMSIZ]
host dev file name
Definition: netdev_tap.h:42
uint8_t addr[ETHERNET_ADDR_LEN]
The MAC address of the TAP.
Definition: netdev_tap.h:44
Structure to hold driver state.
Definition: netdev.h:365