NetBurner 3.5.6
PDF Version
Show Network Interfaces

Show Network Interfaces Example

Overview

This application demonstrates comprehensive network interface information display on NetBurner embedded devices. The application provides both IPv4 and IPv6 network configuration details through dual interfaces: serial console output for development and debugging, and a web-based interface for remote monitoring and testing. This serves as both a practical network diagnostic tool and a reference implementation for network interface management in embedded systems.

Application Architecture

Core Component Structure

Application Architecture:
+------------------+ +------------------+ +------------------+
| Main Program | | Network Utils | | Web Interface |
| (main.cpp) | | (ip_util.cpp/.h) | | (html folder) |
| | | | | |
| - Network Init | | - Serial Output | | - index.html |
| - HTTP Server |<-->| - Web Output |<-->| - Interactive |
| - User Loop | | - Link Status | | - Links |
+------------------+ +------------------+ +------------------+
| | |
v v v
+------------------------------------------------------------------+
| NetBurner Network Interface System |
| IPv4/IPv6 Address Management and Link Control |
+------------------------------------------------------------------+

Information Flow Diagram

Network Information Flow:
+----------+ +---------------+ +------------------+ +----------+
| Network | | Interface | | Information | | Output |
| Stack |---->| Detection |---->| Collection |---->| Display |
| (IPv4/6) | | System | | Functions | | Systems |
+----------+ +---------------+ +------------------+ +----------+
| | |
| v |
| +------------------+ |
| | Address Sources | |
| | - DHCP | |
| | - Static | |
| | - Link Local | |
| | - Router Advert | |
| +------------------+ |
| | |
v v v
+---------------+ +------------------+ +----------+
| Link Status | | Lease Management | | Serial + |
| Monitoring | | Timing Info | | Web Out |
+---------------+ +------------------+ +----------+
DHCP Namespace.
Definition dhcpd.h:39

Key Features

Comprehensive Network Display

  • Dual-protocol support - Complete IPv4 and IPv6 address information
  • Multiple interfaces - Support for multiple network interfaces (Ethernet, WiFi)
  • Source identification - Shows how each address was assigned
  • Link status monitoring - Physical layer connection details

Interactive Web Interface

  • Clickable IP addresses - Test connectivity by clicking any displayed address
  • Real-time information - Current network status and configuration
  • Formatted display - Clean HTML tables with organized information
  • Multiple protocol links - Both IPv4 and IPv6 connectivity testing

Development and Debugging

  • Serial console output - Detailed information for development
  • DHCP lease tracking - Timing information for address renewals
  • Link status reporting - Physical connection monitoring
  • Optional features - WiFi and static IPv6 configuration support

Implementation Details

Main Application (main.cpp)

System Initialization and Main Loop

void UserMain(void *pd) {
init(); // Initialize network stack
EnableSystemDiagnostics(); // Enable debug output
StartHttp(); // Start HTTP server on port 80
WaitForActiveNetwork(TICKS_PER_SECOND * 5); // Wait for network connectivity
printf("Application: %s\nNNDK Revision: %s\n", AppName, GetReleaseTag());
#ifdef USE_WIFI
InitWifi_SPI(); // Initialize WiFi if enabled
#endif
#ifdef STATIC_IP6_TEST
// Add static IPv6 address for testing
IPADDR i6 = IPADDR6::AsciiToIp6("1234:5678:abcd::1234");
pIPv6If->AddStaticAddress(i6, 64);
#endif
// Interactive main loop
while (1) {
printf("\nType any key to display address information\n");
printf("Note that IPv6 routable addresses may take a few seconds to be received\n");
showIpAddressesSerial();
showLinkStatus();
printf("\n\n");
}
}
Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
Definition ipv6_addr.h:41
static IPADDR6 AsciiToIp6(const char *cp, bool bembed_v4addresses=true)
Static function to return an IPADDR6 object created from an ASCII value IPv4 or IPv6 address.
Main IPv6 interface management class.
Definition ipv6_interface.h:889
static IPv6Interface * GetFirst_IP6_Interface()
Get first IPv6 interface in the system.
IPV6_PREFIX * AddStaticAddress(const IPADDR6 &ip, int PrefixLen)
Add static IPv6 address to interface.
#define TICKS_PER_SECOND
System clock ticks per second.
Definition constants.h:49
int getchar()
Get a character from stdin. Will block if no character is available, from stdio library....
const char * GetReleaseTag()
Returns the NNDK release tag information.
int InitWifi_SPI(const char *SSID="", const char *password="", int irqNum=-1, int moduleNum=-1, int csNum=-1, int connectorNum=-1, int gpioPinNum=-1, int resetPinNum=-1)
Initializes the WiFi hardware, initializes the driver using the SPI bus, and attempts to establish th...
void StartHttp(uint16_t port, bool RunConfigMirror)
Start the HTTP web server. Further documentation in the Initialization section Initialization - Syste...
void init()
System initialization. Ideally called at the beginning of all applications, since the easiest Recover...
void EnableSystemDiagnostics()
Turn on the diagnostic reports from the config page.
bool WaitForActiveNetwork(uint32_t ticks_to_wait=120 *TICKS_PER_SECOND, int interface=-1)
Wait for an active network connection on at least one interface.

