mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 23:13:00 +02:00
Add additional attributes for wireless interface
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1300 e54a6e83-5905-42d5-8d5c-058d10e6a962
Origin commit data
------------------
Branch: ni/coolstream
Commit: 5c2dcd4008
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2011-03-16 (Wed, 16 Mar 2011)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -349,13 +349,18 @@ bool addLoopbackDevice(const std::string name, const bool automatic_start)
|
||||
return write_interface("/etc/network/interfaces", name, automatic_start, "inet", "loopback", attribute);
|
||||
}
|
||||
|
||||
bool setStaticAttributes(const std::string name, const bool automatic_start, const std::string address, const std::string netmask, const std::string broadcast, const std::string gateway)
|
||||
bool setStaticAttributes(const std::string name, const bool automatic_start, const std::string address, const std::string netmask, const std::string broadcast, const std::string gateway, bool wireless)
|
||||
{
|
||||
std::map<std::string, std::string> attribute;
|
||||
|
||||
attribute["address"] = address;
|
||||
attribute["netmask"] = netmask;
|
||||
|
||||
if(wireless) {
|
||||
attribute["pre-up"] = "/etc/network/pre-" + name + ".sh";
|
||||
attribute["post-down"] = "/etc/network/post-" + name + ".sh";
|
||||
}
|
||||
|
||||
if (!broadcast.empty())
|
||||
attribute["broadcast"] = broadcast;
|
||||
|
||||
@@ -365,12 +370,17 @@ bool setStaticAttributes(const std::string name, const bool automatic_start, con
|
||||
return write_interface("/etc/network/interfaces", name, automatic_start, "inet", "static", attribute);
|
||||
}
|
||||
|
||||
bool setDhcpAttributes(const std::string name, const bool automatic_start)
|
||||
bool setDhcpAttributes(const std::string name, const bool automatic_start, bool wireless)
|
||||
{
|
||||
std::map<std::string, std::string> attribute;
|
||||
char hostname[100];
|
||||
if(gethostname(hostname, sizeof(hostname)) == 0)
|
||||
attribute["hostname"] = hostname;
|
||||
|
||||
if(wireless) {
|
||||
attribute["pre-up"] = "/etc/network/pre-" + name + ".sh";
|
||||
attribute["post-down"] = "/etc/network/post-" + name + ".sh";
|
||||
}
|
||||
|
||||
return write_interface("/etc/network/interfaces", name, automatic_start, "inet", "dhcp", attribute);
|
||||
}
|
||||
|
@@ -28,8 +28,8 @@ bool getInetAttributes(const std::string name, bool &automatic_start, std::strin
|
||||
|
||||
bool addLoopbackDevice(const std::string name, const bool automatic_start);
|
||||
|
||||
bool setStaticAttributes(const std::string name, const bool automatic_start, const std::string address, const std::string netmask, const std::string broadcast, const std::string gateway);
|
||||
bool setStaticAttributes(const std::string name, const bool automatic_start, const std::string address, const std::string netmask, const std::string broadcast, const std::string gateway, bool wireless = false);
|
||||
|
||||
bool setDhcpAttributes(const std::string name, const bool automatic_start);
|
||||
bool setDhcpAttributes(const std::string name, const bool automatic_start, bool wireless = false);
|
||||
|
||||
#endif /* __network_interfaces_h__ */
|
||||
|
Reference in New Issue
Block a user