There is a DHCP Server management API DhcpGetClientInfo() with which DHCPUser can get the information about DHCP Clients.
There are three way to figure out the information for the client with the above API.
The first one is by specifing ClientIPAddress in DHCP_SEARCH_INFO structure.
The second way is by specifing the ClientName in DHCP_SERACH_INFO structure.
The third one and the trickest one is by specify the MAC addess. For particular MAC address there can be more the one address assigned to client in differnt subnets so while doing the search the API caller should specify in which subnet one wants to perform the serach. For this he needs to create the client UID.
The client UID is created in this way.
[Subnet address in which he wants to perform the search for the client]*++[MAC]
The following is the sample code for doing this.
Mac = 0x00; /// Subnet address in host order.
Mac = 0x00;
Mac = 0x00;
Mac = 0x6e;
Mac = 0x01; ///-à Hardware address type, this is the default value.
Mac = 0x00; ///–à My MAC bytes start from here (00 14 38 c1 c6 b3 )
Mac = 0x14;
Mac = 0x38;
Mac = 0xc1;
Mac = 0xc6;
dhcpSInfo.SearchType = DhcpClientHardwareAddress;
error = DhcpGetClientInfo(server,&dhcpSInfo,&clientInfo);
printf(” IP %xn”, clientInfo->ClientIpAddress);
The output I got by executing this particular code on was Error, 0
Windows Enterprise Networking