Added support for multiple overlays to the copy-on-write filesystem.
[strongswan.git] / src / dumm / bridge.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 BRIDGE_H
17 #define BRIDGE_H
18
19 #include <library.h>
20 #include <utils/enumerator.h>
21
22 typedef struct bridge_t bridge_t;
23
24 #include "iface.h"
25
26 /**
27 * Interface in a guest, connected to a tap device on the host.
28 */
29 struct bridge_t {
30
31 /**
32 * Get the name of the bridge.
33 *
34 * @return name of the bridge
35 */
36 char* (*get_name)(bridge_t *this);
37
38 /**
39 * Add an interface to a bridge.
40 *
41 * @param iface interface to add
42 * @return TRUE if interface added
43 */
44 bool (*connect_iface)(bridge_t *this, iface_t *iface);
45
46 /**
47 * Remove an interface from a bridge.
48 *
49 * @param iface interface to remove
50 * @return TRUE if interface removed
51 */
52 bool (*disconnect_iface)(bridge_t *this, iface_t *iface);
53
54 /**
55 * Create an enumerator over all interfaces.
56 *
57 * @return enumerator over iface_t's
58 */
59 enumerator_t* (*create_iface_enumerator)(bridge_t *this);
60
61 /**
62 * Destroy a bridge
63 */
64 void (*destroy) (bridge_t *this);
65 };
66
67 /**
68 * Create a new bridge.
69 *
70 * @param name name of the bridge to create
71 * @return bridge, NULL if failed
72 */
73 bridge_t *bridge_create(char *name);
74
75 #endif /* BRIDGE_H */
76