P4 (programming language): Difference between revisions

Content deleted Content added
m per WP:HYPHEN, sub-subsection 3, points 3,4,6, replaced: widely- → widely , etc. using AWB
Varkora (talk | contribs)
m Added links and fixed capitalisation.
Line 14:
}}
 
'''P4''' is a [[programming language]] designed to allow programming of [[Network packet|packet]] [[Forwarding plane|forwarding dataplanesplanes]]. In contrast to a general purpose language such as [[C (programming language)|C]] or python[[Python (programming language)|Python]], P4 is a [[___domain-specific language]] with a number of constructs optimized around [[Packet forwarding|network data forwarding]]. P4 is an [[open source|open-source]], [[Permissive free software licence|permissively licensed]] language and is maintained by a non-profit organization called the P4 Language Consortium. The language was originally described in a SIGCOMM CCR paper in 2014 titled “Programming Protocol-Independent Packet Processors”<ref>{{cite web|url=http://www.sigcomm.org/node/3503|title=P4: Programming Protocol-Independent Packet Processors|date=July 2014|accessdate=7 April 2015}}</ref> – the alliterative name shortens to “P4”.
 
== Language overview and design considerations ==
Line 39:
===Headers===
 
Header definitions describe packet formats and provide names for the fields within the packet. The language allows customized header names and fields of arbitrary length, although many header definitions use widely known protocol names and fields widths. For example, an [[IEEE 802.3|802.3]] ethernetEthernet header definition might be called “ethernet”“Ethernet” and consist of the a 48-bit field named “dest” followed by a 48-bit “src” field, followed by a 16-bit “type” field. The names in a header definition are used later in the P4 program to reference these fields.
 
===Parsers===
 
The P4 '''parser''' is a finite state machine that walks an incoming byte-stream and extracts headers based on the programmed parse graph. A simple example would be a parser that extracts the ethernetEthernet source and destination and type fields, then performs a further extraction based on the value in the type field (common values might be ipv4, ipv6, or MPLS).
 
===Tables===