[Serusers] Ip address

Andrei Pelinescu-Onciul pelinescu-onciul at fokus.fraunhofer.de
Mon Jul 12 11:54:06 CEST 2004


On Jul 12, 2004 at 11:43, l.gaillard01 at free.fr <l.gaillard01 at free.fr> wrote:
> Hi all,
> 
> I'm trying to write my own module for SER, and I need to get the ip adress in 
> the good order.
> How can I do it? 

First of all, please post development related questions to
serdev at lists.iptel.org.

> I need this address to be converted into a (char*).
> The way I get it is by using ip_addr2a(&_msg->rcv.src_ip). But it's not in the 
> good order.

What do you want exactly?
ip_addr2a will convert it to a string (e.g. "192.168.0.1").
What do you understand by "good order"? host order? little endian? big
endian?

If it's an ipv4 address (msg->rcv.src_ip.af==AF_INET) and you want host
order, try ntohl(msg->rcv.src_ip.u.addr32[0]) .


Andrei




More information about the sr-users mailing list