blob: 938465bbba3b6706a4d59bcb5eb6b6c24cb53b5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/*
Copyright (C) 2017 Free Software Foundation, Inc.
Written by Joan Lledó.
This file is part of the GNU Hurd.
The GNU Hurd is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
The GNU Hurd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>.
*/
/* Tunnel devices module */
#ifndef LWIP_HURDTUNIF_H
#define LWIP_HURDTUNIF_H
#include <hurd/ports.h>
#include <lwip/netif.h>
#include <netif/ifcommon.h>
/* Queue of data in the tunnel */
struct pbufqueue
{
struct pbuf *head;
struct pbuf **tail;
uint8_t len;
};
/* Extension of the common device interface to store tunnel metadata */
struct hurdtunif
{
struct ifcommon comm;
struct trivfs_control *cntl; /* Identify the tunnel device in use */
file_t underlying; /* Underlying node where the tunnel is bound */
struct iouser *user; /* Restrict the access to one user at a time */
struct pbufqueue queue; /* Output queue */
/* Concurrent access to the queue */
pthread_mutex_t lock;
pthread_cond_t read;
pthread_cond_t select;
uint8_t read_blocked;
};
struct port_class *tunnel_cntlclass;
struct port_class *tunnel_class;
/* Device initialization */
error_t hurdtunif_device_init (struct netif *netif);
/* Module initialization */
error_t hurdtunif_module_init ();
#endif /* LWIP_HURDTUNIF_H */
|