added dynamic interface manipulation for guests
[strongswan.git] / src / dumm / iface.h
1 /*
2 * Copyright (C) 2007 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 #ifndef IFACE_H
17 #define IFACE_H
18
19 #include <library.h>
20 #include <utils/iterator.h>
21
22 #include "mconsole.h"
23
24 #define TAP_DEVICE "/dev/net/tun"
25
26 typedef struct iface_t iface_t;
27
28 /**
29 * @brief Interface in a guest, connected to a tap device on the host.
30 */
31 struct iface_t {
32
33 /**
34 * @brief Get the interface name in the guest (e.g. eth0).
35 *
36 * @return guest interface name
37 */
38 char* (*get_guest)(iface_t *this);
39
40 /**
41 * @brief Get the interface name at the host (e.g. tap0).
42 *
43 * @return host interface (tap device) name
44 */
45 char* (*get_host)(iface_t *this);
46
47 /*
48 bool (*up) (iface_t *this);
49 bool (*down) (iface_t *this);
50 bool (*add_addr) (iface_t *this, host_t *addr);
51 bool (*del_addr) (iface_t *this, host_t *addr);
52 iterator_t* (*create_addr_iterator) (iface_t *this);
53 */
54
55 /**
56 * @brief Destroy an interface
57 */
58 void (*destroy) (iface_t *this);
59 };
60
61 /**
62 * @brief Create a new interface for a guest
63 *
64 * @param guest name of the interface in the guest
65 * @param mconsole mconsole of guest
66 * @return interface descriptor, or NULL if failed
67 */
68 iface_t *iface_create(char *guest, mconsole_t *mconsole);
69
70 #endif /* IFACE_H */