summaryrefslogtreecommitdiffstats
path: root/tests/Network/EnumInterfaces.cpp
blob: e4c6be2192874fbd31c8f97af31f0cd86be0c959 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

// EnumInterfaces.cpp

// Implements the main app entrypoint for the EnumInterfaces network test
// Lists all network interfaces to the console

#include "Globals.h"
#include "OSSupport/Network.h"
#include "OSSupport/NetworkSingleton.h"





int main(int argc, char * argv[])
{
	// Initialize the cNetwork subsystem:
	LOGD("Initializing cNetwork...");
	cNetworkSingleton::Get().Initialise();

	// Enumerate all the addresses:
	printf("Enumerating all IP addresses...\n");
	auto IPs = cNetwork::EnumLocalIPAddresses();
	for (auto & ip: IPs)
	{
		printf("  %s\n", ip.c_str());
	}
	printf("Done.\n");

	// Terminate the cNetwork subsystem:
	cNetworkSingleton::Get().Terminate();

	return 0;
}