library/src/network/BP-Network.cc
// Thread safe version of inet_ntoa.  Returns string on the heap rather
// than within a static buffer.
Thread safe version of inet_ntoa.  Returns string on the heap rather
than within a static buffer.
Thread safe version of inet_ntoa . Returns string on the heap rather than within a static buffer .
char * BP_NetInAddrToAscii(struct in_addr * in)
{
	if(!in)
		return NULL;
	char * out_buff = NULL;
	uint8_t * buff = (uint8_t *) &in->s_addr;
	out_buff = (char *) bpcalloc(17, 1);
	sprintf(out_buff, "%u.%u.%u.%u", buff[0], buff[1], buff[2], buff[3]);
	return out_buff;
}
char * BP_NetInAddrToAscii ( struct in_addr * in ) { if ( ! in ) return NULL ; char * out_buff = NULL ; uint8_t * buff = ( uint8_t * ) & in -> s_addr ; out_buff = ( char * ) bpcalloc ( 17 , 1 ) ; sprintf ( out_buff , " " , buff [ 0 ] , buff [ 1 ] , buff [ 2 ] , buff [ 3 ] ) ; return out_buff ; }
Thread safe version of inet_ntoa.
Thread safe version of inet_ntoa .
// return null if we have no in structure // create output buffer // set a buffer from the s_addr portion // create a buffer for the IP address // create the buffer (max 16 bytes) // return the output buffer