my idea

Wei Lu <[email protected]> Thu, 27 Jun 2002 16:0:41 +0800
Newsgroups gmane.ietf.nat
Message-ID <[email protected]>
Hi, there,

I have the following idea. before i start programming, i'd like to ask for ur comments.
__________________________________________________________________________________________________________________________

        Port Delegation - a Web service to expose the servers behind firewall or Network Address Translation(NAT)
        
        Copyright(c) 2002 Wei Lu ([email protected]). All rights reserved.
        
It aims  to address the problem to expose the service in a server  behind firewall or NAT can only make active outbound connection to the internet, but the internet can not make inbound connection to it becourse the firewall blocks the inbound access or the server behind NAT has only an un-routable private IP address.

Devided into 6 parts: 
                            HTTP                            HTTP
Actual Client->Client Proxy---(3)-->request.cgi=>server.cgi  <--(1)-->Server Proxy->Actual Server
             <-            <--(2)-->client.cgi <=response.cgi<--(4)---            <-

<=,=> means IPC between CGI program in web server.
request.cgi communicates server.cgi (response.cgi locates client.cgi) by named pipes(FIFO) with nodes named /tmp/.PD/$ServiceID or /tmp/.PD/$ClientID with the following data structure:
struct MessageBlock{
unsigned int PayloadLength;
char         ID[72];	//ServiceID or ClientID, enough for IPv6 128b address space.
char         *Payload;	//Variable array with length of PayloadLength
}
ClientID : identification of a session of Actual Client. Client Proxy,Server Proxy and all the CGIs take it as a string, don't care its meaning. A good scheme to generate it is Actual Client's IP:Port by Client Proxy.
ServiceID: identification of a port(service) of an Actual Server. Just a string.

Process:

A) Server registration:
Server Proxy GET (1) server.cgi, the response page is very large and never finish opening, from then on, all the incoming data comes from it. The data includes control messages for Server Proxy and incoming requests to Actual Server(tagged with ClientID). server.cgi creates a FIFO, /tmp/.PD/$ServiceID to wait for request.cgi

B) Client Establish Request:
Actual Client invoke request to Client Proxy. When the session starts, Client Proxy generate ClientID for this session and GET (2) requests to client.cgi with ServiceID and ClientID. (Client Proxy maintains a map of ServiceID to its listerning port to be access by Actual Client). the response page is very large and never finish opening, from then on, all the return data from Actual Server comes through it. client.cgi creates a FIFO, /tmp/.PD/$ClientID to wait for response.cgi.

C) Client send data:
Client Proxy relays every data blocks from Actual Client by http uploading scheme, POST (3) to request.cgi with ServiceID and ClientID. request.cgi write the uploaded data into FIFO /tmp/.PD/$ServiceID. server.cgi get it and relay to Server Proxy(1) with ClientID. Server Proxy demultiplex data according to ClientID, makes connections to Actual Server when ClientID first occurs.

D) Server reponse data:
The reponses data from Actual Server will be relayed by Server Proxy by POST(4) to response.cgi with http upload scheme. response messages encapsulated in MessageBlocks with ClientID. response.cgi writes the uploaded data into /tmp/.PD/$ClientID. client.cgi gets it and returns through (2). Client Proxy relays it to Actual Client.
_______________________________________________________________________________________________________________________
updating in http://wlu.51.net/PortDelegation/ or http://snap.eu.org/~wlu/PortDelegation/

Wei Lu
[email protected]

..:::::::::::::::::::::::::...

Wei Lu (Mr)
Apt.301 No.5 Lane 145 Mudan R.d
Shanghai 201204 P.R.China
86-13611885232 (cell phone)
86-21-50801913 (office)
86-21-68456252 (home)
EMail : [email protected]
...............................