ndgui/NetworkDiscovery

NetworkManager Class Reference

Manages the network configurations like setting new default routes. More...

#include <networkmanager.h>

List of all members.

Public Member Functions

 NetworkManager ()
virtual ~NetworkManager ()
int replaceDefaultRoute (QString ifname, QString gateway, int metric, int af)
int bringInterfaceUP (QString ifname)
int bringInterfaceDown (QString ifname)
int ip4_setManualConfiguration (QString ifname, QString ipAddress, QString netmask, QString broadcast, QString gateway, int metric, int af, QString pathToResolvConf, QList< QString > nameServer)
int ip4_configureInterface (QString ifname, QString ipAddress, QString broadcast, QString netmask, int af)
int ip6_addRoute (const char *iface, const struct in6_addr *ip6_dest, int ip6_prefix, const struct in6_addr *ip6_gateway, int metric, int mss)
int ip6_addAddress (struct ip6_addr *ip6Addr, const char *iface)
int writeResolvConf (QString path, QString ifname, QList< QString > nameServer)

Detailed Description

Manages the network configurations like setting new default routes.

Copyright (c) 2010,2011 - RZ Uni Freiburg Copyright (c) 2010,2011 - OpenSLX Project

This program/file is free software distributed under the GPL version 2. See http://openslx.org/COPYING

If you have any feedback please consult http://openslx.org/feedback and send your feedback to feedback@openslx.org

General information about OpenSLX can be found under http://openslx.org

Manages the network configurations like setting new default routes. It provides methods for ipv4 and some method for ipv6.


Constructor & Destructor Documentation

NetworkManager::NetworkManager ( )
NetworkManager::~NetworkManager ( ) [virtual]

Member Function Documentation

int NetworkManager::bringInterfaceDown ( QString  ifname)

The method brings an interface down.

Parameters:
ifnamethe name of the interface
Returns:
0 -> success -1 -> error
int NetworkManager::bringInterfaceUP ( QString  ifname)

The method brings an interface up.

Parameters:
ifnamethe name of the interface
Returns:
0 -> success -1 -> error

Here is the caller graph for this function:

int NetworkManager::ip4_configureInterface ( QString  ifname,
QString  ipAddress,
QString  broadcast,
QString  netmask,
int  af 
)

Here is the caller graph for this function:

int NetworkManager::ip4_setManualConfiguration ( QString  ifname,
QString  ipAddress,
QString  netmask,
QString  broadcast,
QString  gateway,
int  metric,
int  af,
QString  pathToResolvConf,
QList< QString >  nameServer 
)

This method is used when the manual configuration is needed.

This method is used when the manual configuration is needed. First we bring up the interface. Than we configure the interface with our manual entered configuration dates. After that we replace the old default route with the new and write a resolv.conf.

Parameters:
ifnamename of the interface which we are about to configure.
ipAddressthe new IP-Address.
netmaskthe netmask of the IP-Address.
broadcastthe broadcast address.
gatewaythe gateway address.
metricdo not exactly know why we need this. in most cases this should be 0.
afthe address type. Either AF_INET for IPv4 or AF_INET6 for IPv6.
pathToResolvConfthe path to the resolf.conf file. in most cases "/etc/".
nameServerthe name server addresses.

Here is the call graph for this function:

Here is the caller graph for this function:

int NetworkManager::ip6_addAddress ( struct ip6_addr *  ip6Addr,
const char *  iface 
)
int NetworkManager::ip6_addRoute ( const char *  iface,
const struct in6_addr *  ip6_dest,
int  ip6_prefix,
const struct in6_addr *  ip6_gateway,
int  metric,
int  mss 
)
int NetworkManager::replaceDefaultRoute ( QString  ifname,
QString  gateway,
int  mss,
int  af 
)

This method adds /replaces the default route. This method adds /replaces the default route. To keep it modular, it is possible to specify an ip address family.

Parameters:
ifNamethe interface name
gatewaythe gateway address (e.g: 192.168.0.254)
mssthe mss.
afspecify the family type of the ip address. possible values are: AF_INET for an IPv4 address AF_INET6 for an IPv6 address
Returns:
return -1 if an error happened. return 0 if everything was ok.

Here is the caller graph for this function:

int NetworkManager::writeResolvConf ( QString  path,
QString  ifname,
QList< QString >  nameServer 
)

This method writes a resolv.conf file.

Parameters:
pathpath to the resolv.conf file. (in most cases: /etc/)
ifnamename of the interface
addressesof the nameserver
Returns:
return 0 if success else -1

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Defines