[Olsr-cvs] olsrd-current/src routing_table.c, 1.27, 1.28 routing_table.h, 1.17, 1.18
Bernd Petrovitsch
(spam-protected)
Thu Aug 2 23:54:56 CEST 2007
Update of /cvsroot/olsrd/olsrd-current/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv884/src
Modified Files:
routing_table.c routing_table.h
Log Message:
* const-ify parameters
* pave the way to add -Wshadow
Index: routing_table.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** routing_table.c 25 Apr 2007 22:08:14 -0000 1.27
--- routing_table.c 2 Aug 2007 21:54:54 -0000 1.28
***************
*** 86,90 ****
olsr_init_routing_table(void)
{
! int index;
/*
*The hna routes hash will almost always
--- 86,90 ----
olsr_init_routing_table(void)
{
! int idx;
/*
*The hna routes hash will almost always
***************
*** 94,103 ****
*routing table
*/
! for(index=0;index<HASHSIZE;index++)
{
! routingtable[index].next = &routingtable[index];
! routingtable[index].prev = &routingtable[index];
! hna_routes[index].next = &hna_routes[index];
! hna_routes[index].prev = &hna_routes[index];
}
return 1;
--- 94,103 ----
*routing table
*/
! for(idx=0;idx<HASHSIZE;idx++)
{
! routingtable[idx].next = &routingtable[idx];
! routingtable[idx].prev = &routingtable[idx];
! hna_routes[idx].next = &hna_routes[idx];
! hna_routes[idx].prev = &hna_routes[idx];
}
return 1;
***************
*** 165,175 ****
olsr_free_routing_table(struct rt_entry *table)
{
! olsr_u8_t index;
! for(index=0;index<HASHSIZE;index++)
{
! struct rt_entry *destination = table[index].next;
! while(destination != &table[index])
{
struct rt_entry *dst_to_delete = destination;
--- 165,175 ----
olsr_free_routing_table(struct rt_entry *table)
{
! int idx;
! for(idx=0;idx<HASHSIZE;idx++)
{
! struct rt_entry *destination = table[idx].next;
! while(destination != &table[idx])
{
struct rt_entry *dst_to_delete = destination;
***************
*** 193,208 ****
struct rt_entry *
olsr_insert_routing_table(union olsr_ip_addr *dst,
! union olsr_ip_addr *router,
struct interface *iface,
int metric,
float etx)
{
! struct rt_entry *new_route_entry, *rt_list;
! olsr_u32_t hash;
!
! hash = olsr_hashing(dst);
! rt_list = &routingtable[hash];
!
! new_route_entry = olsr_malloc(sizeof(struct rt_entry), "Insert routing table");
COPY_IP(&new_route_entry->rt_dst, dst);
--- 193,204 ----
struct rt_entry *
olsr_insert_routing_table(union olsr_ip_addr *dst,
! const union olsr_ip_addr *router,
struct interface *iface,
int metric,
float etx)
{
! const olsr_u32_t hash = olsr_hashing(dst);
! struct rt_entry *rt_list = &routingtable[hash];
! struct rt_entry *new_route_entry = olsr_malloc(sizeof(struct rt_entry), "Insert routing table");
COPY_IP(&new_route_entry->rt_dst, dst);
***************
*** 250,254 ****
olsr_fill_routing_table_with_neighbors(void)
{
! int index;
#ifdef DEBUG
--- 246,250 ----
olsr_fill_routing_table_with_neighbors(void)
{
! int idx;
#ifdef DEBUG
***************
*** 256,264 ****
#endif
! for(index=0;index<HASHSIZE;index++)
{
struct neighbor_entry *neighbor;
! for(neighbor = neighbortable[index].next;
! neighbor != &neighbortable[index];
neighbor=neighbor->next)
{
--- 252,260 ----
#endif
! for(idx=0;idx<HASHSIZE;idx++)
{
struct neighbor_entry *neighbor;
! for(neighbor = neighbortable[idx].next;
! neighbor != &neighbortable[idx];
neighbor=neighbor->next)
{
***************
*** 277,292 ****
for(addrs2 = &addrs;addrs2!=NULL;addrs2 = addrs2->next_alias)
{
! struct link_entry *link = get_best_link_to_neighbor(&addrs2->alias);
#ifdef DEBUG
OLSR_PRINTF(7, "(ROUTE)Adding neighbor %s\n", olsr_ip_to_string(&addrs.alias));
#endif
! if(link)
{
! struct interface *iface = link->if_name ? if_ifwithname(link->if_name) :
! if_ifwithaddr(&link->local_iface_addr);
if(iface)
{
olsr_insert_routing_table(&addrs2->alias,
! &link->neighbor_iface_addr,
iface,
1,
--- 273,288 ----
for(addrs2 = &addrs;addrs2!=NULL;addrs2 = addrs2->next_alias)
{
! const struct link_entry *lnk = get_best_link_to_neighbor(&addrs2->alias);
#ifdef DEBUG
OLSR_PRINTF(7, "(ROUTE)Adding neighbor %s\n", olsr_ip_to_string(&addrs.alias));
#endif
! if(lnk)
{
! struct interface *iface = lnk->if_name ? if_ifwithname(lnk->if_name) :
! if_ifwithaddr(&lnk->local_iface_addr);
if(iface)
{
olsr_insert_routing_table(&addrs2->alias,
! &lnk->neighbor_iface_addr,
iface,
1,
***************
*** 337,350 ****
{
struct destination_n *list_destination_n=NULL;
! int index;
//printf("FILL ROUTING TABLE WITH TWO HOP NEIGHBORS\n");
! for(index=0;index<HASHSIZE;index++)
{
struct neighbor_entry *neighbor;
! for(neighbor = neighbortable[index].next;
! neighbor != &neighbortable[index];
neighbor=neighbor->next)
{
--- 333,346 ----
{
struct destination_n *list_destination_n=NULL;
! int idx;
//printf("FILL ROUTING TABLE WITH TWO HOP NEIGHBORS\n");
! for(idx=0;idx<HASHSIZE;idx++)
{
struct neighbor_entry *neighbor;
! for(neighbor = neighbortable[idx].next;
! neighbor != &neighbortable[idx];
neighbor=neighbor->next)
{
***************
*** 387,403 ****
for(addrsp = &addrs; addrsp; addrsp = addrsp->next_alias)
{
! struct link_entry *link = get_best_link_to_neighbor(&neighbor->neighbor_main_addr);
#ifdef DEBUG
OLSR_PRINTF(7, "(ROUTE)Adding neighbor %s\n", olsr_ip_to_string(&addrsp->alias));
#endif
! if(link)
{
! struct interface *iface = link->if_name ? if_ifwithname(link->if_name) :
! if_ifwithaddr(&link->local_iface_addr);
if(iface)
{
struct rt_entry *new_route_entry =
olsr_insert_routing_table(&addrsp->alias,
! &link->neighbor_iface_addr,
iface,
2,
--- 383,399 ----
for(addrsp = &addrs; addrsp; addrsp = addrsp->next_alias)
{
! const struct link_entry * const lnk = get_best_link_to_neighbor(&neighbor->neighbor_main_addr);
#ifdef DEBUG
OLSR_PRINTF(7, "(ROUTE)Adding neighbor %s\n", olsr_ip_to_string(&addrsp->alias));
#endif
! if(lnk)
{
! struct interface *iface = lnk->if_name ? if_ifwithname(lnk->if_name) :
! if_ifwithaddr(&lnk->local_iface_addr);
if(iface)
{
struct rt_entry *new_route_entry =
olsr_insert_routing_table(&addrsp->alias,
! &lnk->neighbor_iface_addr,
iface,
2,
***************
*** 551,562 ****
olsr_check_for_higher_quality(struct rt_entry *routes, struct hna_net *net, float etx)
{
! int index;
! for(index=0;index<HASHSIZE;index++)
{
struct rt_entry *tmp_routes;
/* All entries */
! for(tmp_routes = routes[index].next;
! tmp_routes != &routes[index];
tmp_routes = tmp_routes->next)
{
--- 547,558 ----
olsr_check_for_higher_quality(struct rt_entry *routes, struct hna_net *net, float etx)
{
! int idx;
! for(idx=0;idx<HASHSIZE;idx++)
{
struct rt_entry *tmp_routes;
/* All entries */
! for(tmp_routes = routes[idx].next;
! tmp_routes != &routes[idx];
tmp_routes = tmp_routes->next)
{
***************
*** 591,602 ****
olsr_check_for_lower_quality(struct rt_entry *routes, struct hna_net *net, float etx)
{
! int index;
! for(index=0;index<HASHSIZE;index++)
{
struct rt_entry *tmp_routes;
/* All entries */
! for(tmp_routes = routes[index].next;
! tmp_routes != &routes[index];
tmp_routes = tmp_routes->next)
{
--- 587,598 ----
olsr_check_for_lower_quality(struct rt_entry *routes, struct hna_net *net, float etx)
{
! int idx;
! for(idx=0;idx<HASHSIZE;idx++)
{
struct rt_entry *tmp_routes;
/* All entries */
! for(tmp_routes = routes[idx].next;
! tmp_routes != &routes[idx];
tmp_routes = tmp_routes->next)
{
***************
*** 628,632 ****
olsr_calculate_hna_routes(void)
{
! int index;
#ifdef DEBUG
--- 624,628 ----
olsr_calculate_hna_routes(void)
{
! int idx;
#ifdef DEBUG
***************
*** 636,645 ****
olsr_move_route_table(hna_routes, old_hna);
! for(index=0;index<HASHSIZE;index++)
{
struct hna_entry *tmp_hna;
/* All entries */
! for(tmp_hna = hna_set[index].next;
! tmp_hna != &hna_set[index];
tmp_hna = tmp_hna->next)
{
--- 632,641 ----
olsr_move_route_table(hna_routes, old_hna);
! for(idx=0;idx<HASHSIZE;idx++)
{
struct hna_entry *tmp_hna;
/* All entries */
! for(tmp_hna = hna_set[idx].next;
! tmp_hna != &hna_set[idx];
tmp_hna = tmp_hna->next)
{
***************
*** 736,748 ****
olsr_print_routing_table(struct rt_entry *table)
{
! int index;
printf("ROUTING TABLE\n");
printf("DESTINATION\tNEXT HOP\tHOPCNT\tINTERFACE\n");
! for(index = 0; index < HASHSIZE; index++)
{
struct rt_entry *destination;
! for(destination = table[index].next;
! destination != &table[index];
destination = destination->next)
{
--- 732,744 ----
olsr_print_routing_table(struct rt_entry *table)
{
! int idx;
printf("ROUTING TABLE\n");
printf("DESTINATION\tNEXT HOP\tHOPCNT\tINTERFACE\n");
! for(idx = 0; idx < HASHSIZE; idx++)
{
struct rt_entry *destination;
! for(destination = table[idx].next;
! destination != &table[idx];
destination = destination->next)
{
Index: routing_table.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** routing_table.h 16 Nov 2005 23:55:54 -0000 1.17
--- routing_table.h 2 Aug 2007 21:54:54 -0000 1.18
***************
*** 108,112 ****
struct rt_entry *
! olsr_insert_routing_table(union olsr_ip_addr *, union olsr_ip_addr *, struct interface *, int, float);
struct rt_entry *
--- 108,112 ----
struct rt_entry *
! olsr_insert_routing_table(union olsr_ip_addr *, const union olsr_ip_addr *, struct interface *, int, float);
struct rt_entry *
More information about the Olsr-cvs
mailing list