FD.io VPP  v21.01.1
Vector Packet Processing
wireguard_send.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Doc.ai and/or its affiliates.
3  * Copyright (c) 2020 Cisco and/or its affiliates.
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 #ifndef __included_wg_send_h__
18 #define __included_wg_send_h__
19 
21 
23 bool wg_send_handshake (vlib_main_t * vm, wg_peer_t * peer, bool is_retry);
24 void wg_send_handshake_from_mt (u32 peer_index, bool is_retry);
26 
27 always_inline void
29 {
30  ip_csum_t sum = ip4->checksum;
31  u16 old = ip4->length;
32  u16 new = len;
33 
34  sum = ip_csum_update (sum, old, new, ip4_header_t, length);
35  ip4->checksum = ip_csum_fold (sum);
36  ip4->length = new;
37 }
38 
39 #endif /* __included_wg_send_h__ */
40 
41 /*
42  * fd.io coding-style-patch-verification: ON
43  *
44  * Local Variables:
45  * eval: (c-set-style "gnu")
46  * End:
47  */
uword ip_csum_t
Definition: ip_packet.h:246
vlib_main_t * vm
Definition: in2out_ed.c:1580
void wg_send_handshake_from_mt(u32 peer_index, bool is_retry)
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57
bool wg_send_handshake_response(vlib_main_t *vm, wg_peer_t *peer)
#define always_inline
Definition: ipsec.h:28
vl_api_ip4_address_t ip4
Definition: one.api:376
vl_api_address_t peer
Definition: teib.api:28
u8 len
Definition: ip_types.api:103
bool wg_send_handshake(vlib_main_t *vm, wg_peer_t *peer, bool is_retry)
char const int length
Definition: cJSON.h:163
#define ip_csum_update(sum, old, new, type, field)
Definition: ip_packet.h:296
bool wg_send_keepalive(vlib_main_t *vm, wg_peer_t *peer)
static void ip4_header_set_len_w_chksum(ip4_header_t *ip4, u16 len)
static u16 ip_csum_fold(ip_csum_t c)
Definition: ip_packet.h:302