Linux Audio

Check our new training course

Loading...
v5.4
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef _NET_ESP_H
 3#define _NET_ESP_H
 4
 5#include <linux/skbuff.h>
 6
 7struct ip_esp_hdr;
 
 8
 9static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
10{
11	return (struct ip_esp_hdr *)skb_transport_header(skb);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12}
13
14struct esp_info {
15	struct	ip_esp_hdr *esph;
16	__be64	seqno;
17	int	tfclen;
18	int	tailen;
19	int	plen;
20	int	clen;
21	int 	len;
22	int 	nfrags;
23	__u8	proto;
24	bool	inplace;
25};
26
27int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
28int esp_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
29int esp_input_done2(struct sk_buff *skb, int err);
30int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
31int esp6_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
32int esp6_input_done2(struct sk_buff *skb, int err);
33#endif
v6.2
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef _NET_ESP_H
 3#define _NET_ESP_H
 4
 5#include <linux/skbuff.h>
 6
 7struct ip_esp_hdr;
 8struct xfrm_state;
 9
10static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
11{
12	return (struct ip_esp_hdr *)skb_transport_header(skb);
13}
14
15static inline void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto)
16{
17	/* Fill padding... */
18	if (tfclen) {
19		memset(tail, 0, tfclen);
20		tail += tfclen;
21	}
22	do {
23		int i;
24		for (i = 0; i < plen - 2; i++)
25			tail[i] = i + 1;
26	} while (0);
27	tail[plen - 2] = plen - 2;
28	tail[plen - 1] = proto;
29}
30
31struct esp_info {
32	struct	ip_esp_hdr *esph;
33	__be64	seqno;
34	int	tfclen;
35	int	tailen;
36	int	plen;
37	int	clen;
38	int 	len;
39	int 	nfrags;
40	__u8	proto;
41	bool	inplace;
42};
43
44int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
45int esp_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
46int esp_input_done2(struct sk_buff *skb, int err);
47int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
48int esp6_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
49int esp6_input_done2(struct sk_buff *skb, int err);
50#endif