I need to deconstruct tinydns/djbdns SRV records to build zone files for Bind.
The records are created by our inhouse management system and stored in LDAP.
From LDAP I get:
\000\012\000\144\023\304\003pbx\007example\003com\000:3600
which is a mixture of octal and ascii and decimal. It is not a real string so split() et al will not be of use. (I think)
It breaks down as
\000\012=SRV priority where the first number is a multiple of 256 and the second is the remainder so \000\012 = (0*256) + 10 = 10
\000\144=SRV weight, as before \000\144 = (0*256) + 100 = 100
\023\304=SRV port, \023\304 = (19*256) + 196 = 5060
\003pbx\007example\003com\000 = SRV target, split on dots with the octal denoting how many chars in each part: pbx.example.com.
The final part after ":" is the TTL in decimal. 3600
Any advice on extracting the various fields from the LDAP reply would be greatly appreciated. Just converting the reply to ascii string would be a start.
I'm not a real coder as you can probably guess, so please bear that in mind..
many thanks.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.