P4C
The P4 Compiler
Loading...
Searching...
No Matches
ebpf_common.h
1/*
2Copyright 2018 VMware, Inc.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17/*
18 * This file contains general type definitions used in ebpf programs.
19 * It should be included with new target header files.
20 */
21
22#include <stdio.h> // printf
23#include <stdbool.h> // true and false
24#include <linux/types.h> // u8, u16, u32, u64
25
26typedef signed char s8;
27typedef unsigned char u8;
28typedef signed short s16;
29typedef unsigned short u16;
30typedef signed int s32;
31typedef unsigned int u32;
32typedef signed long long s64;
33typedef unsigned long long u64;
34
35
38static inline void print_n_bytes(void *receiveBuffer, int num) {
39 for (int i = 0; i < num; i++)
40 printf("%02x", ((unsigned char *)receiveBuffer)[i]);
41 printf("\n");
42}