2007-07-30 13:20:35 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Martin Willi
|
|
|
|
* Hochschule fuer Technik Rapperswil
|
|
|
|
*
|
|
|
|
* This program 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 of the License, or (at your
|
|
|
|
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
|
|
*
|
|
|
|
* This program 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BRIDGE_H
|
|
|
|
#define BRIDGE_H
|
|
|
|
|
|
|
|
#include <library.h>
|
2008-04-28 16:43:30 +00:00
|
|
|
#include <utils/enumerator.h>
|
2007-07-30 13:20:35 +00:00
|
|
|
|
|
|
|
typedef struct bridge_t bridge_t;
|
|
|
|
|
2007-08-08 12:35:24 +00:00
|
|
|
#include "iface.h"
|
|
|
|
|
2007-07-30 13:20:35 +00:00
|
|
|
/**
|
2009-05-11 15:24:51 +00:00
|
|
|
* Interface in a guest, connected to a tap device on the host.
|
2007-07-30 13:20:35 +00:00
|
|
|
*/
|
|
|
|
struct bridge_t {
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-07-30 13:20:35 +00:00
|
|
|
/**
|
2009-05-11 15:24:51 +00:00
|
|
|
* Get the name of the bridge.
|
2007-07-30 13:20:35 +00:00
|
|
|
*
|
2008-04-28 16:43:30 +00:00
|
|
|
* @return name of the bridge
|
2007-07-30 13:20:35 +00:00
|
|
|
*/
|
|
|
|
char* (*get_name)(bridge_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-07-30 13:20:35 +00:00
|
|
|
/**
|
2009-05-11 15:24:51 +00:00
|
|
|
* Add an interface to a bridge.
|
2007-07-30 13:20:35 +00:00
|
|
|
*
|
2008-04-28 16:43:30 +00:00
|
|
|
* @param iface interface to add
|
|
|
|
* @return TRUE if interface added
|
2007-07-30 13:20:35 +00:00
|
|
|
*/
|
2007-08-08 12:35:24 +00:00
|
|
|
bool (*connect_iface)(bridge_t *this, iface_t *iface);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-07-30 13:20:35 +00:00
|
|
|
/**
|
2009-05-11 15:24:51 +00:00
|
|
|
* Remove an interface from a bridge.
|
2007-07-30 13:20:35 +00:00
|
|
|
*
|
2008-04-28 16:43:30 +00:00
|
|
|
* @param iface interface to remove
|
|
|
|
* @return TRUE if interface removed
|
2007-07-30 13:20:35 +00:00
|
|
|
*/
|
2007-08-08 12:35:24 +00:00
|
|
|
bool (*disconnect_iface)(bridge_t *this, iface_t *iface);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-07-30 13:20:35 +00:00
|
|
|
/**
|
2009-05-11 15:24:51 +00:00
|
|
|
* Create an enumerator over all interfaces.
|
2007-07-30 13:20:35 +00:00
|
|
|
*
|
2008-04-28 16:43:30 +00:00
|
|
|
* @return enumerator over iface_t's
|
2007-07-30 13:20:35 +00:00
|
|
|
*/
|
2009-09-04 11:46:09 +00:00
|
|
|
enumerator_t* (*create_iface_enumerator)(bridge_t *this);
|
|
|
|
|
2007-07-30 13:20:35 +00:00
|
|
|
/**
|
2009-05-11 15:24:51 +00:00
|
|
|
* Destroy a bridge
|
2007-07-30 13:20:35 +00:00
|
|
|
*/
|
|
|
|
void (*destroy) (bridge_t *this);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2009-05-11 15:24:51 +00:00
|
|
|
* Create a new bridge.
|
2007-07-30 13:20:35 +00:00
|
|
|
*
|
|
|
|
* @param name name of the bridge to create
|
|
|
|
* @return bridge, NULL if failed
|
|
|
|
*/
|
|
|
|
bridge_t *bridge_create(char *name);
|
|
|
|
|
|
|
|
#endif /* BRIDGE_H */
|
|
|
|
|