Advertisement

Adaptive Pattern Matching on Binary Data

  • Per Gustafsson
  • Konstantinos Sagonas
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2986)

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.

Keywords

Directed Acyclic Graph Action Sequence Pattern Match Binary Data Size Test 
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

  1. 1.
    Augustsson, L.: Compiling pattern matching. In: Jouannaud, J.-P. (ed.) FPCA 1985. LNCS, vol. 201, pp. 368–381. Springer, Heidelberg (1985)Google Scholar
  2. 2.
    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)Google Scholar
  3. 3.
    Baudinet, M., MacQueen, D.: Tree pattern matching for ML (1985) (unpublished paper)Google Scholar
  4. 4.
    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)Google Scholar
  5. 5.
    Comer, D., Sethi, R.: The complexity of trie index construction. Journal of the ACM 24(3), 428–440 (1977)zbMATHCrossRefMathSciNetGoogle Scholar
  6. 6.
    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)Google Scholar
  7. 7.
    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)CrossRefGoogle Scholar
  8. 8.
    Gustafsson, P., Sagonas, K.: Adaptive pattern matching on binary data. Technical Report, Department of Information Technology, Uppsala University, Sweden (December 2003)Google Scholar
  9. 9.
    Hyafil, L., Rivest, R.L.: Constructing optimal binary decision tress is NP-complete. Information Processing Letters 5(1), 15–17 (1976)zbMATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    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)Google Scholar
  11. 11.
    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)Google Scholar
  12. 12.
    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/
  13. 13.
    Scott, K., Ramsey, N.: When do match-compilation heuristics matter? Technical Report CS-2000-13, Department of Computer Science, University of Virginia (May 2000)Google Scholar
  14. 14.
    Sekar, R.C., Ramesh, R., Ramakrishnan, I.V.: Adaptive pattern matching. SIAM Journal of Computing 24(6), 1207–1234 (1995)zbMATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    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)Google Scholar
  16. 16.
    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)Google Scholar
  17. 17.
    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/

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Per Gustafsson
    • 1
  • Konstantinos Sagonas
    • 1
  1. 1.Department of Information TechnologyUppsala UniversitySweden

Personalised recommendations