blob: c2ff023645dea7a5daa026c38941c9fd007e944e [file] [log] [blame]
Pierre Ossman2137f4f2012-07-03 14:52:26 +00001/* Copyright (C) 2012 Pierre Ossman for Cendio AB
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18
19#ifndef __RDR_TLSERRNO_H__
20#define __RDR_TLSERRNO_H__
21
22#ifdef HAVE_CONFIG_H
23#include <config.h>
24#endif
25
26#ifdef HAVE_GNUTLS
27
28#include <errno.h>
29
30namespace rdr {
31
32 static inline void gnutls_errno_helper(gnutls_session session, int _errno)
33 {
34#if defined(HAVE_GNUTLS_SET_ERRNO)
35 gnutls_transport_set_errno(session, _errno);
36#elif defined(HAVE_GNUTLS_SET_GLOBAL_ERRNO)
37 gnutls_transport_set_global_errno(_errno);
38#else
39 errno = _errno;
40#endif
41 }
42};
43
44#endif
45
46#endif