APIs for NAT ing

We are using 6.2.1 version of QNX on cPCI platform. The system we are developing is a node (in an IP netwrok) which directly gets IP data stream from air interface ( radio communication). This IP packet is to be routed by the node to Internet cloud through a Packet data Gateway.

To do the above routing we intend to employ NAT ing in the Node, which will translate the “Source IP address + Source Port number” combination to a new port number. The node will re-send the received IP packet after modifying the Source IP address field in the received packet to that of the IP address of the Node itself and the Source Port replaced with the newly translated Port Number.

However this needs lower level control of the packet. Normally we use socket programming APIs for IP communication, which will not be useful here. We have gone through the programmer’s manual to some extent but have not been able to locate APIs which will allow us to do NAT. Can you please help with inputs on how the above task can be achieved. Are there APIs available at this level?

Help in this regard will be highly appreciated.


What kind of lower level control are you talking about (ie what kind of API’s are you hoping to find)?

QNX supports raw sockets which pretty much let you do anything you want. There won’t be any API’s but assuming some exist in Linux that use raw sockets you could port them.

Also libpcap has been ported to QNX as part of tcpdump. Libpcap normally works at the MUX layer (at least on other OS’s it does, never looked that deeply at QNX). So there may be routines in there you could use.