4.14 Creating a Client Subnet Record

The following example describes how to create a new client subnet record named "Europe" that contains the addresses 20.10.0.0/16 and 2001:db8:abcd:0022::0/64.

The client calls R_DnssrvOperation (section 3.1.4.1) and provides the following parameters:

  • A Unicode string containing the FQDN of the DNS server on which the client subnet record is to be created.

  • NULL as the value of pszZone.

  • Zero as the context.

  • CreateClientSubnetRecord as the operation.

  • DNSSRV_TYPEID_CLIENT_SUBNET_RECORD as the type ID.

Create a DNS_RPC_CLIENT_SUBNET_RECORD (section 2.2.15.2.1) structure with pwszClientSubnetName as "Europe", a Unicode string containing the name of the client subnet record to be created. Set pIPAddr and pIPv6Addr to the addresses 20.10.0.0 and 2001:db8:abcd:0022::0, respectively. Set SubnetLength to 16 and 64, respectively, to specify the subnet length of the IP addresses sent.

Pass this RPC data structure as pData.

The DNS server returns ERROR_SUCCESS if the operation is successful or a Windows error code if the operation fails.