Configuration Options

// Optional WiFi support
#define USE_WIFI (1)
// Optional static IPv6 testing
#define STATIC_IP6_TEST (1)
// IPv6 support (typically defined globally)
#ifdef IPV6

Network Information Utilities (ip_util.cpp)

Serial Console Display Function

void showIpAddressesSerial() {
int ifNumber = GetFirstInterface();
while (ifNumber) {
InterfaceBlock *ifBlock = GetInterfaceBlock(ifNumber);
printf("\nInterface %d, %s, MAC:", ifNumber, ifBlock->GetInterfaceName());
InterfaceMAC(ifNumber).print();
printf("\n\n");
// Display IPv4 information
printf("IPv4 Addresses:\n");
printf("IP: %hI\n", InterfaceIP(ifNumber));
printf("Mask: %hI\n", InterfaceMASK(ifNumber));
printf("DNS: %hI\n", InterfaceDNS(ifNumber));
printf("DNS2: %hI\n", InterfaceDNS2(ifNumber));
printf("Gateway: %hI\n", InterfaceGate(ifNumber));
printf("Auto IP: %hI\n", InterfaceAutoIP(ifNumber));
#ifdef IPV6
// Display IPv6 information
printf("IPv6 Addresses:\n");
if (pIPv6If) {
IPV6_PREFIX *pPrefix = pIPv6If->FirstPrefix();
while (pPrefix) {
if (pPrefix->bValidForInterface && pPrefix->AgeStillValidTest()) {
ePrefixSource pSrc = pPrefix->Source();
printf("%-10s: ", SourceName(pSrc));
pPrefix->m_IPAddress.print();
printf("/%d\n", pPrefix->PrefixLen);
// Display DHCP lease information if applicable
if (pPrefix->pDHCPD) {
char buf[120];
getLeaseTimeInfo(pPrefix, buf, 120);
printf(" %s\n", buf);
}
}
pPrefix = pPrefix->GetNext();
}
}
#endif
ifNumber = GetNextInterface(ifNumber);
}
}
void print(bool bCompact=true, bool bShowV4Raw=false) const
Print the IP address value to stdout.
static IPv6Interface * GetInterfaceN(int n)
Get IPv6 interface by interface number.
Network interface configuration block class for interface control and configuration.
Definition netinterface.h:245
virtual const char * GetInterfaceName()
Returns the interface name network interface.
void print()
print the MAC to file descriptor 1
Definition nettypes.h:125
int32_t GetFirstInterface(void)
Returns the Interface Number of the first registered network interface.
int32_t GetNextInterface(int lastInterface)
Returns the Interface Number of the next registered network interface.
MACADR InterfaceMAC(int interface)
Returns the MAC address of the specified network interface.
InterfaceBlock * GetInterfaceBlock(int interface=0)
Get an InterfaceBlock control and configuration object.
IPADDR4 InterfaceDNS2(int interface)
Returns the second IPv4 DNS address of the specified network interface.
IPADDR4 InterfaceMASK(int interface)
Returns the IPv4 network mask of the specified network interface.
IPADDR4 InterfaceAutoIP(int interface)
Returns the IPv4 IP AutoIP address of the specified network interface.
IPADDR4 InterfaceDNS(int interface)
Returns the IPv4 DNS address of the specified network interface.
IPADDR4 InterfaceIP(int interface)
Returns the IPv4 IP address of the specified network interface.
IPADDR4 InterfaceGate(int interface)
Returns the IPv4 gateway address of the specified network interface.
ePrefixSource
IPv6 prefix source enumeration.
Definition ipv6_interface.h:479
IPv6 prefix and address management element.
Definition ipv6_interface.h:493
uint8_t PrefixLen
Prefix length in bits.
Definition ipv6_interface.h:501
virtual bool AgeStillValidTest()
Check if prefix is still valid based on aging.
bool bValidForInterface
Valid for this interface.
Definition ipv6_interface.h:502
IPV6_DHCPD * pDHCPD
DHCP server that established this prefix.
Definition ipv6_interface.h:500
IPV6_PREFIX * GetNext()
Get next prefix in list.
Definition ipv6_interface.h:510
ePrefixSource Source()
Get the source of this prefix.
Definition ipv6_interface.h:562
IPADDR6 m_IPAddress
IPv6 address associated with this element.
Definition ipv6_interface.h:217

