blob: 03dc7df34fc6a0723da29c037857fdc1cc82fcbf [file] [log] [blame]
jjako52c24142002-12-16 13:33:51 +00001/*
2 * OpenGGSN - Gateway GPRS Support Node
3 * Copyright (C) 2002 Mondru AB.
4 *
5 * The contents of this file may be used under the terms of the GNU
6 * General Public License Version 2, provided that the above copyright
7 * notice and this permission notice is included in all copies or
8 * substantial portions of the software.
9 *
10 * The initial developer of the original code is
11 * Jens Jakobsen <jj@openggsn.org>
12 *
13 * Contributor(s):
14 *
15 */
16
17#ifndef _TUN_H
18#define _TUN_H
19
20#define hton8(x) (x)
21#define ntoh8(x) (x)
22#define hton16(x) htons(x)
23#define ntoh16(x) ntohs(x)
24#define hton32(x) htonl(x)
25#define ntoh32(x) ntohl(x)
26
27#define PACKET_MAX 8196 /* TODO */
28
29/* ***********************************************************
30 * Information storage for each tun instance
31 *************************************************************/
32
33struct tun_t {
34 int fd; /* File descriptor to network interface */
35 struct in_addr addr; /* IP address of tun interface */
36 char devname[IFNAMSIZ];/* Name of the tun device */
37};
38
39
40extern int tun_newtun(struct tun_t **tun);
41extern int tun_freetun(struct tun_t *tun);
42extern int tun_decaps(struct tun_t *tun,
43 int (*cb) (void *cl, struct tun_t*, void *pack, unsigned len),
44 void *cl);
45extern int tun_encaps(struct tun_t *tun, void *pack, unsigned len);
46
47
48#endif /* !_TUN_H */