- patch from Stephane Lapie that adds to the python API, that

exposes struct delegpt, and adds the find_delegation function.


git-svn-id: file:///svn/unbound/trunk@3295 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards
2015-01-05 10:16:36 +00:00
parent 3c0273186e
commit bcec3cc4f1
3 changed files with 171 additions and 0 deletions
+15
View File
@@ -48,6 +48,7 @@
#include "util/data/msgreply.h"
#include "util/storage/slabhash.h"
#include "util/regional.h"
#include "iterator/iter_delegpt.h"
#include "ldns/sbuffer.h"
#undef _POSIX_C_SOURCE
@@ -176,3 +177,17 @@ void reply_addr2str(struct comm_reply* reply, char* dest, int maxlen)
return;
dest[maxlen-1] = 0;
}
/* Convert target->addr to string */
void delegpt_addr_addr2str(struct delegpt_addr* target, char *dest, int maxlen)
{
int af = (int)((struct sockaddr_in*) &(target->addr))->sin_family;
void* sinaddr = &((struct sockaddr_in*) &(target->addr))->sin_addr;
if(af == AF_INET6)
sinaddr = &((struct sockaddr_in6*)&(target->addr))->sin6_addr;
dest[0] = 0;
if (inet_ntop(af, sinaddr, dest, (socklen_t)maxlen) == 0)
return;
dest[maxlen-1] = 0;
}