tunsafe-clang15/tunsafe_types.h
Ludvig Strigeus cf92ac7a0c Updates for TunSafe 1.4-rc1
1.Subfolders in the Config/ directory now show up as submenus.
2.Added a way to run TunSafe as a Windows Service.
  Foreground Mode: The service will disconnect when TunSafe closes.
  Background Mode: The service will stay connected in the background.
  No longer required to run the TunSafe client as Admin as long as
  the service is running.
3.New config setting [Interface].ExcludedIPs to configure IPs that
  should not be routed through TunSafe.
4.Can now automatically start TunSafe when Windows starts
5.New UI with tabs and graphs
6.Cache DNS queries to ensure DNS will succeed if connection fails
7.Recreate tray icon when explorer.exe restarts
8.Renamed window title to TunSafe instead of TunSafe VPN Client
9.Main window is now resizable
10.Disallow roaming endpoint when using AllowedIPs=0.0.0.0/0
   Only the original endpoint is added in the routing table so
   this would result in an endless loop of packets.
11.Display approximate Wireguard framing overhead in stats
12.Preparations for protocol handling with multiple threads
13.Delete the routes we made when disconnecting
14.Fix error message about unable to delete a route when connecting
2018-08-12 03:30:06 +02:00

74 lines
1.8 KiB
C

// SPDX-License-Identifier: AGPL-1.0-only
// Copyright (C) 2018 Ludvig Strigeus <info@tunsafe.com>. All Rights Reserved.
#ifndef TINYVPN_TYPES_H_
#define TINYVPN_TYPES_H_
#include <stdint.h>
#include "build_config.h"
#include "tunsafe_config.h"
typedef uint8_t byte;
typedef uint8_t uint8;
typedef uint16_t uint16;
typedef uint32_t uint32;
typedef uint64_t uint64;
typedef int64_t int64;
typedef int8_t int8;
typedef int16_t int16;
typedef int32_t int32;
typedef unsigned int in_addr_t;
#define CTASTR2(pre,post) pre ## post
#define CTASTR(pre,post) CTASTR2(pre,post)
#define STATIC_ASSERT(cond,msg) \
typedef struct { int CTASTR(static_assertion_failed_,msg) : !!(cond); } \
CTASTR(static_assertion_failed_x_,msg)
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#endif
void printhex(const char *name, const void *a, size_t l);
#if defined(COMPILER_MSVC)
#define FORCEINLINE __forceinline
#define NOINLINE __declspec(noinline)
#define SAFEBUFFERS __declspec(safebuffers)
#define __aligned(x) __declspec(align(x))
#define rol32 _rotl
#define rol64 _rotl64
#elif defined(COMPILER_GCC)
#define FORCEINLINE inline __attribute__((always_inline))
#define NOINLINE
#define SAFEBUFFERS
#define _stricmp strcasecmp
#define _strdup strdup
#define _cdecl
#define __aligned(x) __attribute__((__aligned__(x)))
#else
#define FORCEINLINE inline
#define NOINLINE
#define SAFEBUFFERS
#define __aligned(x)
#endif
#define likely(x) (x)
#define unlikely(x) (x)
#if !defined(COMPILER_MSVC)
static inline uint64 rol64(uint64 x, int8_t r) {
return (x << r) | (x >> (64 - r));
}
static inline uint32 rol32(uint32 x, int8_t r) {
return (x << r) | (x >> (32 - r));
}
#endif // !defined(COMPILER_MSVC)
void RERROR(const char *msg, ...);
void RINFO(const char *msg, ...);
void tunsafe_die(const char *msg);
#endif // TINYVPN_TYPES_H_