[P4-dev] complex function like pattern matching

Andy Fingerhut andy.fingerhut at gmail.com
Sun Apr 2 20:35:16 EDT 2017

The P4 language is focused on parsing and manipulating packet headers, not

One could write a custom extension that could search for patterns in a
payload, but it would be non-portable, and would have to be implemented in
a target-specific language, e.g. C/C++ for a software model, Verilog for an
ASIC or FPGA, etc.  It would be similar to having a library written in
assembler and calling it from C, with the assembler implemented anew for
each target processor.


On Mon, Mar 27, 2017 at 9:13 AM, yunchen chang <y2924uki at gmail.com> wrote:

> Hello everyone,
> I am doing an experiment for DPI in P4.
> (detect packet label in data plane, not in controller)
> I need some complex funtcions like lookup the host name of payload.
> Example:
> host_name: tw.yahoo.com
> mtach_key: .yahoo.
> I plan to write function in "primitives.cpp" at first.
> But after I read this posted : [http://lists.p4.org/
> pipermail/p4-dev_lists.p4.org/2016-August/000449.html], it pointed that
> P4 can't implement "pattern matching".
> I want to know is there any solution in current P4?
> (or any suggestion)
> Thank you.
> Best regards,
> Abbie
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170402/d920febb/attachment-0002.html>

More information about the P4-dev mailing list