Changeset 25 for trunk/src/prefix_mgmt.c

Show
Ignore:
Timestamp:
02/08/07 22:44:36 (16 years ago)
Author:
andreu
Message:

aggregation feature : prefix selection even if no routed subnet

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/prefix_mgmt.c

    r17 r25  
    2323 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
    2424 */ 
    25 #include <stdio.h> 
    2625 
    2726#include "prefix_mgmt.h" 
     
    3837          ); 
    3938} 
     39 
     40 
     41/* 
     42 * prefGlobalCmp() 
     43 */ 
     44int 
     45prefGlobalCmp(const void *elem1, const void *elem2){ 
     46  struct PrefixV4 *el1 = (struct PrefixV4 *) elem1; 
     47  struct PrefixV4 *el2 = (struct PrefixV4 *) elem2; 
     48  if ( el1->beginning >= el2->beginning && el1->beginning <= el2->end ) { 
     49    return 0; 
     50  } else if (el1->beginning < el2->beginning) { 
     51    return -1; 
     52  } else if (el1->beginning > el2->end) { 
     53    return 1; 
     54  } else { 
     55    syslog(LOG_ERR,"You have won !!! This case doesn't exist !!!!"); 
     56    exit(1); 
     57    return 0; 
     58  } 
     59} 
     60