![]() | virterror | ![]() | API documentation | ![]() | The virtualization API | uuid | ![]() |
---|
#define BR_IFNAME_MAXLEN
#define BR_INET_ADDR_MAXLEN
Structure brControl
struct _brControl The content of this structure is not made public by the API.
int brAddBridge (brControl * ctl,
const char * nameOrFmt,
char * name,
int maxlen)
int brAddInterface (brControl * ctl,
const char * bridge,
const char * iface)
int brAddTap (brControl * ctl,
const char * bridge,
char * ifname,
int maxlen,
int * tapfd)
int brDeleteBridge (brControl * ctl,
const char * name)
int brDeleteInterface (brControl * ctl,
const char * bridge,
const char * iface)
int brGetEnableSTP (brControl * ctl,
const char * bridge,
int * enable)
int brGetForwardDelay (brControl * ctl,
const char * bridge,
int * delay)
int brGetInetAddress (brControl * ctl,
const char * ifname,
char * addr,
int maxlen)
int brGetInetNetmask (brControl * ctl,
const char * ifname,
char * addr,
int maxlen)
int brGetInterfaceUp (brControl * ctl,
const char * ifname,
int * up)
int brInit (brControl ** ctlp)
int brSetEnableSTP (brControl * ctl,
const char * bridge,
int enable)
int brSetForwardDelay (brControl * ctl,
const char * bridge,
int delay)
int brSetInetAddress (brControl * ctl,
const char * ifname,
const char * addr)
int brSetInetNetmask (brControl * ctl,
const char * ifname,
const char * addr)
int brSetInterfaceUp (brControl * ctl,
const char * ifname,
int up)
void brShutdown (brControl * ctl)
#define BR_IFNAME_MAXLEN
maximum size in byte of the name for an interface
#define BR_INET_ADDR_MAXLEN
maximum size in bytes for an inet addess name
Structure brControl
struct _brControl { The content of this structure is not made public by the API. }
int brAddBridge (brControl * ctl,
const char * nameOrFmt,
char * name,
int maxlen)
This function register a new bridge, @nameOrFmt can be either a fixed name or a name template with '%d' for dynamic name allocation. in either case the final name for the bridge will be stored in @name.
ctl: | bridge control pointer |
nameOrFmt: | the bridge name (or name template) |
name: | pointer to @maxlen bytes to store the bridge name |
maxlen: | size of @name array |
Returns: | 0 in case of success or an errno code in case of failure. |
int brAddInterface (brControl * ctl,
const char * bridge,
const char * iface)
Adds an interface to a bridge
ctl: | bridge control pointer |
bridge: | the bridge name |
iface: | the network interface name |
Returns: | 0 in case of success or an errno code in case of failure. |
int brAddTap (brControl * ctl,
const char * bridge,
char * ifname,
int maxlen,
int * tapfd)
This function reates a new tap device on a bridge. @ifname can be either a fixed name or a name template with '%d' for dynamic name allocation. in either case the final name for the bridge will be stored in @ifname and the associated file descriptor in @tapfd.
ctl: | bridge control pointer |
bridge: | the bridge name |
ifname: | the interface name (or name template) |
maxlen: | size of @ifname array |
tapfd: | file descriptor return value for the new tap device |
Returns: | 0 in case of success or an errno code in case of failure. |
int brDeleteBridge (brControl * ctl,
const char * name)
Remove a bridge from the layer.
ctl: | bridge control pointer |
name: | the bridge name |
Returns: | 0 in case of success or an errno code in case of failure. |
int brDeleteInterface (brControl * ctl,
const char * bridge,
const char * iface)
Removes an interface from a bridge
ctl: | bridge control pointer |
bridge: | the bridge name |
iface: | the network interface name |
Returns: | 0 in case of success or an errno code in case of failure. |
int brGetEnableSTP (brControl * ctl,
const char * bridge,
int * enable)
ctl: | |
bridge: | |
enable: | |
Returns: |
int brGetForwardDelay (brControl * ctl,
const char * bridge,
int * delay)
ctl: | |
bridge: | |
delay: | |
Returns: |
int brGetInetAddress (brControl * ctl,
const char * ifname,
char * addr,
int maxlen)
Function to get the IP address of an interface, it should handle IPV4 and IPv6. The returned string for addr would be of the form "ddd.ddd.ddd.ddd" assuming the common IPv4 format.
ctl: | bridge control pointer |
ifname: | the interface name |
addr: | the array for the string representation of the IP adress |
maxlen: | size of @addr in bytes |
Returns: | 0 in case of success or an errno code in case of failure. |
int brGetInetNetmask (brControl * ctl,
const char * ifname,
char * addr,
int maxlen)
Function to get the netmask of an interface, it should handle IPV4 and IPv6. The returned string for addr would be of the form "ddd.ddd.ddd.ddd" assuming the common IPv4 format.
ctl: | bridge control pointer |
ifname: | the interface name |
addr: | the array for the string representation of the netmask |
maxlen: | size of @addr in bytes |
Returns: | 0 in case of success or an errno code in case of failure. |
int brGetInterfaceUp (brControl * ctl,
const char * ifname,
int * up)
Function to query if an interface is activated (1) or not (0)
ctl: | bridge control pointer |
ifname: | the interface name |
up: | where to store the status |
Returns: | 0 in case of success or an errno code in case of failure. |
int brInit (brControl ** ctlp)
Initialize a new bridge layer. In case of success @ctlp will contain a pointer to the new bridge structure.
ctlp: | pointer to bridge control return value |
Returns: | 0 in case of success, an error code otherwise. |
int brSetEnableSTP (brControl * ctl,
const char * bridge,
int enable)
Control whether the bridge participates in the spanning tree protocol, in general don't disable it without good reasons.
ctl: | bridge control pointer |
bridge: | the bridge name |
enable: | 1 to enable, 0 to disable |
Returns: | 0 in case of success or an errno code in case of failure. |
int brSetForwardDelay (brControl * ctl,
const char * bridge,
int delay)
Set the bridge forward delay
ctl: | bridge control pointer |
bridge: | the bridge name |
delay: | delay in seconds |
Returns: | 0 in case of success or an errno code in case of failure. |
int brSetInetAddress (brControl * ctl,
const char * ifname,
const char * addr)
Function to bind the interface to an IP address, it should handle IPV4 and IPv6. The string for addr would be of the form "ddd.ddd.ddd.ddd" assuming the common IPv4 format.
ctl: | bridge control pointer |
ifname: | the interface name |
addr: | the string representation of the IP adress |
Returns: | 0 in case of success or an errno code in case of failure. |
int brSetInetNetmask (brControl * ctl,
const char * ifname,
const char * addr)
Function to set the netmask of an interface, it should handle IPV4 and IPv6 forms. The string for addr would be of the form "ddd.ddd.ddd.ddd" assuming the common IPv4 format.
ctl: | bridge control pointer |
ifname: | the interface name |
addr: | the string representation of the netmask |
Returns: | 0 in case of success or an errno code in case of failure. |
int brSetInterfaceUp (brControl * ctl,
const char * ifname,
int up)
Function to control if an interface is activated (up, 1) or not (down, 0)
ctl: | bridge control pointer |
ifname: | the interface name |
up: | 1 for up, 0 for down |
Returns: | 0 in case of success or an errno code in case of failure. |
void brShutdown (brControl * ctl)
Shutdown the bridge layer and deallocate the associated structures
ctl: | pointer to a bridge control |
Graphics and design by Diana Fong