Route an IP packet to proxy server, capture the Proxy reply
I am involved in a project on Debian. One of my requirement is to route an IP packet in my application to a proxy server and receive the reply from the proxy server as an IP packet. My application handles data at the IP frame level. My application creates an IP packet(with all the necessary IP header and proper payload). I need to route this IP packet to a proxy server and capture the reply from the proxy server at the IP level as an IP packet.
One of solution that I have in my mind(thought have not tried) is to create a raw socket in my application and establish a connection with the proxy server. Then I would be able to send IP packet to the proxy server via the raw socket. The reply from the proxy server when read via the raw socket in my application would be an IP packet sent by the proxy. But this implementation requires my application to be run with root privilidges. My application would be run by mulitple users and providing them root access is not acceptable.
As an alternative, I am planning to run a different program on a seperate machine(with root privilidge). This new program(let us call it as router for our reference) would listen on UDP ports to which my applications running on different machines would send data(IP packets). This means IP packet is sent as data via a UDP socket(Similar to IP-in-IP). When the router receives the data(IP Packet) it routes it to Proxy server via a Raw socket connection. This means the router would establish a raw sockect connection with the Proxy server and send the IP packets on the raw socket(This IP packtes are received as user data on the UDP port). Similarly the data received from the proxy server, the router reads the same via the raw socket as an IP packet. This IP packet is sent via the UDP connection to the machine(machine 1 or 2 in the Diagram).
Please refer the attachments for a graphical view(Graphical textpad.txt for textpad/wordpad and Graphical notepad.txt for notepad)
I looking for a software/package that would perfom the functionality of the router described above. It would be great if it can handle any authenication required with the proxy server also.
In summary the software should accecpt UDP/TCP connections, recieve an IP packet as data from the UDP/TCP port, send the received IP packet to proxy server, receive the reply IP packet from the proxy server
One of my friend suggested to try CIPE for the same. But I could not find CIPE fit my requirements. Could you please provide any pointers to any tool/software that would fit my requirements.