Web Interface Display Function

void showIpAddressesWeb(int socket, const char *url) {
IPADDR localIP = GetSocketLocalAddr(socket);
uint32_t remotePort = GetSocketRemotePort(socket);
fdprintf(socket, "<br>Web browser request came from:");
localIP.fdprint(socket);
fdprintf(socket, ": %d<br>\n", remotePort);
int ifNumber = GetFirstInterface();
while (ifNumber) {
InterfaceBlock *ifBlock = GetInterfaceBlock(ifNumber);
fdprintf(socket, "<hr>\n");
fdprintf(socket, "<strong>Interface # %d, %s, MAC: ", ifNumber, ifBlock->GetInterfaceName());
MACADR MacAddr = InterfaceMAC(ifNumber);
fdShowMac(socket, &MacAddr);
fdprintf(socket, "</strong><br>");
// Create IPv4 information table
fdprintf(socket, "<br><strong>IPV4 Addresses: </strong><br>");
fdprintf(socket, "<table border=0>\n");
fdprintf(socket, "<tr><td>IP: </td> <td>%hI</td></tr>\n", InterfaceIP(ifNumber));
fdprintf(socket, "<tr><td>Mask: </td> <td>%hI</td></tr>\n", InterfaceMASK(ifNumber));
fdprintf(socket, "<tr><td>DNS1: </td> <td>%hI</td></tr>\n", InterfaceDNS(ifNumber));
fdprintf(socket, "<tr><td>DNS2: </td> <td>%hI</td></tr>\n", InterfaceDNS2(ifNumber));
fdprintf(socket, "<tr><td>Gateway: </td> <td>%hI</td></tr>\n", InterfaceGate(ifNumber));
fdprintf(socket, "<tr><td>AutoIP: </td> <td>%hI</td></tr>\n", InterfaceAutoIP(ifNumber));
fdprintf(socket, "</table>\n");
// Create clickable IPv4 link
if (GetInterfaceLink(ifNumber)) {
fdprintf(socket, "Make an IPv4 request: <a href=\"http://");
InterfaceIP(ifNumber).fdprint(socket);
fdprintf(socket, "\">");
InterfaceIP(ifNumber).fdprint(socket);
fdprintf(socket, "</a><br>\n");
}
#ifdef IPV6
// Create IPv6 information table with clickable links
if (pIPv6If) {
fdprintf(socket, "<br><strong>IPV6 Addresses:</strong><br>\n");
fdprintf(socket, "<table border=0 cellpadding=5>\n");
IPV6_PREFIX *pPrefix = pIPv6If->FirstPrefix();
while (pPrefix) {
if (pPrefix->bValidForInterface) {
ePrefixSource pSrc = pPrefix->Source();
fdprintf(socket, "<tr> <td><a href=\"http://[%I]\">%I</a></td> <td>Assigned by %s",
pPrefix->m_IPAddress, pPrefix->m_IPAddress, SourceName(pSrc));
if (pPrefix->pDHCPD) {
char buf[120];
getLeaseTimeInfo(pPrefix, buf, 120);
fdprintf(socket, ": %s", buf);
}
fdprintf(socket, "</td></tr>\n");
}
pPrefix = pPrefix->GetNext();
}
fdprintf(socket, "</table>\n");
}
#endif
ifNumber = GetNextInterface(ifNumber);
}
}
void fdprint(int fd) const
Print an IPv4 address to the specified file descriptor.
void fdprint(int fd, bool bCompact=true, bool bShowV4Raw=false) const
Print the IP address to the specified file descriptor.
Used to store and manipulate MAC addresses.
Definition nettypes.h:69
void fdShowMac(int fd, const MACADR *ma)
Dump a MAC address to file descriptor.
int fdprintf(int fd, const char *format,...)
Print formatted output to a file descriptor.
bool GetInterfaceLink(int ifn)
Returns the network interface link status.
IPADDR GetSocketLocalAddr(int fd)
Get the local interface IP address for a socket connection.
Definition tcp.h:9470
uint16_t GetSocketRemotePort(int fd)
Get the remote host port number for a socket connection.

