Emeric Vigier | 2f62582 | 2012-08-06 11:09:52 -0400 | [diff] [blame] | 1 | // Copyright (C) 2002 Christian Prochnow. |
| 2 | // |
| 3 | // This program is free software; you can redistribute it and/or modify |
| 4 | // it under the terms of the GNU General Public License as published by |
| 5 | // the Free Software Foundation; either version 2 of the License, or |
| 6 | // (at your option) any later version. |
| 7 | // |
| 8 | // This program is distributed in the hope that it will be useful, |
| 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | // GNU General Public License for more details. |
| 12 | // |
| 13 | // You should have received a copy of the GNU General Public License |
| 14 | // along with this program; if not, write to the Free Software |
| 15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 16 | |
| 17 | #include <cc++/network.h> |
| 18 | #include <iostream> |
| 19 | |
| 20 | int main(int argc, char* argv[]) |
| 21 | { |
| 22 | std::vector<ost::NetworkDeviceInfo> devs; |
| 23 | |
| 24 | if(!enumNetworkDevices(devs)) { |
| 25 | std::cerr << "Could not get list of network devices!" << std::endl; |
| 26 | return -1; |
| 27 | } |
| 28 | |
| 29 | std::cout << "Available network devices:" << std::endl; |
| 30 | std::vector<ost::NetworkDeviceInfo>::const_iterator i = devs.begin(); |
| 31 | while(i != devs.end()) { |
| 32 | std::cout << (*i).name() << " address: " << (*i).address() |
| 33 | << ", brdcast: " << (*i).broadcast() |
| 34 | << ", netmask: " << (*i).netmask() |
| 35 | << ", mtu: " << (*i).mtu() << std::endl; |
| 36 | ++i; |
| 37 | } |
| 38 | } |