Manipulating tinydns-data file format ------------------------------------- File format is: (generic) !hostname:ipaddress:extensions:ttl:timestamp:location where: is a single-character control symbol recognised by tinydns-data is the full DNS entry is the appropriate IP address is optionally the appropriate fields for the data is the Time To Live for the record is the external timestamp value for the record is a feature of tinydns allowing host-filtering (SOA record) == 'Z' points to the primary nameserver comprises: being the email address of the responsible person (admin) being the zone serial number being the refresh time for the zone being the retry time for the zone being the expiry time for the zone being the minimum time for the zone (NS record) == '.' points to the primary nameserver comprises: being the NS ident (usually 'a', 'b', 'c', etc) (NS record) == '&' points to the primary nameserver comprises: being the NS ident (usually 'a', 'b', 'c', etc) [ Note: I know, I know, they're the same. But not according to djb. ] [ His file format uses NS '.' records to combine SOA and NS ] [ '&' records with a little automation, so they need handling ] [ as separate cases. ] (A record) == '=' is the host IP is null (A record) == '+' is the host IP is null [ Note: Alright, djb does quirky things. A '=' records are used to ] [ create matching PTR records, A '+' are intended for aliases ] [ and don't create PTRs. Confused? So'm I. ] (MX record) == '@' is the host IP comprises: being the NS ident (usually 'a', 'b', 'c', etc) being the distance of the server (used for choosing favourites) (no record type) == '-' is the host IP is null [ Note: This is apparently for programs that manipulate the data ] [ file. It's the same structure as an A '+' record, but gets ] [ ignored at maketime by tinydns-data. ] (TXT record) == ''' is actually not. It's a text string associated with the hostname. is null (PTR record) == '^' again isn't. It's another hostname for the PTR to point to. is null (CNAME record) == 'C' is yet another hostname is null (Generic record) == ':' is an integer between 1 and 65535, being the record type comprises: being a data string dependent on in context ======================================================================= Manipulation ideas and caveats ------------------------------ * The format is fickle. However, the three fields after (, and ) are optional and, more importantly, two of them ( and ) are numeric only. This means it should be a SMOP to parse out to check how many of these three fields are extant, and where the stop. So either we have a huge switch() featuring every value of and code for each, or we have a handler for silly lines (blanks, comments) and a wrapper which pulls the and lets an expert function deal with them. The second might break for the bastard lines (TXT, PTR, CNAME and generic records... shit, that's half of them). Perhaps better left as an exercise for the reader. * Where " is null", that means that not only should the super-field have no content, it should also not be delimited. * Watch out for the comments. == '#'. * A split(//) may be ideal for exactly its intended purpose... splitting fields in the line. * Actually, the switch()/wrapper argument may be best handled by both, thusly: switch(){ case : DO_WRAPPER_STUFF; break; case : DO_SPECIFIC_STUFF; break; .. default: BREAK_HORRIBLY; break; } * sql2tinydns is a little excessive, but possibly some useful stuff in sql2tinydns/tinydns2mysql.pl (for extracting the data) and also sql2tinydns/html/includes/functions.inc.php (for saving the data).