OpenVPN
src
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
34
occ_reset_op
(
void
)
35
{
36
return
-1;
37
}
38
39
/*
40
* Should we send an OCC_REQUEST message?
41
*/
42
static
inline
void
43
check_send_occ_req
(
struct
context
*c)
44
{
45
void
check_send_occ_req_dowork
(
struct
context
*c);
46
47
if
(
event_timeout_defined
(&c->
c2
.
occ_interval
)
48
&&
event_timeout_trigger
(&c->
c2
.
occ_interval
,
49
&c->
c2
.
timeval
,
50
(!
TO_LINK_DEF
(c) && c->
c2
.
occ_op
< 0) ?
ETT_DEFAULT
: 0))
51
{
52
check_send_occ_req_dowork
(c);
53
}
54
}
55
56
/*
57
* Should we send an MTU load test?
58
*/
59
static
inline
void
60
check_send_occ_load_test
(
struct
context
*c)
61
{
62
void
check_send_occ_load_test_dowork
(
struct
context
*c);
63
64
if
(
event_timeout_defined
(&c->
c2
.
occ_mtu_load_test_interval
)
65
&&
event_timeout_trigger
(&c->
c2
.
occ_mtu_load_test_interval
,
66
&c->
c2
.
timeval
,
67
(!
TO_LINK_DEF
(c) && c->
c2
.
occ_op
< 0) ?
ETT_DEFAULT
: 0))
68
{
69
check_send_occ_load_test_dowork
(c);
70
}
71
}
72
73
/*
74
* Should we send an OCC message?
75
*/
76
static
inline
void
77
check_send_occ_msg
(
struct
context
*c)
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
{
85
check_send_occ_msg_dowork
(c);
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 */
ETT_DEFAULT
#define ETT_DEFAULT
Definition:
interval.h:213
context
Contains all state information for one tunnel.
Definition:
openvpn.h:498
check_send_occ_load_test
static void check_send_occ_load_test(struct context *c)
Definition:
occ-inline.h:60
check_send_occ_req
static void check_send_occ_req(struct context *c)
Definition:
occ-inline.h:43
occ_reset_op
static int occ_reset_op(void)
Definition:
occ-inline.h:34
tv_clear
static void tv_clear(struct timeval *tv)
Definition:
otime.h:134
check_send_occ_msg
static void check_send_occ_msg(struct context *c)
Definition:
occ-inline.h:77
event_timeout_trigger
bool event_timeout_trigger(struct event_timeout *et, struct timeval *tv, const int et_const_retry)
Definition:
interval.c:45
context_2::occ_interval
struct event_timeout occ_interval
Definition:
openvpn.h:310
event_timeout_defined
static bool event_timeout_defined(const struct event_timeout *et)
Definition:
interval.h:144
context_2::timeval
struct timeval timeval
Definition:
openvpn.h:399
TO_LINK_DEF
#define TO_LINK_DEF(c)
Definition:
forward.h:48
check_send_occ_req_dowork
void check_send_occ_req_dowork(struct context *c)
Definition:
occ.c:153
check_send_occ_msg_dowork
void check_send_occ_msg_dowork(struct context *c)
Definition:
occ.c:220
context::c2
struct context_2 c2
Level 2 context.
Definition:
openvpn.h:537
check_send_occ_load_test_dowork
void check_send_occ_load_test_dowork(struct context *c)
Definition:
occ.c:190
context_2::occ_mtu_load_test_interval
struct event_timeout occ_mtu_load_test_interval
Definition:
openvpn.h:327
context_2::occ_op
int occ_op
Definition:
openvpn.h:308
Generated by
1.8.13