diff options
author | John Denker <jsd@av8n.com> | 2012-07-29 15:45:38 -0700 |
---|---|---|
committer | John Denker <jsd@av8n.com> | 2012-07-29 15:45:38 -0700 |
commit | 0d2205555e68f414eec0afa8a6531626f77c4a57 (patch) | |
tree | f0e7d3e161f82180e834a6368d41b79272ab013a /ucspi-tcp-0.88/dns_nd6.c | |
parent | 0c7195dea3482bd4c9ac9fbff318c24c502574c6 (diff) | |
parent | 01ef1d365e5776b130e8b65772a80b6adcb0ed46 (diff) |
Merge branch 'master' of ephedra:usr/src/qmail into e_master
Diffstat (limited to 'ucspi-tcp-0.88/dns_nd6.c')
-rw-r--r-- | ucspi-tcp-0.88/dns_nd6.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ucspi-tcp-0.88/dns_nd6.c b/ucspi-tcp-0.88/dns_nd6.c new file mode 100644 index 0000000..fb1da88 --- /dev/null +++ b/ucspi-tcp-0.88/dns_nd6.c @@ -0,0 +1,28 @@ +#include "byte.h" +#include "fmt.h" +#include "dns.h" + +/* RFC1886: + * 4321:0:1:2:3:4:567:89ab + * -> + * b.a.9.8.7.6.5.0.4.0.0.0.3.0.0.0.2.0.0.0.1.0.0.0.0.0.0.0.1.2.3.4.IP6.INT. + */ + +static inline char tohex(char c) { + return c>=10?c-10+'a':c+'0'; +} + +int dns_name6_domain(char name[DNS_NAME6_DOMAIN],char ip[16]) +{ + unsigned int j; + + for (j=0; j<16; j++) { + name[j*4]=1; + name[j*4+1]=tohex(ip[15-j] & 15); + name[j*4+2]=1; + name[j*4+3]=tohex((unsigned char)ip[15-j] >> 4); + } + byte_copy(name + 4*16,10,"\3ip6\4arpa\0"); + return 4*16+10; +} + |