Changeset 620

Show
Ignore:
Timestamp:
03/25/06 18:55:54 (7 years ago)
Author:
ahu
Message:

provide helpful u32 ip function

Location:
trunk/pdns/pdns
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/misc.cc

    r597 r620  
    314314  } 
    315315  return false; 
     316} 
     317 
     318string U32ToIP(uint32_t val) 
     319{ 
     320  char tmp[17]; 
     321  snprintf(tmp, sizeof(tmp)-1, "%u.%u.%u.%u",  
     322           (val >> 24)&0xff, 
     323           (val >> 16)&0xff, 
     324           (val >>  8)&0xff, 
     325           (val      )&0xff); 
     326  return tmp; 
    316327} 
    317328 
  • trunk/pdns/pdns/misc.hh

    r602 r620  
    119119const string toLowerCanonic(const string &upper); 
    120120bool IpToU32(const string &str, uint32_t *ip); 
     121string U32ToIP(uint32_t); 
    121122string stringerror(); 
    122123string itoa(int i);