Abstract
Pattern matching is an important operation in functional programs. So far, pattern matching has been investigated in the context of structured terms. This paper presents an approach to extend pattern matching to terms without (much of a) structure such as binaries which is the kind of data format that network applications typically manipulate. After introducing a notation for matching binary data against patterns, we present an algorithm that constructs a tree automaton from a set of binary patterns. We then show how the pattern matching can be made adaptive, how redundant tests can be avoided, and how we can further reduce the size of the resulting automaton by taking interferences between patterns into account. The effectiveness of our techniques is evaluated using implementations of network protocols taken from actual telecom applications.
Research supported in part by grants from ASTEC, Vetenskapsrådet, Ericsson, and T-Mobile.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Augustsson, L.: Compiling pattern matching. In: Jouannaud, J.-P. (ed.) FPCA 1985. LNCS, vol. 201, pp. 368–381. Springer, Heidelberg (1985)
Bailey, M., Gopal, B., Pagels, M., Peterson, L., Sarkar, P.: PathFinder: A pattern-based packet classifier. In: Proceedings of USENIX OSDI Symposium, November 1994, pp. 115–123 (1994)
Baudinet, M., MacQueen, D.: Tree pattern matching for ML (1985) (unpublished paper)
Begel, A., McCanne, S., Graham, S.L.: BPF+: Exploiting global data-flow optimization in a generalized packet filter architecture. In: ACM SIGCOMM, August 1999, pp. 123–134 (1999)
Comer, D., Sethi, R.: The complexity of trie index construction. Journal of the ACM 24(3), 428–440 (1977)
Engler, D.R., Kaashoek, M.F.: DPF: Fast, flexible message demultiplexing using dynamic code generation. In: Proceedings of ACM SIGCOMM, August 1996, pp. 53–59 (1996)
Gustafsson, P., Sagonas, K.: Native code compilation of Erlang’s bit syntax. In: Proceedings of ACM SIGPLAN Erlang Workshop, November 2002, pp. 6–15. ACM Press, New York (2002)
Gustafsson, P., Sagonas, K.: Adaptive pattern matching on binary data. Technical Report, Department of Information Technology, Uppsala University, Sweden (December 2003)
Hyafil, L., Rivest, R.L.: Constructing optimal binary decision tress is NP-complete. Information Processing Letters 5(1), 15–17 (1976)
Le Fessant, F., Maranget, L.: Optimizing pattern matching. In: Proceedings of the ACM SIGPLAN International Conference on Functional programming, September 2001, pp. 26–37 (2001)
McCann, P.J., Chandra, S.: Packet types: Abstract specification of network protocol messages. In: Proceedings of ACM SIGCOMM, August/September 2000, pp. 321–333 (2000)
Nyblom, P.: The bit syntax - the released version. In: Proceedings of the Sixth International Erlang/OTP User Conference (October 2000), Available at: http://www.erlang.se/euc/00/
Scott, K., Ramsey, N.: When do match-compilation heuristics matter? Technical Report CS-2000-13, Department of Computer Science, University of Virginia (May 2000)
Sekar, R.C., Ramesh, R., Ramakrishnan, I.V.: Adaptive pattern matching. SIAM Journal of Computing 24(6), 1207–1234 (1995)
Wadler, P.: Efficient compilation of pattern matching. In: Peyton Jones, S.L. (ed.) The Implementation of Functional Programming Languages, ch. 7. Prentice-Hall, Englewood Cliffs (1987)
Wallace, M., Runciman, C.: The bits between the lambdas: Binary data in a lazy functional language. In: Proceedings of ACM SIGPLAN ISMM, October 1998, pp. 107–117. ACM Press, New York (1998)
Wikström, C., Rogvall, T.: Protocol programming in Erlang using binaries. In: The Erlang/ OTP User Conference (October 1999), Available at: http://www.erlang.se/euc/99/
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2004 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Gustafsson, P., Sagonas, K. (2004). Adaptive Pattern Matching on Binary Data. In: Schmidt, D. (eds) Programming Languages and Systems. ESOP 2004. Lecture Notes in Computer Science, vol 2986. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-24725-8_10
Download citation
DOI: https://doi.org/10.1007/978-3-540-24725-8_10
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-21313-0
Online ISBN: 978-3-540-24725-8
eBook Packages: Springer Book Archive