FD.io VPP  v20.09-64-g4f7b92f0a
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  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __included_wg_send_h__
17 #define __included_wg_send_h__
18 
20 
22 bool wg_send_handshake (vlib_main_t * vm, wg_peer_t * peer, bool is_retry);
23 void wg_send_handshake_from_mt (u32 peer_index, bool is_retry);
25 
26 always_inline void
28 {
29  ip_csum_t sum = ip4->checksum;
30  u16 old = ip4->length;
31  u16 new = len;
32 
33  sum = ip_csum_update (sum, old, new, ip4_header_t, length);
34  ip4->checksum = ip_csum_fold (sum);
35  ip4->length = new;
36 }
37 
38 #endif /* __included_wg_send_h__ */
39 
40 /*
41  * fd.io coding-style-patch-verification: ON
42  *
43  * Local Variables:
44  * eval: (c-set-style "gnu")
45  * End:
46  */
uword ip_csum_t
Definition: ip_packet.h:244
vlib_main_t * vm
Definition: in2out_ed.c:1582
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:92
bool wg_send_handshake(vlib_main_t *vm, wg_peer_t *peer, bool is_retry)
#define ip_csum_update(sum, old, new, type, field)
Definition: ip_packet.h:294
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:300