Nail: A Practical Tool for Parsing and Generating Data Formats

Nail: A Practical Tool for Parsing and Generating Data Formats
复制标题

Nail:解析和生成数据格式的实用工具

DOI:
10.5555/2685048.2685098
复制
发表时间:
2014
期刊:
Proceedings of the 32nd Annual Conference on Computer Security Applications
影响因子:
--
通讯作者:
Nickolai Zeldovich
Nickolai Zeldovich
中科院分区:
--
文献类型:
--
作者:
Julian Bangert;Nickolai Zeldovich

文献摘要

参考文献

被引文献

相似文献

Nail是一种工具,它可以极大地减少程序员安全地解析和生成由语法定义的数据格式的工作。钉钉介绍了实现其目标的几个关键想法。首先,Nail使用协议语法不仅定义数据格式,还定义数据的内部对象模型。其次,通过在数据格式和对象模型之间建立语义双射,Nail消除了现有解析器生成器使用的语义操作的概念,这降低了表达能力,但允许Nail同时解析数据格式并从内部对象模型生成它们。第三,Nail引入了依赖字段和流转换来捕获协议特性,如大小和偏移量字段、校验和和压缩数据,这些特性在现有协议语言中表示是不切实际的。使用Nail,我们用不到300行代码和语法用C语言实现了一个权威的DNS服务器,用C语言用220行代码和语法实现了一个解压缩程序,演示了Nail使解析复杂的真实世界数据格式变得容易。性能实验表明,基于Nail的DNS服务器在权威负载下的性能优于广泛使用的BIND DNS服务器,证明了使用Nail构建的系统可以获得良好的性能。
Nail is a tool that greatly reduces the programmer effort for safely parsing and generating data formats defined by a grammar. Nail introduces several key ideas to achieve its goal. First, Nail uses a protocol grammar to define not just the data format, but also the internal object model of the data. Second, Nail eliminates the notion of semantic actions, used by existing parser generators, which reduces the expressive power but allows Nail to both parse data formats and generate them from the internal object model, by establishing a semantic bijection between the data format and the object model. Third, Nail introduces dependent fields and stream transforms to capture protocol features such as size and offset fields, checksums, and compressed data, which are impractical to express in existing protocol languages. Using Nail, we implement an authoritative DNS server in C in under 300 lines of code and grammar, and an unzip program in C in 220 lines of code and grammar, demonstrating that Nail makes it easy to parse complex real-world data formats. Performance experiments show that a Nail-based DNS server can outperform the widely used BIND DNS server on an authoritative workload, demonstrating that systems built with Nail can achieve good performance.
总解析器组合器
DOI: 10.1145/1932681.1863585
发表时间: 2010
影响因子: --
作者:
Danielsson N
通讯作者: Danielsson N