Zebu:

A Language-Based Approach
for network message processing layer



Little introduction

Examples

Publications

People


Little introduction

The correct functioning of a network relies on the robust and efficient implementation of network applications. These network applications usually rely on so-called application-layer protocols (e.g HTTP, SIP). As application-layer protocols specifications have become increasingly complex and extensible, however, hand-writing application-layer network message processing code has become increasingly error-prone and the resulting code increasingly resource-greedy. The SIP grammar represents more than 2000 lines of ABNF, the notation used in RFCs. Such a specification amounts to a state machine, which for efficiency is often implemented in a unstructured way with gotos. Typical implementations of SIP parsers represent about 15000 lines of C code. In addition, SIP parsing consumes more than 25% of the total time required for processing a SIP message.

We have developed a declarative domain-specific language, Zebu, for describing protocol message formats and related processing constraints. Based on a Zebu specification, the Zebu compiler generates custom, fine-tuned protocol-handling layers for HTTP-like protocols. Zebu is based on the ABNF notation and therefore enables developers to reuse existing grammar specifications available in RFCs. The Zebu language provides annotations to express the message memory layout and protocol-specific constraints. These annotations decouple the message memory layout from the message format. The developer thus expresses his own view of the message, in terms of data structures and types, that will be available in the application. In addition, annotations allow the developer to express various kinds of constraints on a message and potential optimizations. For instance, the mandatory attribute marks headers that must be part of a message. This annotation leads to the generation of run-time presence verifications and validations. The lazy attribute requests on-demand parsing. When specified as lazy, a rule is decoded only when it is explicitly requested by the application.

The following excerpt of a Zebu specification illustrates the use of some of the Zebu annotations:

header CSeq = 1*DIGIT:number as uint32 LWS Method:method
header To {"to" / "t" } = name-addr / addr-spec:uri { mandatory, ReadOnly }
name-addr = [ display-name ] LAQUOT addr-spec:uri RAQUOT
struct addr-spec = SIP-URI / SIPS-URI / absoluteURI { lazy }

From a Zebu specification, the Zebu compiler automatically generates a custom protocol-handling layer. The developper manipulates messages through stubs to guarantee a safe access to the message and to control the message modifications.

An important benefit of using Zebu as opposed to hand-crafted implementations is robustness. This robustness is provided by the Zebu compiler, which automatically checks specification consistency and generates parsing stubs that include validation of the message structure. We performed a mutation analysis, consisting in injecting invalid SIP messages, which showed that a Zebu-based protocol-handling layer detects every mutants. Typical SIP implementations could not detect more than 25% of them. We performed the same study with RTSP. There again, a Zebu-based protocol-handling layer detected every mutants. Tested RTSP implementations detected from 0.1% to 27% of the injected mutants. Furthermore, this robustness does not come at the expense of efficiency. Zebu-based protocol-handling layers are memory-efficient, as the memory usage is tailored to application needs. They are also as time-efficient as hand-crafted ones mainly thanks to on-demand parsing. 


Examples and Implementation


Publications

A Language-Based Approach for Robust and Efficient Network Application Protocol Implementations. 
Laurent Burgy, Laurent Réveillère, Julia Lawall, Gilles Muller.
Presented at Eurosys 2007.

A Language-Based Approach for Robust and Efficient Network Application Protocol Implementations
Laurent Burgy, Laurent Réveillère, Julia Lawall, Gilles Muller.
INRIA Tech Report 6167.

People

The following people are currently working on Zebu: