LCOV - code coverage report
Current view: top level - builds/gnutls/coverage/gnutls-git/lib - system.h (source / functions) Hit Total Coverage
Test: GnuTLS-3.6.14 Code Coverage Lines: 6 6 100.0 %
Date: 2020-10-30 04:50:48 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (C) 2010-2016 Free Software Foundation, Inc.
       3             :  * Copyright (C) 2016 Red Hat, Inc.
       4             :  *
       5             :  * Author: Nikos Mavrogiannopoulos
       6             :  *
       7             :  * This file is part of GnuTLS.
       8             :  *
       9             :  * The GnuTLS is free software; you can redistribute it and/or
      10             :  * modify it under the terms of the GNU Lesser General Public License
      11             :  * as published by the Free Software Foundation; either version 2.1 of
      12             :  * the License, or (at your option) any later version.
      13             :  *
      14             :  * This library is distributed in the hope that it will be useful, but
      15             :  * WITHOUT ANY WARRANTY; without even the implied warranty of
      16             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      17             :  * Lesser General Public License for more details.
      18             :  *
      19             :  * You should have received a copy of the GNU Lesser General Public License
      20             :  * along with this program.  If not, see <https://www.gnu.org/licenses/>
      21             :  *
      22             :  */
      23             : 
      24             : #ifndef GNUTLS_LIB_SYSTEM_H
      25             : #define GNUTLS_LIB_SYSTEM_H
      26             : 
      27             : #include "gnutls_int.h"
      28             : #include <time.h>
      29             : #include <sys/time.h>
      30             : 
      31             : #ifdef _WIN32
      32             : # if defined(__MINGW32__) && !defined(__MINGW64__) && __MINGW32_MAJOR_VERSION <= 3 && __MINGW32_MINOR_VERSION <= 20
      33             : #  define NEED_CERT_ENUM_CRLS
      34             : typedef PCCRL_CONTEXT WINAPI(*CertEnumCRLsInStoreFunc) (HCERTSTORE
      35             :                                                          hCertStore,
      36             :                                                          PCCRL_CONTEXT
      37             :                                                          pPrevCrlContext);
      38             : extern CertEnumCRLsInStoreFunc pCertEnumCRLsInStore;
      39             : # else
      40             : #  define pCertEnumCRLsInStore CertEnumCRLsInStore
      41             : # endif
      42             : #include <windows.h>              /* for Sleep */
      43             : #else
      44             : #include <sys/uio.h>              /* for writev */
      45             : #endif
      46             : 
      47             : #ifdef _POSIX_PATH_MAX
      48             : # define GNUTLS_PATH_MAX _POSIX_PATH_MAX
      49             : #else
      50             : # define GNUTLS_PATH_MAX 256
      51             : #endif
      52             : 
      53             : int system_errno(gnutls_transport_ptr_t);
      54             : 
      55             : #ifdef _WIN32
      56             : ssize_t system_write(gnutls_transport_ptr_t ptr, const void *data,
      57             :                      size_t data_size);
      58             : #else
      59             : #define HAVE_WRITEV
      60             : ssize_t system_writev(gnutls_transport_ptr_t ptr, const giovec_t * iovec,
      61             :                       int iovec_cnt);
      62             : ssize_t system_writev_nosignal(gnutls_transport_ptr_t ptr, const giovec_t * iovec,
      63             :                       int iovec_cnt);
      64             : ssize_t system_writev_tfo(gnutls_session_t ptr, const giovec_t * iovec,
      65             :                       int iovec_cnt);
      66             : ssize_t system_writev_nosignal_tfo(gnutls_session_t ptr, const giovec_t * iovec,
      67             :                       int iovec_cnt);
      68             : #endif
      69             : ssize_t system_read(gnutls_transport_ptr_t ptr, void *data,
      70             :                     size_t data_size);
      71             : 
      72             : #if defined(_WIN32)
      73             : # define HAVE_WIN32_LOCKS
      74             : #elif defined(HAVE_LIBPTHREAD) || defined(HAVE_PTHREAD_MUTEX_LOCK)
      75             : # define HAVE_PTHREAD_LOCKS
      76             : #else
      77             : # define HAVE_NO_LOCKS
      78             : #endif
      79             : 
      80             : typedef void (*gnutls_gettime_func) (struct timespec *);
      81             : 
      82             : extern gnutls_time_func gnutls_time;
      83             : extern gnutls_gettime_func gnutls_gettime;
      84             : 
      85        2421 : static inline void millisleep(unsigned int ms)
      86             : {
      87             : #ifdef _WIN32
      88             :         Sleep(ms);
      89             : #else
      90        2421 :         struct timespec ts;
      91             : 
      92        2421 :         ts.tv_sec = 0;
      93        2421 :         ts.tv_nsec = ms * 1000 * 1000;
      94             : 
      95        2421 :         nanosleep(&ts, NULL);
      96             : #endif
      97        2421 : }
      98             : 
      99             : int _gnutls_find_config_path(char *path, size_t max_size);
     100             : int _gnutls_ucs2_to_utf8(const void *data, size_t size,
     101             :                          gnutls_datum_t * output, unsigned bigendian);
     102             : int _gnutls_utf8_to_ucs2(const void *data, size_t size,
     103             :                          gnutls_datum_t * output, unsigned be);
     104             : 
     105             : void _gnutls_global_set_gettime_function(gnutls_gettime_func gettime_func);
     106             : 
     107             : int gnutls_system_global_init(void);
     108             : void gnutls_system_global_deinit(void);
     109             : 
     110             : #endif /* GNUTLS_LIB_SYSTEM_H */

Generated by: LCOV version 1.14