{"id":49088576,"url":"https://github.com/zhh2001/p4-protocol-headers","last_synced_at":"2026-04-20T17:11:15.895Z","repository":{"id":285719018,"uuid":"959096918","full_name":"zhh2001/p4-protocol-headers","owner":"zhh2001","description":"📚 Open-source P4 Protocol Header Library | Standardized and extensible P4 templates for common network protocols (e.g., TCP, UDP, IPv4, IPv6), accelerating programmable data plane development.","archived":false,"fork":false,"pushed_at":"2026-04-19T13:08:51.000Z","size":234,"stargazers_count":45,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-19T15:09:11.536Z","etag":null,"topics":["network","network-protocols","p4","protocol","protocol-headers","sdn","software-defined-networking"],"latest_commit_sha":null,"homepage":"","language":"P4","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhh2001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-02T09:05:22.000Z","updated_at":"2026-04-19T13:02:23.000Z","dependencies_parsed_at":"2025-04-02T14:49:43.552Z","dependency_job_id":null,"html_url":"https://github.com/zhh2001/p4-protocol-headers","commit_stats":null,"previous_names":["zhh2001/p4-headers","zhh2001/p4-protocol-headers"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zhh2001/p4-protocol-headers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhh2001%2Fp4-protocol-headers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhh2001%2Fp4-protocol-headers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhh2001%2Fp4-protocol-headers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhh2001%2Fp4-protocol-headers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhh2001","download_url":"https://codeload.github.com/zhh2001/p4-protocol-headers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhh2001%2Fp4-protocol-headers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32056996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["network","network-protocols","p4","protocol","protocol-headers","sdn","software-defined-networking"],"created_at":"2026-04-20T17:11:15.085Z","updated_at":"2026-04-20T17:11:15.890Z","avatar_url":"https://github.com/zhh2001.png","language":"P4","readme":"# P4 Protocol Headers Library\n\n### Welcome!\n\nThis repository provides ready-to-use **P4_16** header definitions for common network protocols (L2-L7). All files pass `p4c` compilation. Use freely for research, prototyping, or production.\n\n### Features\n\n- **72 protocols** covering L2 to L4+ (data-plane parseable)\n- All files compile cleanly with `p4c --std p4-16`\n- Bilingual comments (English + Chinese)\n- Includes typedefs, constants, and enum definitions\n- Only protocols with fixed binary headers that P4 can actually parse\n\n### Quick Start\n\nInclude a header file in your P4 program:\n\n```p4\n#include \"ethernet.p4\"\n#include \"ipv4.p4\"\n#include \"tcp.p4\"\n```\n\n### Need Help?\n\nOpen an Issue if you:\n- Find incorrect header definitions\n- Want to request a new protocol\n- Need usage examples\n\n### Want to Contribute?\n\nPRs are welcome!\n\n---\n\n# P4 协议报头库\n\n### 欢迎使用！\n\n本仓库提供开箱即用的 **P4_16** 协议报头定义（L2-L7），所有文件均可通过 `p4c` 编译。支持科研、原型开发或生产环境。\n\n### 特性\n\n- **72 个协议**，覆盖 L2 到 L4+（数据面可解析）\n- 所有文件均可通过 `p4c --std p4-16` 编译\n- 中英双语注释\n- 包含 typedef、常量和 enum 定义\n- 仅收录 P4 可解析的固定二进制报头协议\n\n### 快速上手\n\n在 P4 程序中引用头文件：\n\n```p4\n#include \"ethernet.p4\"\n#include \"ipv4.p4\"\n#include \"tcp.p4\"\n```\n\n### 遇到问题？\n\n欢迎提交 Issue：\n\n- 发现报头定义错误\n- 需要新增协议支持\n- 需要使用案例\n\n### 参与贡献\n\n接受 PR 贡献！\n\n---\n\n### Protocol List / 协议列表\n\n| Filename | Abbr | Full Name | 中文名称 |\n| --- | --- | --- | --- |\n| `arp.p4` | ARP | Address Resolution Protocol | 地址解析协议 |\n| `bfd.p4` | BFD | Bidirectional Forwarding Detection | 双向转发检测协议 |\n| `bgp.p4` | BGP | Border Gateway Protocol | 边界网关协议 |\n| `bgp_ls.p4` | BGP-LS | BGP Link-State | BGP 链路状态扩展 |\n| `bgp_sr.p4` | BGP-SR | BGP Segment Routing Extensions | BGP 段路由扩展 |\n| `bier.p4` | BIER | Bit Index Explicit Replication | 位索引显式复制协议 |\n| `capwap.p4` | CAPWAP | Control And Provisioning of Wireless Access Points | 无线接入点控制与配置协议 |\n| `cbs.p4` | CBS | Credit-Based Shaper (IEEE 802.1Qav) | 基于信用的流量整形协议 |\n| `cqf.p4` | CQF | Cyclic Queuing and Forwarding | 周期性排队与转发协议 |\n| `dhcp.p4` | DHCP | Dynamic Host Configuration Protocol | 动态主机配置协议 |\n| `dhcpv6.p4` | DHCPv6 | Dynamic Host Configuration Protocol for IPv6 | DHCPv6 动态主机配置协议 |\n| `dns.p4` | DNS | Domain Name System | 域名系统协议 |\n| `eap.p4` | EAP/802.1X | Extensible Authentication Protocol | 可扩展认证协议 |\n| `erspan.p4` | ERSPAN | Encapsulated Remote Switched Port Analyzer | 封装远程端口镜像协议 |\n| `ethernet.p4` | Ethernet | Ethernet II (IEEE 802.3) | 以太网协议 |\n| `fp.p4` | FP | Frame Preemption (IEEE 802.1Qbu) | 帧抢占协议 |\n| `frer.p4` | FRER | Frame Replication and Elimination for Reliability | 帧复制消除协议 |\n| `geneve.p4` | GENEVE | Generic Network Virtualization Encapsulation | 通用网络虚拟化封装 |\n| `gptp.p4` | gPTP | Generalized Precision Time Protocol | 广义精确时间协议 |\n| `gre.p4` | GRE | Generic Routing Encapsulation | 通用路由封装协议 |\n| `gtp_u.p4` | GTP-U | GPRS Tunneling Protocol User Plane | GPRS 隧道协议用户面 |\n| `icmp.p4` | ICMP | Internet Control Message Protocol | 互联网控制报文协议 |\n| `icmpv6.p4` | ICMPv6 | Internet Control Message Protocol for IPv6 | ICMPv6 控制报文协议 |\n| `igmp.p4` | IGMP | Internet Group Management Protocol | 互联网组管理协议 |\n| `int.p4` | INT | In-band Network Telemetry | 带内网络遥测 |\n| `ipfix.p4` | IPFIX | IP Flow Information Export | IP 数据流信息输出 |\n| `ipsec.p4` | IPSec | Internet Protocol Security | IP 安全协议 |\n| `ipv4.p4` | IPv4 | Internet Protocol version 4 | 互联网协议第 4 版 |\n| `ipv6.p4` | IPv6 | Internet Protocol version 6 | 互联网协议第 6 版 |\n| `isis.p4` | IS-IS | Intermediate System to Intermediate System | 中间系统到中间系统路由协议 |\n| `lacp.p4` | LACP | Link Aggregation Control Protocol | 链路汇聚控制协议 |\n| `lisp.p4` | LISP | Locator/Identifier Separation Protocol | 定位/标识分离协议 |\n| `lldp.p4` | LLDP | Link Layer Discovery Protocol | 链路层发现协议 |\n| `lwapp.p4` | LWAPP | Lightweight Access Point Protocol | 轻量级无线接入点协议 |\n| `macsec.p4` | MACsec | Media Access Control Security (IEEE 802.1AE) | 媒体访问控制安全协议 |\n| `modbus.p4` | Modbus | Modbus Protocol | Modbus 通讯协议 |\n| `mpls.p4` | MPLS | Multi-Protocol Label Switching | 多协议标签交换 |\n| `msdp.p4` | MSDP | Multicast Source Discovery Protocol | 组播源发现协议 |\n| `nsh.p4` | NSH | Network Service Header | 网络服务头部 |\n| `ntp.p4` | NTP | Network Time Protocol | 网络时间协议 |\n| `nts.p4` | NTS | Network Time Security | 网络时间安全协议 |\n| `nvgre.p4` | NVGRE | Network Virtualization using GRE | 基于 GRE 的网络虚拟化 |\n| `ofp.p4` | OpenFlow | OpenFlow Protocol | OpenFlow 协议 |\n| `ospf.p4` | OSPF | Open Shortest Path First | 开放式最短路径优先路由协议 |\n| `pcep.p4` | PCEP | Path Computation Element Protocol | 路径计算元素协议 |\n| `pcep_sr.p4` | PCEP-SR | PCEP for Segment Routing | PCEP 段路由扩展 |\n| `pfc.p4` | PFC | Priority-based Flow Control | 基于优先级的流量控制 |\n| `pfcp.p4` | PFCP | Packet Forwarding Control Protocol | 报文转发控制协议 |\n| `pim.p4` | PIM | Protocol Independent Multicast | 协议无关组播 |\n| `pppoe.p4` | PPPoE | Point-to-Point Protocol Over Ethernet | 以太网上的点对点协议 |\n| `psfp.p4` | PSFP | Per-Stream Filtering and Policing | 流过滤与监管协议 |\n| `ptp.p4` | PTP | Precision Time Protocol (IEEE 1588) | 高精度授时协议 |\n| `quic.p4` | QUIC | Quick UDP Internet Connections | 快速 UDP 网络连接 |\n| `radius.p4` | RADIUS | Remote Authentication Dial-In User Service | 远程认证拨号用户服务 |\n| `rip.p4` | RIP | Routing Information Protocol | 路由信息协议 |\n| `rtp.p4` | RTP | Real-time Transport Protocol | 实时传输协议 |\n| `sctp.p4` | SCTP | Stream Control Transmission Protocol | 流控制传输协议 |\n| `sflow.p4` | sFlow | sFlow Sampling Protocol | sFlow 采样协议 |\n| `spb.p4` | SPB | Shortest Path Bridging (IEEE 802.1aq) | 最短路径桥接 |\n| `srmpls.p4` | SR-MPLS | Segment Routing MPLS | 基于 MPLS 的段路由 |\n| `srv6.p4` | SRv6 | Segment Routing over IPv6 | 基于 IPv6 的段路由 |\n| `stp.p4` | STP/RSTP | Spanning Tree Protocol (IEEE 802.1D/w) | 生成树协议 |\n| `stt.p4` | STT | Stateless Transport Tunneling | 无状态传输隧道 |\n| `tas.p4` | TAS | Time-Aware Shaper (IEEE 802.1Qbv) | 时间感知整形协议 |\n| `tcp.p4` | TCP | Transmission Control Protocol | 传输控制协议 |\n| `trill.p4` | TRILL | Transparent Interconnection of Lots of Links | 多链路透明互联协议 |\n| `twamp.p4` | TWAMP | Two-Way Active Measurement Protocol | 双向主动测量协议 |\n| `udp.p4` | UDP | User Datagram Protocol | 用户数据报协议 |\n| `vlan.p4` | VLAN | Virtual Local Area Network (IEEE 802.1Q) | 虚拟局域网 |\n| `vrrp.p4` | VRRP | Virtual Router Redundancy Protocol | 虚拟路由器冗余协议 |\n| `vxlan.p4` | VXLAN | Virtual Extensible Local Area Network | 虚拟可扩展局域网 |\n| `vxlan_gpe.p4` | VXLAN-GPE | VXLAN Generic Protocol Extension | VXLAN 通用协议扩展 |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhh2001%2Fp4-protocol-headers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhh2001%2Fp4-protocol-headers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhh2001%2Fp4-protocol-headers/lists"}