Link Status Monitoring

void showLinkStatus() {
int ifNumber = GetFirstInterface();
while (ifNumber) {
InterfaceBlock *ifBlock = GetInterfaceBlock(ifNumber);
if (ifBlock) {
printf("Interface %d, %s:\n", ifNumber, ifBlock->GetInterfaceName());
if (ifBlock->LinkActive()) {
printf("Link Status: UP, %dMB, ", ifBlock->LinkSpeed());
if (ifBlock->LinkDuplex()) {
printf("Full Duplex\n");
} else {
printf("Half Duplex\n");
}
} else {
printf("Link Status: DOWN\n");
}
}
ifNumber = GetNextInterface(ifNumber);
}
}
virtual bool LinkDuplex()=0
Returns the full or half link duplex of the network interface.
virtual bool LinkActive()=0
Returns the link status of the network interface.
virtual int LinkSpeed()=0
Returns the link speed of the network interface.

IPv6 Address Source Management

Address Source Identification

const char *SourceName(ePrefixSource e) {
switch (e) {
case eLinkLocal: return "Link Local";
case eRouter: return "Router";
case eDHCP: return "DHCP";
case eStatic: return "Static";
case eUnknown:
default: return "Unknown";
}
}
@ eRouter
From router advertisement.
Definition ipv6_interface.h:481
@ eDHCP
From DHCPv6.
Definition ipv6_interface.h:482
@ eStatic
Statically configured.
Definition ipv6_interface.h:483
@ eLinkLocal
Link-local address.
Definition ipv6_interface.h:480
@ eUnknown
Unknown source.
Definition ipv6_interface.h:484

DHCP Lease Time Tracking

void getLeaseTimeInfo(IPV6_PREFIX *pPrefix, char *timeStr, uint32_t maxTimeStrLen) {
const uint32_t maxLen = 80;
char strCurrentTime[maxLen];
char strRenewTime[maxLen];
char strRebindTime[maxLen];
uint32_t seconds = TimeTick / TICKS_PER_SECOND;
getTimeStringFromSeconds(seconds, strCurrentTime, maxLen);
seconds = (pPrefix->pDHCPD->m_renewTick) / TICKS_PER_SECOND;
getTimeStringFromSeconds(seconds, strRenewTime, maxLen);
seconds = (pPrefix->pDHCPD->m_rebindTick) / TICKS_PER_SECOND;
getTimeStringFromSeconds(seconds, strRebindTime, maxLen);
sniprintf(timeStr, maxTimeStrLen,
"Time Since Boot: %s, Renew: %s, Rebind: %s",
strCurrentTime, strRenewTime, strRebindTime);
}
uint32_t m_renewTick
Tick when lease should be renewed.
Definition ipv6_interface.h:330
uint32_t m_rebindTick
Tick when lease should be rebound.
Definition ipv6_interface.h:331

