"Fossies" - the Fresh Open Source Software Archive

Member "openvpn-2.4.7/src/openvpn/occ-inline.h" (20 Feb 2019, 2576 Bytes) of package /windows/misc/openvpn-2.4.7.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "occ-inline.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.4.4_vs_2.4.5.

    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 */