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? 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. Please help me and if you can, the lines I have to add to make it work. Thanks
Laurent
On Jul 12, 2004 at 11:43, l.gaillard01@free.fr l.gaillard01@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@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