~ubuntu-branches/ubuntu/saucy/openvpn/saucy

« back to all changes in this revision

Viewing changes to occ-inline.h

  • Committer: Bazaar Package Importer
  • Author(s): Alberto Gonzalez Iniesta
  • Date: 2005-01-05 19:03:11 UTC
  • mto: (1.4.1) (10.1.1 lenny)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20050105190311-d0uioiqtor5xbzre
Tags: upstream-1.99+2.rc6
ImportĀ upstreamĀ versionĀ 1.99+2.rc6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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-2004 James Yonan <jim@yonan.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 as published by
 
12
 *  the Free Software Foundation; either version 2 of the License, or
 
13
 *  (at your option) any later version.
 
14
 *
 
15
 *  This program is distributed in the hope that it will be useful,
 
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
 *  GNU General Public License for more details.
 
19
 *
 
20
 *  You should have received a copy of the GNU General Public License
 
21
 *  along with this program (see the file COPYING included with this
 
22
 *  distribution); if not, write to the Free Software Foundation, Inc.,
 
23
 *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
24
 */
 
25
 
 
26
#ifndef OCC_INLINE_H
 
27
#define OCC_INLINE_H
 
28
 
 
29
#ifdef ENABLE_OCC
 
30
 
 
31
/*
 
32
 * Inline functions
 
33
 */
 
34
 
 
35
static inline int
 
36
occ_reset_op ()
 
37
{
 
38
  return -1;
 
39
}
 
40
 
 
41
/*
 
42
 * Should we send an OCC_REQUEST message?
 
43
 */
 
44
static inline void
 
45
check_send_occ_req (struct context *c)
 
46
{
 
47
  void check_send_occ_req_dowork (struct context *c);
 
48
  if (event_timeout_defined (&c->c2.occ_interval)
 
49
      && event_timeout_trigger (&c->c2.occ_interval,
 
50
                                &c->c2.timeval,
 
51
                                (!TO_LINK_DEF(c) && c->c2.occ_op < 0) ? ETT_DEFAULT : 0))
 
52
    check_send_occ_req_dowork (c);
 
53
}
 
54
 
 
55
/*
 
56
 * Should we send an MTU load test?
 
57
 */
 
58
static inline void
 
59
check_send_occ_load_test (struct context *c)
 
60
{
 
61
  void check_send_occ_load_test_dowork (struct context *c);
 
62
  if (event_timeout_defined (&c->c2.occ_mtu_load_test_interval)
 
63
      && event_timeout_trigger (&c->c2.occ_mtu_load_test_interval,
 
64
                                &c->c2.timeval,
 
65
                                (!TO_LINK_DEF(c) && c->c2.occ_op < 0) ? ETT_DEFAULT : 0))
 
66
    check_send_occ_load_test_dowork (c);
 
67
}
 
68
 
 
69
/*
 
70
 * Should we send an OCC message?
 
71
 */
 
72
static inline void
 
73
check_send_occ_msg (struct context *c)
 
74
{
 
75
  void check_send_occ_msg_dowork (struct context *c);
 
76
  if (c->c2.occ_op >= 0)
 
77
    {
 
78
      if (!TO_LINK_DEF(c))
 
79
        check_send_occ_msg_dowork (c);
 
80
      else
 
81
        tv_clear (&c->c2.timeval);  /* ZERO-TIMEOUT */
 
82
    }
 
83
}
 
84
 
 
85
#endif
 
86
#endif