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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef __included_wg_send_h__
17 #define __included_wg_send_h__
19 #include <wireguard/wireguard_peer.h>
21 bool wg_send_keepalive (vlib_main_t * vm, wg_peer_t * peer);
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);
24 bool wg_send_handshake_response (vlib_main_t * vm, wg_peer_t * peer);
27 ip4_header_set_len_w_chksum (ip4_header_t * ip4, u16 len)
29 ip_csum_t sum = ip4->checksum;
30 u16 old = ip4->length;
33 sum = ip_csum_update (sum, old, new, ip4_header_t, length);
34 ip4->checksum = ip_csum_fold (sum);
38 #endif /* __included_wg_send_h__ */
41 * fd.io coding-style-patch-verification: ON
44 * eval: (c-set-style "gnu")