- Timestamp:
- 2007-10-18T16:44:25Z (17 years ago)
- Branches:
- master
- Children:
- 7435ccf
- Parents:
- c511365
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/misc.c
rc511365 re9b755e 322 322 } 323 323 324 #ifdef IPV6325 /* Wrap an IPv4 address into IPv6 space. Not thread-safe... */326 char *ipv6_wrap( char *src )327 {328 static char dst[64];329 int i;330 331 for( i = 0; src[i]; i ++ )332 if( ( src[i] < '0' || src[i] > '9' ) && src[i] != '.' )333 break;334 335 /* Hmm, it's not even an IP... */336 if( src[i] )337 return src;338 339 g_snprintf( dst, sizeof( dst ), "::ffff:%s", src );340 341 return dst;342 }343 344 /* Unwrap an IPv4 address into IPv6 space. Thread-safe, because it's very simple. :-) */345 char *ipv6_unwrap( char *src )346 {347 int i;348 349 if( g_strncasecmp( src, "::ffff:", 7 ) != 0 )350 return src;351 352 for( i = 7; src[i]; i ++ )353 if( ( src[i] < '0' || src[i] > '9' ) && src[i] != '.' )354 break;355 356 /* Hmm, it's not even an IP... */357 if( src[i] )358 return src;359 360 return ( src + 7 );361 }362 #endif363 364 324 /* Convert from one charset to another. 365 325 -
lib/misc.h
rc511365 re9b755e 52 52 G_MODULE_EXPORT void http_encode( char *s ); 53 53 54 G_MODULE_EXPORT char *ipv6_wrap( char *src );55 G_MODULE_EXPORT char *ipv6_unwrap( char *src );56 57 54 G_MODULE_EXPORT signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf ); 58 55
Note: See TracChangeset
for help on using the changeset viewer.