Time Formatting Utility

void getTimeStringFromSeconds(uint32_t seconds, char *strTime, uint32_t maxLen) {
uint32_t hour = seconds / 3600;
uint32_t min = (seconds % 3600) / 60;
uint32_t sec = seconds % 60;
snprintf(strTime, maxLen, "%02u:%02u:%02u", hour, min, sec);
}

Web Interface Structure

Main Page Layout (index.html)

<html>
<head>
<title>NetBurner IPv4/IPv6 Show Addresses Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="850" border="0" cellspacing="0" cellpadding="0" height="121">
<tr>
<td width="200"><a href="http://www.netburner.com"><img src="logo.jpg" width="200" border="0"></a></td>
<td width="50"> </td>
<td width="600" align="right">
<b><font face="Arial, Helvetica, sans-serif" size="5" color="#0000FF">
NetBurner IPv4/IPv6 Show Addresses Example</font></b>
</td>
</tr>
</table>
<font face="Arial, Helvetica, sans-serif" size="3">
<table width="850" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>This example program demonstrates how to access the NetBurner web server
using either an IPv4 or IPv6 IP address.</td>
</tr>
</table>
<!--CPPCALL showIpAddressesWeb -->
</font>
</body>
</html>

Dynamic Content Integration

  • CPPCALL tag - <!--CPPCALL showIpAddressesWeb --> dynamically generates network information
  • Interactive links - IP addresses become clickable links for connectivity testing
  • Real-time data - Information reflects current network state when page loads

Network Information Display

IPv4 Address Information

  • IP Address - Current assigned IPv4 address
  • Subnet Mask - Network mask for local subnet
  • DNS Servers - Primary and secondary DNS server addresses
  • Default Gateway - Router address for external connectivity
  • AutoIP Address - Link-local address (169.254.x.x) if DHCP unavailable

IPv6 Address Information

  • Link Local - Automatically generated local addresses (fe80::/64)
  • Router Assigned - Addresses from Router Advertisement messages
  • DHCP Assigned - Addresses from DHCPv6 server
  • Static Assigned - Manually configured addresses
  • DNS Servers - IPv6 DNS server information with source attribution

Physical Interface Details

  • Interface Number - System interface identifier
  • Interface Name - Human-readable interface name (e.g., "Ethernet 0")
  • MAC Address - Hardware address in standard format
  • Link Status - UP/DOWN physical connection state
  • Connection Speed - 10/100/1000 Mbps negotiated speed
  • Duplex Mode - Half/Full duplex communication mode

DHCP Lease Management

  • Current Time - System uptime in HH:MM:SS format
  • Renew Time - When DHCP lease renewal will occur
  • Rebind Time - When DHCP lease rebinding will occur
  • Lease Source - Whether address came from DHCP or Router Advertisement

Usage Instructions

Build and Deployment

  1. Build application:
  2. Deploy to device:
  3. Monitor startup:
    • Connect serial terminal (115200 baud, 8-N-1)
    • Observe network initialization and IP address assignment

Serial Console Interface

Interactive Operation

  1. Wait for prompt: "Type any key to display address information"
  2. Press any key to trigger information display
  3. View output: Complete network interface information
  4. Repeat as needed to monitor network changes

Expected Console Output

