Windows Dev Center

IP_ADDR_STRING structure

The IP_ADDR_STRING structure represents a node in a linked-list of IPv4 addresses.

Syntax


typedef struct _IP_ADDR_STRING {
  struct _IP_ADDR_STRING  *Next;
  IP_ADDRESS_STRING      IpAddress;
  IP_MASK_STRING         IpMask;
  DWORD                  Context;
} IP_ADDR_STRING, *PIP_ADDR_STRING;

Members

Next

A pointer to the next IP_ADDR_STRING structure in the list.

IpAddress

A value that specifies a structure type with a single member, String. The String member is a char array of size 16. This array holds an IPv4 address in dotted decimal notation.

IpMask

A value that specifies a structure type with a single member, String. The String member is a char array of size 16. This array holds the IPv4 subnet mask in dotted decimal notation.

Context

A network table entry (NTE). This value corresponds to the NTEContext parameters in the AddIPAddress and DeleteIPAddress functions.

Examples

The following example retrieves the network parameters for the local computer and prints information from the returned data.


//
// Link with IPHlpAPI.lib
//
#include <winsock2.h>
#include <iphlpapi.h>
#include <stdio.h>
#pragma comment(lib, "IPHLPAPI.lib")

int __cdecl main() 
{
   
   FIXED_INFO * FixedInfo;
   ULONG    ulOutBufLen;
   DWORD    dwRetVal;
   IP_ADDR_STRING * pIPAddr;

   FixedInfo = (FIXED_INFO *) GlobalAlloc( GPTR, sizeof( FIXED_INFO ) );
   ulOutBufLen = sizeof( FIXED_INFO );
   
   if( ERROR_BUFFER_OVERFLOW == GetNetworkParams( FixedInfo, &ulOutBufLen ) ) {
      GlobalFree( FixedInfo );
      FixedInfo = (FIXED_INFO *) GlobalAlloc( GPTR, ulOutBufLen );
   }

   if ( dwRetVal = GetNetworkParams( FixedInfo, &ulOutBufLen ) ) {
        printf( "Call to GetNetworkParams failed. Return Value: %08x\n", dwRetVal );
        exit(1);
   }
   else {
      printf( "Host Name: %s\n", FixedInfo -> HostName );
      printf( "Domain Name: %s\n", FixedInfo -> DomainName );
      
      printf( "DNS Servers:\n" );
      printf( "\t%s\n", FixedInfo -> DnsServerList.IpAddress.String );
      
      pIPAddr = FixedInfo -> DnsServerList.Next;
      while ( pIPAddr ) {
         printf( "\t%s\n", pIPAddr ->IpAddress.String );
         pIPAddr = pIPAddr -> Next;
      }
   }
   exit( 0 );
}


Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Iptypes.h (include Iphlpapi.h)

See also

IP Helper Start Page
IP Helper Structures
AddIPAddress
DeleteIPAddress
IP_ADAPTER_INFO
IP_ADDRESS_STRING

 

 

Community Additions

ADD
Show:
© 2015 Microsoft