OpenVPN
occ-inline.h
Go to the documentation of this file.
1 /*
2  * OpenVPN -- An application to securely tunnel IP networks
3  * over a single TCP/UDP port, with support for SSL/TLS-based
4  * session authentication and key exchange,
5  * packet encryption, packet authentication, and
6  * packet compression.
7  *
8  * Copyright (C) 2002-2018 OpenVPN Inc <sales@openvpn.net>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2
12  * as published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 #ifndef OCC_INLINE_H
25 #define OCC_INLINE_H
26 
27 #ifdef ENABLE_OCC
28 
29 /*
30  * Inline functions
31  */
32 
33 static inline int
35 {
36  return -1;
37 }
38 
39 /*
40  * Should we send an OCC_REQUEST message?
41  */
42 static inline void
44 {
45  void check_send_occ_req_dowork(struct context *c);
46 
49  &c->c2.timeval,
50  (!TO_LINK_DEF(c) && c->c2.occ_op < 0) ? ETT_DEFAULT : 0))
51  {
53  }
54 }
55 
56 /*
57  * Should we send an MTU load test?
58  */
59 static inline void
61 {
63 
66  &c->c2.timeval,
67  (!TO_LINK_DEF(c) && c->c2.occ_op < 0) ? ETT_DEFAULT : 0))
68  {
70  }
71 }
72 
73 /*
74  * Should we send an OCC message?
75  */
76 static inline void
78 {
79  void check_send_occ_msg_dowork(struct context *c);
80 
81  if (c->c2.occ_op >= 0)
82  {
83  if (!TO_LINK_DEF(c))
84  {
86  }
87  else
88  {
89  tv_clear(&c->c2.timeval); /* ZERO-TIMEOUT */
90  }
91  }
92 }
93 
94 #endif /* ifdef ENABLE_OCC */
95 #endif /* ifndef OCC_INLINE_H */
#define ETT_DEFAULT
Definition: interval.h:213
Contains all state information for one tunnel.
Definition: openvpn.h:498
static void check_send_occ_load_test(struct context *c)
Definition: occ-inline.h:60
static void check_send_occ_req(struct context *c)
Definition: occ-inline.h:43
static int occ_reset_op(void)
Definition: occ-inline.h:34
static void tv_clear(struct timeval *tv)
Definition: otime.h:134
static void check_send_occ_msg(struct context *c)
Definition: occ-inline.h:77
bool event_timeout_trigger(struct event_timeout *et, struct timeval *tv, const int et_const_retry)
Definition: interval.c:45
struct event_timeout occ_interval
Definition: openvpn.h:310
static bool event_timeout_defined(const struct event_timeout *et)
Definition: interval.h:144
struct timeval timeval
Definition: openvpn.h:399
#define TO_LINK_DEF(c)
Definition: forward.h:48
void check_send_occ_req_dowork(struct context *c)
Definition: occ.c:153
void check_send_occ_msg_dowork(struct context *c)
Definition: occ.c:220
struct context_2 c2
Level 2 context.
Definition: openvpn.h:537
void check_send_occ_load_test_dowork(struct context *c)
Definition: occ.c:190
struct event_timeout occ_mtu_load_test_interval
Definition: openvpn.h:327
int occ_op
Definition: openvpn.h:308