Higher-Order and Symbolic Computation, 14, 309–356, 2001 c 2002 Kluwer Academic Publishers. Manufactured in The Netherlands. A Network Protocol Stack in Standard ML∗ EDOARDO BIAGIONI
[email protected] University of Hawai’i at Manoa,¯ ICS Department, 1680 East-West Road, Honolulu HI 96822, USA ROBERT HARPER
[email protected] PETER LEE
[email protected] Carnegie Mellon University, School of Computer Science, 5000 Forbes Avenue, Pittsburgh PA 15213, USA Abstract. The FoxNet is an implementation of the standard TCP/IP networking protocol stack using the Standard ML (SML) language. SML is a type-safe programming language with garbage collection, a unique and advanced module system, and machine-independent semantics. The FoxNet is a user-space implementation of TCP/IP that is built in SML by composing modular protocol elements; each element independently implements one of the standard protocols. One specific combination of these elements implements the standard TCP/IP stack. Other combinations are also possible and can be used to easily and conveniently build custom, non-standard networking stacks. This paper describes in detail the final design and implementation of the FoxNet, including many of the details that are crucially affected by the choice of SML as the programming language. Keywords: Standard ML, computer networks, modules, signatures, types 1. Introduction The Fox project was started in 1991 with the goal of writing systems-level code in high-level programming languages. The purpose of doing this was and is twofold: to improve the state of the art in systems development by using more advanced languages, and to challenge both the design and implementations of advanced languages by applying them to some of the hardest programming problems known.