DNS SERVICE API
This is the documentation of AlternC v2 DNS api. Refer to AlternC v2 specs for more information.
function bool dns_add_primary_zone(string $domain, integer $user, array $soa)
Add the zone for domain $domain as a primary zone for this DNS server. The zone is associated to the user having uid $user. The $soa array may be a SOA struct containing SOA parameters. each unspecified SOA parameter will be replaced by its default value.
function bool dns_del_primary_zone(string $domain)
Remove the zone and all its resource records from the DNS server. Returns TRUE if the zone has been deleted, FALSE if it has not been deleted
function struct $soa dns_get_primary_zone(string $domain)
Returns the main zone for domain $domain which is a primary zone for this DNS server. The returned value is a SOA struct containing SOA parameters. All of them are specified. Returns FALSE if the zone is not installed.
function bool dns_edit_primary_zone(string $domain, array $soa)
Edit the main zone for domain $domain which is a primary zone for this DNS server. The $soa array is be a SOA struct containing SOA parameters. each unspecified SOA parameter will be replaced by its default value. Returns TRUE if the zone has been changed, or FALSE if an error occured.
function array dns_list_user_zone(integer $user)
List the zone of the specified user. Returns an array of fully qualified domain names. If there is no such user, or if it has no zone, returns FALSE.
function array dns_list_zone_resource(string $domain)
List the resource records of the specified zone. Returns an array of zone struct. The SOA will not be sent : use get_primary_zone. If there is no such zone, returns FALSE.
function bool dns_add_zone_resource(string $domain,struct $resource)
Add the specified resource record to the zone $domain. If there is no such zone, or if an error occured, returns FALSE. If the record has been added, returns TRUE.
function integer dns_remove_zone_resource(string $domain,struct $record)
Remove the specified resource record $record from the zone $domain. The resource may be a subdomain only, in that case, all resource records of the subdomain are deleted The resource may be a subdomain and a resource type only, in that case, all resource records of the same type for this subdomain are deleted The resource may be fully qualified, in that case, only one record will be deleted. If there is no such zone or record, returns FALSE. If some records has been deleted, returns the number of deleted records.
function bool dns_add_secondary_zone(string $domain, integer $user, array $masters)
Add the zone for domain $domain as a secondary zone for this DNS server. The zone is associated to the user having uid $user. The $masters array is just a list of IP addresses or FQDN of masters.
function bool dns_edit_secondary_zone(string $domain, array $masters)
Change the list of DNS masters used by the DNS server for the specified secondary DNS domain $domain. The $masters array is just a list of IP addresses or FQDN of masters. returns TRUE if the operation has been processed successfully, FALSE if an error occured.
function bool dns_del_secondary_zone(string $domain)
Remove the secondary zone from the DNS server. Returns TRUE if the zone has been deleted, FALSE if it has not been deleted
struct $soa array(
"hostmaster" => "hostmaster@domain.tld" // email of the hostmaster of the zone "primary" => "primary.domain.tld" // primary name server of this domain "ttl" => 14400 // Time To Live of the zone entries, in seconds. ... );
struct $record array(
"subdomain" => "@", // Subdomain of the resource record, or @ for the empty subdomain. "type" => "MX", // Resource type (A, CNAME, NS, MX, "weight" => "10", // Weight of the record, depending on the type (eg. MX) "value" => "mail.example.com", // Value of the record, may be an IP, a text, a fqdn etc. );
