rlocs: Move debug outputter to common code

This commit is contained in:
Nick Thomas
2013-08-06 14:25:31 +01:00
parent 15a200eb0c
commit 47d65d8c3e
3 changed files with 34 additions and 24 deletions

View File

@@ -409,6 +409,36 @@ ssize_t rloc_encrypt( struct rloc *rloc, unsigned char *data, size_t data_len, u
return RSA_public_encrypt( data_len, data, dest, rloc->key, RSA_PKCS1_OAEP_PADDING );
}
void rlocs_debug_output( struct rlocs *reg )
{
int i;
char addr1[128], addr2[128];
info( "Configuration has parsed as:" );
for( i = 0 ; i < reg->num_entries; i++ ) {
struct rloc *current = &reg->entries[i];
inet_ntop( current->family, &current->addr, &addr1[0], 128 );
info( "RLOC %i: family %i, address %s", i, current->family, &addr1[0] );
}
for ( i = 0 ; i < reg->num_ip4_map_entries ; i++ ) {
struct ip4_eid_map_entry *current = &reg->ip4_mappings[i];
inet_ntop( AF_INET, &current->network, &addr1[0], 128 );
inet_ntop( AF_INET, &current->rloc->addr, &addr2[0], 128 );
info( "IPv4 EID mapping %i: %s/%u => %s", i, addr1, current->mask, addr2 );
}
for ( i = 0 ; i < reg->num_ip6_map_entries ; i++ ) {
struct ip6_eid_map_entry *current = &reg->ip6_mappings[i];
inet_ntop( AF_INET6, &current->network, &addr1[0], 128 );
inet_ntop( AF_INET6, &current->rloc->addr, &addr2[0], 128 );
info( "IPv6 EID mapping %i: %s/%u => %s", i, addr1, current->mask, addr2 );
}
return;
}
void rlocs_free( struct rlocs* registry )
{