Application: Show Interfaces
NNDK Revision: 3.x.x Build xxxx
Type any key to display address information
Note that IPv6 routable addresses may take a few seconds to be received
Interface 1, Ethernet 0, MAC: 00:03:F4:XX:XX:XX
IPv4 Addresses:
IP: 192.168.1.100
Mask: 255.255.255.0
DNS: 192.168.1.1
DNS2: 0.0.0.0
Gateway: 192.168.1.1
Auto IP: 0.0.0.0
IPv6 Addresses:
Link Local: fe80::203:f4ff:fexx:xxxx/64
Router : 2001:db8::203:f4ff:fexx:xxxx/64
Time Since Boot: 00:05:23, Renew: 01:00:00, Rebind: 01:45:00
DNS:
2001:db8::1 - Source: Router
Interface 1, Ethernet 0:
Link Status: UP, 100MB, Full Duplex

Web Interface Operation

Access and Navigation

  1. Open browser to device IP address (e.g., http://192.168.1.100)
  2. View network information in formatted HTML tables
  3. Test connectivity by clicking any displayed IP address
  4. IPv6 testing - Click IPv6 addresses to test IPv6 connectivity

Interactive Features

  • IPv4 Links - Format: http://192.168.1.100
  • IPv6 Links - Format: http://[2001:db8::203:f4ff:fexx:xxxx]
  • Connectivity Testing - Each link opens new page to test reachability
  • Real-time Information - Refresh page to see current network status

Expected Web Display

Web browser request came from: 192.168.1.50: 54321
Device Interfaces:
-------------------------------------------------------------------
Interface # 1, Ethernet 0, MAC: 00:03:F4:XX:XX:XX
IPV4 Addresses:
IP: 192.168.1.100
Mask: 255.255.255.0
DNS1: 192.168.1.1
DNS2: 0.0.0.0
Gateway: 192.168.1.1
AutoIP: 0.0.0.0
Make an IPv4 request: [192.168.1.100] (clickable link)
IPV6 Addresses:
[fe80::203:f4ff:fexx:xxxx] (clickable) Assigned by Link Local
[2001:db8::203:f4ff:fexx:xxxx] (clickable) Assigned by Router: Time Since Boot: 00:05:23, Renew: 01:00:00, Rebind: 01:45:00

Advanced Features

Multiple Interface Support

The application automatically detects and displays all available network interfaces:

int ifNumber = GetFirstInterface();
while (ifNumber) {
// Process each interface
InterfaceBlock *ifBlock = GetInterfaceBlock(ifNumber);
// ... display interface information
ifNumber = GetNextInterface(ifNumber);
}

WiFi Integration

Optional WiFi support can be enabled:

#ifdef USE_WIFI
InitWifi_SPI(); // Initialize WiFi interface
#endif

IPv6 Address Assignment Monitoring

The application tracks IPv6 addresses from multiple sources:

  • Link Local - Automatic based on MAC address
  • Router Advertisement - Assigned by network router
  • DHCPv6 - Assigned by DHCP server
  • Static Configuration - Manually configured addresses

DHCP Lease Tracking

For DHCP-assigned addresses, the system tracks:

  • Current system uptime - Time since device boot
  • Lease renewal time - When address renewal will occur
  • Lease rebind time - When address rebinding will happen

Development and Testing Features

Static IPv6 Testing

#ifdef STATIC_IP6_TEST
IPADDR i6 = IPADDR6::AsciiToIp6("1234:5678:abcd::1234");
pIPv6If->AddStaticAddress(i6, 64);
#endif

Network Timing Considerations

  • IPv6 Address Assignment - May take 5-30 seconds depending on router
  • DHCP Lease Updates - Renewals happen automatically in background
  • Link Status Changes - Detected immediately on physical connection changes

Troubleshooting

Common Issues

No IPv6 Addresses Displayed

Symptoms**: Only IPv4 information shown Solutions**:

  • Wait 30 seconds for router advertisement
  • Check router IPv6 configuration
  • Verify IPv6 enabled in build configuration
  • Test with known IPv6-enabled network

Link Status Shows DOWN

Symptoms**: "Link Status: DOWN" in output Solutions**:

  • Check Ethernet cable connection
  • Verify cable is good (test with PC)
  • Check switch/router port status
  • Test with different network port

DHCP Address Not Assigned

Symptoms**: IP shows 0.0.0.0 or AutoIP address Solutions**:

  • Verify DHCP server is running on network
  • Check DHCP server has available addresses
  • Test with static IP configuration
  • Monitor DHCP server logs for requests

Web Interface Not Accessible

Symptoms**: Browser cannot connect to device Solutions**:

  • Verify IP address from serial console
  • Check network connectivity with ping
  • Confirm HTTP server started successfully
  • Test with different browser or incognito mode

Debug Procedures

Network Connectivity Testing

# Test IPv4 connectivity
ping 192.168.1.100
# Test IPv6 connectivity (if supported)
ping6 2001:db8::203:f4ff:fexx:xxxx
# Test HTTP connectivity
curl -v http://192.168.1.100/
curl -v http://[2001:db8::203:f4ff:fexx:xxxx]/

Serial Console Monitoring

// Add debug output to track network changes
printf("Debug: Interface %d status changed\n", ifNumber);
printf("Debug: Link speed: %d, Duplex: %s\n",
ifBlock->LinkSpeed(),
ifBlock->LinkDuplex() ? "Full" : "Half");

Address Assignment Verification

// Check specific address types
if (InterfaceIP(ifNumber) == IPADDR::NullIP()) {
printf("Warning: No IPv4 address assigned\n");
}
#ifdef IPV6
if (!pIPv6If || !pIPv6If->FirstPrefix()) {
printf("Warning: No IPv6 addresses assigned\n");
}
#endif
static IPADDR6 NullIP()
Static function to return a null IPADDR6 object.

Performance Considerations

Memory Usage

  • Static allocation - Fixed memory for interface tracking
  • Dynamic enumeration - Scales with number of interfaces
  • String formatting - Temporary buffers for display functions
  • Web output - Streaming output to minimize memory usage

Network Efficiency

  • On-demand display - Information gathered only when requested
  • Minimal network overhead - No background polling or monitoring
  • Efficient iteration - Single pass through interface list
  • Cached interface data - Uses system-maintained interface information

Real-time Considerations

  • Non-blocking display - Information gathering doesn't block network stack
  • Quick response - Fast enumeration of current network state
  • Background updates - Network stack handles address changes automatically
  • Event-driven - User-initiated display prevents unnecessary processing

Build Configuration

Makefile Components

NAME = ShowInterfaces
# Source files
CPP_SRC += src/main.cpp src/ip_util.cpp
# HTML compilation
CREATEDTARGS += src/htmldata.cpp
CPP_SRC += src/htmldata.cpp
src/htmldata.cpp : $(wildcard html/*.*)
comphtml html -osrc/htmldata.cpp
include $(NNDK_ROOT)/make/boilerplate.mk

Compile-Time Options

  • IPv6 Support - Enabled via global IPv6 preprocessor definition
  • WiFi Support - Optional, enabled via USE_WIFI definition
  • Static IPv6 Testing - Optional, enabled via STATIC_IP6_TEST definition

Dependencies

  • NetBurner NNDK - Network Development Kit with IPv4/IPv6 support
  • Network Interface Libraries - Built-in interface management
  • IPv6 Libraries - For IPv6 address and prefix management (optional)
  • WiFi Libraries - For wireless interface support (optional)

Learning Objectives

This example teaches:

  • Network interface enumeration - How to discover and iterate through interfaces
  • IPv4/IPv6 address management - Understanding dual-stack networking
  • DHCP lease management - Tracking address assignment and renewal
  • Link status monitoring - Physical layer connection management
  • Web-based network tools - Creating interactive network diagnostic interfaces
  • Cross-platform networking - Handling multiple interface types and protocols

Related Examples

For additional network programming learning, see:

  • Basic networking examples for fundamental TCP/IP concepts
  • DHCP client examples for dynamic address configuration
  • IPv6 examples for advanced IPv6 features and protocols
  • Web server examples for HTTP interface development
  • WiFi examples for wireless network integration