Automatic Generation of Network protocol gateways David Bromberg, Laurent Réveillère, Julia Lawall and Gilles Muller LaBRI – University of Bordeaux
Ubiquitous environment 2 LaBRI
Heterogeneous protocols 3 LaBRI
Gateways for providing interoperability Translation logic 4 LaBRI
Huge set of interaction protocols DAP TLS POP CHARGEN SLP DSP DNS IAMC SSIP RTP STOMP DELTA 9P STUN SSH CCSO GOPHER CFDP THRIFT SIMPLE MGCP SMTP IIOP GTP SNMP NNTP RTSP ALSP DIS PINT BTP ENRP IMAP DAYTIME NTP AMQP SIP XMPP FTP HTTP SMB APPC RTCP RMI SOAP 5 LaBRI
Binary protocols DAP TLS POP CHARGEN SLP DSP DNS IAMC SSIP RTP STOMP DELTA 9P STUN SSH CCSO GOPHER CFDP THRIFT SIMPLE MGCP SMTP IIOP GTP SNMP NNTP RTSP ALSP DIS PINT BTP ENRP IMAP DAYTIME NTP AMQP SIP XMPP FTP HTTP SMB APPC RTCP RMI SOAP 6 LaBRI
Textual protocols DAP TLS POP CHARGEN SLP DSP DNS IAMC SSIP RTP STOMP DELTA 9P STUN SSH CCSO GOPHER CFDP THRIFT SIMPLE MGCP SMTP IIOP GTP SNMP NNTP RTSP ALSP DIS PINT BTP ENRP IMAP DAYTIME NTP AMQP SIP XMPP FTP HTTP SMB APPC RTCP RMI SOAP 7 LaBRI
XML protocols POP CHARGEN IAMC SSIP STOMP CCSO GOPHER SIMPLE MGCP SMTP NNTP RTSP PINT BTP IMAP DAYTIME SIP XMPP FTP HTTP SOAP 8 LaBRI
Other protocol characteristics NNTP IMAP FTP ….. ….. ….. ….. SNMP ….. ….. POP SMTP ….. SIP ….. ….. RTSP HTTP Synchronous Asynchronous HTTP …. …. IMAP FTP ….. ….. ….. ….. ….. ….. …. POP RTSP …. SLP SMTP ….. ….. ….. Multicast Unicast 9 LaBRI
Developing a gateway Challenging task requiring knowledge of the protocols involved substantial understanding of low-level network programming A gateway must take into account the different degrees of expressiveness of the different protocols the range of communication methods used by the protocols the need of the various protocols to maintain state across multiple messages 10 LaBRI
Mismatched protocol expressiveness One single SIP request multiple RTSP messages SIP RTSP RTSP agent SIP agent SIP to RTSP Gateway 11 LaBRI
Mismatched protocol expressiveness RTSP requests send synchronously using separate TCP connections SIP responses returned asynchronously over UDP SIP RTSP RTSP agent SIP agent SIP to RTSP Gateway Unicast / asynchronous Unicast / synchronous 12 LaBRI
Heterogeneous communication One protocol on the left several protocols on the right SLP SSDP HTTP SLP agent UPnP service SLP to UPnP Gateway 13 LaBRI
Heterogeneous communication Different communication schemes Unicast / Multicast SLP SSDP HTTP SLP agent UPnP service SLP to UPnP Gateway 14 LaBRI
Heterogeneous communication Different communication schemes Unicast / Multicast Synchronous / Asynchronous SLP SSDP Asynchronous HTTP SLP agent UPnP service SLP to UPnP Synchronous Gateway Asynchronous 15 LaBRI
Session management Multiple SMTP messages flow within the same TCP stream gateways need to manage a state SMTP over TCP SMTP over TCP HTTP over UDP TCP Stream TCP Stream … … … SMTP HTTP to SMTP SMTP SMTP to HTTP agent Gateway server Gateway Unicast sync. Unicast async. Unicast sync. 16 LaBRI
Open issue Protocol specification Code & translation semantics 17 LaBRI
Our approach High level specifications Verification • Consistency checks Code generation • Dataflow analyses Translation engine Runtime system 18 LaBRI
z2z : an umbrella of DSLs Protocol specification language (PSL) How to interact with the network to send or receive messages Message specification language (MSL) Defines a view from an incoming message Defines templates to forge new messages Message translation language (MTL) Defines a set of handlers (one for each relevant request in the source protocol) C-like notation augmented with domain-specific operators 19 LaBRI
Z2Z by example http.msl http.psl slp2upnp.mtl slp.msl slp.psl ssdp.msl ssdp.psl 20 LaBRI
Protocol Specification (SLP) http.msl http.psl slp2upnp.mtl slp.msl slp.psl ssdp.msl ssdp.psl 21 LaBRI
Protocol Specification (SLP) slp.psl Information about interaction protocol slp { with the network attributes { transport = udp / 427; mode = async / multicast; group = 239.255 .255 .253; } request req { response SrvReq when req.function_id == 1; … } Requests that should be sending response resp ( request req) { handled by the gateway // according to RFC 2608 resp.xid = req.xid; How to identify a transaction: resp.url_len = strlen(resp.url); Response associated to a request … } Protocol-specific information that flow { xid } … all messages must contain } 22 LaBRI
Message Specification (SLP) http.msl http.psl slp.msl slp.msl slp2upnp.mtl slp.psl slp.psl ssdp.msl ssdp.psl 23 LaBRI
Message Specification (SLP) slp.msl message slp { read { mandatory private int function_id; mandatory private int xid; optional public int url_count; optional public fragment list urls; optional public fragment scope; optional public fragment service_type; optional public fragment predicate; } Message View Interface of ad-hoc message parser Select information useful for the gateway } 24 LaBRI
Message Specification (SLP) http.msl http.psl slp2upnp.mtl slp.msl slp.psl ssdp.msl ssdp.psl 25 LaBRI
Message Specification (SLP) slp.msl message slp { read { … } reponse binary template srvReply { magic = ″ foo ″; private int16 total_len; private int16 url_len; Binary Template private int16 xid private int16 lifetime; Expressed as a sequence of hexadecimal values public fragment url; Holes fields with values fields −− foo Response Template 02 02 00 <%total len%> 20 00 00 00 00 Similar to a message view <%xid%> 00 02 65 6e 00 00 00 01 00 All field are mandatory <%lifetime%> <%url len%> <%url%> 00 00 Private fields are filled in sending block (psl) −− foo Public fields must be filled in MTL } } 26 LaBRI
Message Specification (SSDP) http.msl http.psl slp.msl slp.msl slp2upnp.mtl slp.psl ssdp.msl ssdp.msl ssdp.psl 27 LaBRI
Message Specification (SSDP) ssdp.msl message ssdp { read { … } request template response Search { magic = " foo "; newline = "\r\n"; public int mx; public fragment st; −− foo M-SEARCH * HTTP/1.1 ST: <%st%> MX: <%mx%> MAN: "ssdp:discover" HOST: 239.255.255.250:1900 −− foo } } 28 LaBRI
Message Translation (SLP 2 UPnP) http.msl http.psl slp.msl slp2upnp.mtl slp2upnp.mtl slp.psl ssdp.msl ssdp.msl ssdp.psl 29 LaBRI
Message Translation Defines a set of handlers One for each relevant request in the source protocol Handlers written using a C-like notation augmented with domain-specific operators for Manipulating messages Forging messages Sending requests (target protocol) Returning responses (source protocol) Session managment 30 LaBRI
Message Translation Slp2upnp.mtl slp response SrvReq ( slp request s) { SrvReq Handler Parametrized by a view of the request Information in the view extracted using structure field access notation } 31 LaBRI
Message Translation Slp2upnp.mtl slp response SrvReq ( slp request s) { ssdp response res_ssdp; ssdp message search_ssdp; http response res_http; search_ssdp = Search(mx= 3, st="upnp:rootdevice")); New messages forged by invoking a template (Search) Public fields must be initialized before sending the message } 32 LaBRI
Message Translation Slp2upnp.mtl slp response SrvReq ( slp request s) { ssdp response res_ssdp; ssdp message search_ssdp; http response res_http; search_ssdp = Search(mx= 3, st="upnp:rootdevice")); res_ssdp = send (search_ssdp); Sending a request (multicast send) Execution pauses until a response is received Semantic preserved regardless of the sync/async properties } 33 LaBRI
Message Translation Slp2upnp.mtl slp response SrvReq ( slp request s) { ssdp response res_ssdp; ssdp message search_ssdp; http response res_http; search_ssdp = Search(mx= 3, st="upnp:rootdevice")); res_ssdp = send (search_ssdp); Receiving a ssdp response (unicast response) Execution resumed } 34 LaBRI
Message Translation Slp2upnp.mtl slp response SrvReq ( slp request s) { ssdp response res_ssdp; ssdp message search_ssdp; Sending a request (unicast send) http response res_http; HTTP Get message generated and sent search_ssdp = Search(mx= 3, st="upnp:rootdevice")); Response received synchronously (no continuation) res_ssdp = send (search_ssdp); res_http = send (Get(path = res_ssdp.location_path, ip = res_ssdp.location_ip, port = res_ssdp.location_port)); } 35 LaBRI
Recommend
More recommend