tfDnsUpdateAdd

Jump to: navigation, search

Table of Contents >> Application Reference >> Dynamic DNS Update


#include <trsocket.h>


int tfDnsUpdateAdd (
ttDnsUpdateHandle dnsUpdateHandle,
const char * domainNamePtr,
unsigned long ttl,
unsigned int rrType,
const char * dataPtr,
int dataLength,
int dataType
);


Function Description

Add a resource record with the specified domain name, time to live and record type to the current zone. The data to be stored in that record is determined by dataPtr, dataLength and dataType. Each DNS update request must include at least one call to tfDnsUpdateAdd() or tfDnsUpdateDelete(). If you call tfDnsUpdateAdd() and/or tfDnsUpdateDelete() more than once per request, the DNS server will perform the updates in the order you made them.

The data at dataPtr can be provided in a convenient form (e.g. ASCII string), then encoded, as required by the server, prior to transmission. The incoming data format and the encoding algorithm are determined by the dataType parameter. See the Data Types section below.

Note Note: tfDnsUpdateAdd() simply appends the request into the descriptor without sending anything to the DNS server. When you have finished building your request, call tfDnsUpdateSend() to send the request.


Parameters

  • dnsUpdateHandle
    A DNS update descriptor handle returned by tfDnsUpdateOpen().
  • domainNamePtr
    The domain name to set in the new resource record (NUL terminated ASCII string, e.g. "www.example.com").
  • ttl
    The time to live for the resource record in seconds (limited to 32 bits).
  • rrType
    The DNS resource record type to set (e.g. TM_DNS_RR_TYPE_A, TM_DNS_RR_TYPE_PTR).
  • dataPtr
    The resource record data to set. Specify NULL if there is no data.
  • dataLength
    If dataPtr is not NULL, this is the length of data at dataPtr. If dataPtr is a NUL terminated ASCII string, you can set dataLength to -1 (depending on dataType, see the Data Types section below).
  • dataType
    If dataPtr is not NULL, this specifies the type of data at dataPtr and how to encode the data in the outbound request message (see the Data Types section below).


Data Types

  • TM_DNS_UPDATE_DATA_BINARY
    Data at dataPtr is binary with length dataLength. The data will be sent without modification.
  • TM_DNS_UPDATE_DATA_DOMAIN
    Data at dataPtr is a domain name encoded as an ASCII string (e.g. "www.example.com"). The data will be converted to binary form before being sent (see RFC 1035 section 3.1). If dataLength is -1, the string must be NUL terminated and the length will be derived from the string length.
  • TM_DNS_UPDATE_DATA_IPV4
    Data at dataPtr is an IPv4 address encoded as an ASCII string (e.g. "192.168.1.20"). The data will be converted to a 32-bit binary value before being sent. If dataLength is -1, the string must be NUL terminated and the length will be derived from the string length.
  • TM_DNS_UPDATE_DATA_IPV6
    Data at dataPtr is an IPv6 address encoded as an ASCII string (e.g. "2001:db8::6f"). The data will be converted to a 128-bit binary value before being sent. If dataLength is -1, the string must be NUL terminated and the length will be derived from the string length.
  • TM_DNS_UPDATE_DATA_TEXT
    Data at dataPtr is plain text encoded as an ASCII string (e.g. "Hello World!"). The data will be encoded as a character-string (prefixed with a single length byte: see RFC 1035 section 3.3). If dataLength is -1, the string must be NUL terminated and the length will be derived from the string length.


Returns

  • TM_ENOERROR
    Success.
  • TM_EINVAL
    Invalid descriptor handle, domain name, time to live value, or resource record type.
  • TM_EPERM
    Cannot change the descriptor while tfDnsUpdateSend() is in progress.
  • TM_ENOBUFS
    Insufficient memory.


Table of Contents >> Application Reference >> Dynamic DNS Update