blob: 00b16a34807a020a8ac5cc4ab654fb8453bb2638 [file] [log] [blame]
Lorenzo Colitti734b14e2021-02-05 23:56:09 +09001/*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19// Common definitions for BPF code in the tethering mainline module.
20// These definitions are available to:
21// - The BPF programs in Tethering/bpf_progs/
22// - JNI code that depends on the bpf_tethering_headers library.
Lorenzo Colittib81584d2021-02-06 00:00:58 +090023
24#define BPF_TETHER_ERRORS \
25 ERR(INVALID_IP_VERSION) \
26 ERR(LOW_TTL) \
27 ERR(INVALID_TCP_HEADER) \
28 ERR(TCP_CONTROL_PACKET) \
29 ERR(NON_GLOBAL_SRC) \
30 ERR(NON_GLOBAL_DST) \
31 ERR(LOCAL_SRC_DST) \
32 ERR(NO_STATS_ENTRY) \
33 ERR(NO_LIMIT_ENTRY) \
34 ERR(BELOW_IPV6_MTU) \
35 ERR(LIMIT_REACHED) \
36 ERR(CHANGE_HEAD_FAILED) \
37 ERR(_MAX)
38
39#define ERR(x) BPF_TETHER_ERR_ ##x,
40enum {
41 BPF_TETHER_ERRORS
42};
43#undef ERR
44
45#define ERR(x) #x,
46static const char *bpf_tether_errors[] = {
47 BPF_TETHER_ERRORS
48};
49#undef ERR