blob: 5036c94c0503550eb634b07462987c31b88198d5 [file] [log] [blame]
Martin KaFai Lau6ac99e82019-04-26 16:39:39 -07001/* SPDX-License-Identifier: GPL-2.0 */
2/* Copyright (c) 2019 Facebook */
3#ifndef _BPF_SK_STORAGE_H
4#define _BPF_SK_STORAGE_H
5
6struct sock;
7
8void bpf_sk_storage_free(struct sock *sk);
9
10extern const struct bpf_func_proto bpf_sk_storage_get_proto;
11extern const struct bpf_func_proto bpf_sk_storage_delete_proto;
12
Martin KaFai Lau1ed4d922020-02-25 15:04:21 -080013struct bpf_sk_storage_diag;
14struct sk_buff;
15struct nlattr;
16struct sock;
17
Stanislav Fomichev8f51dfc2019-08-14 10:37:49 -070018#ifdef CONFIG_BPF_SYSCALL
19int bpf_sk_storage_clone(const struct sock *sk, struct sock *newsk);
Martin KaFai Lau1ed4d922020-02-25 15:04:21 -080020struct bpf_sk_storage_diag *
21bpf_sk_storage_diag_alloc(const struct nlattr *nla_stgs);
22void bpf_sk_storage_diag_free(struct bpf_sk_storage_diag *diag);
23int bpf_sk_storage_diag_put(struct bpf_sk_storage_diag *diag,
24 struct sock *sk, struct sk_buff *skb,
25 int stg_array_type,
26 unsigned int *res_diag_size);
Stanislav Fomichev8f51dfc2019-08-14 10:37:49 -070027#else
28static inline int bpf_sk_storage_clone(const struct sock *sk,
29 struct sock *newsk)
30{
31 return 0;
32}
Martin KaFai Lau1ed4d922020-02-25 15:04:21 -080033static inline struct bpf_sk_storage_diag *
34bpf_sk_storage_diag_alloc(const struct nlattr *nla)
35{
36 return NULL;
37}
38static inline void bpf_sk_storage_diag_free(struct bpf_sk_storage_diag *diag)
39{
40}
41static inline int bpf_sk_storage_diag_put(struct bpf_sk_storage_diag *diag,
42 struct sock *sk, struct sk_buff *skb,
43 int stg_array_type,
44 unsigned int *res_diag_size)
45{
46 return 0;
47}
Stanislav Fomichev8f51dfc2019-08-14 10:37:49 -070048#endif
49
Martin KaFai Lau6ac99e82019-04-26 16:39:39 -070050#endif /* _BPF_SK_STORAGE_H */