2017-03-26 23:03:02 +00:00
# ifndef NETINC_INCLUDED
# define NETINC_INCLUDED
2005-11-29 13:12:45 +00:00
2014-03-30 08:55:06 +00:00
# ifndef HAVE_PACKET
2012-04-09 19:12:12 +00:00
2017-03-27 21:45:45 +00:00
# ifndef _XBOX
2019-08-03 01:58:03 +00:00
// struct sockaddr
// {
// short sa_family;
// };
2017-03-27 21:45:45 +00:00
# define ntohs BigShort
# define htons BigShort
# define htonl BigLong
# define ntohl BigLong
# endif
2012-04-09 19:12:12 +00:00
/* struct sockaddr_in
{
short sin_family ;
unsigned short sin_port ;
in_addr sin_addr ;
} ; */
# define AF_UNSPEC 0
// #define AF_INET 1
/*NaCl engines cannot host servers. Regular FTE servers can use the same listening tcpconnect socket to host a websocket connection*/
# define AF_WEBSOCK 342
struct sockaddr_websocket
{
short sws_family ;
char url [ 64 ] ;
} ;
2017-03-27 21:45:45 +00:00
2014-03-30 08:55:06 +00:00
2012-04-09 19:12:12 +00:00
# elif defined(_WIN32)
2017-03-26 23:03:02 +00:00
# ifdef _XBOX
# include <xtl.h>
# include <WinSockX.h>
# else
2019-04-16 22:40:05 +00:00
# if defined(_MSC_VER) && defined(HAVE_LEGACY)
2018-09-23 19:35:24 +00:00
# define HAVE_IPX
2017-03-26 23:03:02 +00:00
# endif
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include <winsock2.h>
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2017-03-26 23:03:02 +00:00
# include "wsipx.h"
# endif
# include <ws2tcpip.h>
2005-11-30 01:20:53 +00:00
# endif
2010-12-18 21:30:16 +00:00
# include <errno.h>
2017-03-26 23:03:02 +00:00
# if !defined(IPPROTO_IPV6) && !defined(_XBOX)
2010-11-10 02:02:56 +00:00
/*for msvc6*/
2012-09-30 05:52:03 +00:00
# define IPPROTO_IPV6 41
2010-11-11 09:06:36 +00:00
# ifndef EAI_NONAME
# define EAI_NONAME 8
# endif
2008-05-25 01:11:20 +00:00
struct ip6_scope_id
{
union
{
struct
{
u_long Zone : 28 ;
u_long Level : 4 ;
} ;
u_long Value ;
} ;
} ;
2010-11-11 09:06:36 +00:00
2013-11-21 23:02:28 +00:00
# if !defined(in_addr6)
2017-03-26 23:03:02 +00:00
struct in6_addr
2008-05-25 01:11:20 +00:00
{
2017-03-26 23:03:02 +00:00
u_char s6_addr [ 16 ] ; /* IPv6 address */
} ;
# define sockaddr_in6 sockaddr_in6_fixed /*earlier versions of msvc have a sockaddr_in6 which does _not_ match windows, so this *must* be redefined for any non-final msvc releases or it won't work at all*/
typedef struct sockaddr_in6
{
short sin6_family ;
u_short sin6_port ;
u_long sin6_flowinfo ;
struct in6_addr sin6_addr ;
union
{
u_long sin6_scope_id ;
struct ip6_scope_id sin6_scope_struct ;
} ;
} ;
struct addrinfo
{
int ai_flags ;
int ai_family ;
int ai_socktype ;
int ai_protocol ;
size_t ai_addrlen ;
char * ai_canonname ;
struct sockaddr * ai_addr ;
struct addrinfo * ai_next ;
2008-05-25 01:11:20 +00:00
} ;
2010-11-11 09:06:36 +00:00
# endif
2005-11-30 01:20:53 +00:00
# endif
2011-12-05 15:23:40 +00:00
# ifndef IPV6_V6ONLY
# define IPV6_V6ONLY 27
# endif
2017-03-26 23:03:02 +00:00
# define HAVE_IPV4
# ifdef IPPROTO_IPV6
# define HAVE_IPV6
# endif
2019-08-03 02:28:31 +00:00
# ifndef SOCK_CLOEXEC
# define SOCK_CLOEXEC 0
# endif
2005-11-29 13:12:45 +00:00
# else
2013-07-15 09:55:27 +00:00
# include <sys/time.h>
2005-11-30 01:20:53 +00:00
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
2005-12-02 01:14:20 +00:00
# include <netinet/tcp.h>
2005-11-30 01:20:53 +00:00
# include <netdb.h>
# include <sys/ioctl.h>
# include <sys/uio.h>
# include <arpa/inet.h>
# include <errno.h>
2005-11-29 13:12:45 +00:00
2005-11-30 01:20:53 +00:00
# include <unistd.h>
2005-11-29 13:12:45 +00:00
2005-11-30 01:20:53 +00:00
# ifdef sun
# include <sys/filio.h>
# endif
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
# include <sys/un.h>
# endif
2005-11-30 01:20:53 +00:00
# ifdef NeXT
# include <libc.h>
# endif
2020-02-26 00:37:52 +00:00
# ifdef __linux__
//requires linux 2.6.27 up (and equivelent libc)
//note that BSD does tend to support the api, but emulated.
//this works around the select FD limit, and supposedly has better performance.
# include <sys/epoll.h>
2020-03-07 09:00:40 +00:00
# ifdef EPOLL_CLOEXEC
# define HAVE_EPOLL
//#else too old, probably android...
# endif
2020-02-26 00:37:52 +00:00
# endif
2005-11-30 01:20:53 +00:00
# if defined(__MORPHOS__) && !defined(ixemul)
# define closesocket CloseSocket
# define ioctlsocket IoctlSocket
# else
# define closesocket close
# define ioctlsocket ioctl
# endif
2005-11-29 13:12:45 +00:00
2017-03-26 23:03:02 +00:00
# if defined(AF_INET)
# define HAVE_IPV4
# endif
2018-09-23 19:35:24 +00:00
# if defined(AF_INET6)
2017-03-26 23:03:02 +00:00
# define HAVE_IPV6
2012-02-29 20:54:22 +00:00
# endif
2019-04-16 22:40:05 +00:00
// #if defined(AF_IPX) && defined(HAVE_LEGACY)
2018-09-23 19:35:24 +00:00
// #include <netipx/ipx.h>
// #define HAVE_IPX
// #endif
2010-03-19 03:45:11 +00:00
# define SOCKET int
2019-08-03 02:28:31 +00:00
# ifndef SOCK_CLOEXEC
# define SOCK_CLOEXEC 0
# endif
2005-11-29 13:12:45 +00:00
# endif
# if defined(_WIN32)
2014-02-07 08:38:40 +00:00
# define neterrno() WSAGetLastError()
//this madness is because winsock defines its own errors instead of using system error codes.
//*AND* microsoft then went and defined names for all the unix ones too... with different values! oh the insanity of it all!
2020-02-26 00:37:52 +00:00
# define NET_EINTR WSAEINTR
2014-02-07 08:38:40 +00:00
# define NET_EWOULDBLOCK WSAEWOULDBLOCK
# define NET_EINPROGRESS WSAEINPROGRESS
# define NET_EMSGSIZE WSAEMSGSIZE
# define NET_ECONNRESET WSAECONNRESET
# define NET_ECONNABORTED WSAECONNABORTED
# define NET_ECONNREFUSED WSAECONNREFUSED
2016-07-12 00:40:13 +00:00
# define NET_ETIMEDOUT WSAETIMEDOUT
2014-02-07 08:38:40 +00:00
# define NET_ENOTCONN WSAENOTCONN
# define NET_EACCES WSAEACCES
# define NET_EADDRNOTAVAIL WSAEADDRNOTAVAIL
2018-03-07 20:31:09 +00:00
# define NET_ENETUNREACH WSAENETUNREACH
2014-02-07 08:38:40 +00:00
# define NET_EAFNOSUPPORT WSAEAFNOSUPPORT
2005-11-29 13:12:45 +00:00
# elif defined(__MORPHOS__) && !defined(ixemul)
2014-02-07 08:38:40 +00:00
# define neterrno() Errno()
2005-11-29 13:12:45 +00:00
# else
2014-02-07 08:38:40 +00:00
# define neterrno() errno
# endif
# ifndef NET_EWOULDBLOCK
//assume unix codes instead, so our prefix still works.
2020-02-26 00:37:52 +00:00
# define NET_EINTR EINTR
2014-02-07 08:38:40 +00:00
# define NET_EWOULDBLOCK EWOULDBLOCK
# define NET_EINPROGRESS EINPROGRESS
# define NET_EMSGSIZE EMSGSIZE
# define NET_ECONNRESET ECONNRESET
# define NET_ECONNABORTED ECONNABORTED
# define NET_ECONNREFUSED ECONNREFUSED
2014-05-16 17:45:37 +00:00
# define NET_ETIMEDOUT ETIMEDOUT
2014-02-07 08:38:40 +00:00
# define NET_ENOTCONN ENOTCONN
# define NET_EACCES EACCES
# define NET_EADDRNOTAVAIL EADDRNOTAVAIL
2018-03-07 20:31:09 +00:00
# define NET_ENETUNREACH ENETUNREACH
2014-02-07 08:38:40 +00:00
# define NET_EAFNOSUPPORT EAFNOSUPPORT
2005-11-29 13:12:45 +00:00
# endif
# ifndef INVALID_SOCKET
2005-11-30 01:20:53 +00:00
# define INVALID_SOCKET -1
2005-11-29 13:12:45 +00:00
# endif
2005-12-31 13:33:10 +00:00
# ifndef INADDR_LOOPBACK
# define INADDR_LOOPBACK 0x7f000001
# endif
2013-04-02 05:18:17 +00:00
# if defined(FTE_TARGET_WEB)
2018-09-23 19:35:24 +00:00
# undef HAVE_IPV4
# undef HAVE_IPV6
# undef HAVE_IPX
2013-04-02 05:18:17 +00:00
# endif
2013-06-23 02:17:02 +00:00
# if 1 //def SUPPORT_ICE
2013-06-29 16:01:07 +00:00
struct icecandinfo_s
2013-06-23 02:17:02 +00:00
{
2013-06-29 16:01:07 +00:00
char candidateid [ 64 ] ;
char addr [ 64 ] ; //v4/v6/fqdn. fqdn should prefer ipv6
2020-02-11 18:06:10 +00:00
int port ; //native endian...
2013-06-23 02:17:02 +00:00
int transport ; //0=udp. other values not supported
int foundation ; //to figure out...
int component ; //1-based. allows rtp+rtcp in a single ICE... we only support one.
int priority ; //some random value...
enum
{
ICE_HOST = 0 ,
2013-11-21 23:02:28 +00:00
ICE_SRFLX = 1 , //Server Reflexive (from stun, etc)
ICE_PRFLX = 2 , //Peer Reflexive
2013-06-23 02:17:02 +00:00
ICE_RELAY = 3 ,
} type ; //says what sort of proxy is used.
2013-06-29 16:01:07 +00:00
char reladdr [ 64 ] ; //when proxied, this is our local info
2013-06-23 02:17:02 +00:00
int relport ;
int generation ; //for ice restarts. starts at 0.
int network ; //which network device this comes from.
} ;
2013-06-29 16:01:07 +00:00
enum iceproto_e
2013-06-23 02:17:02 +00:00
{
2013-06-29 16:01:07 +00:00
ICEP_INVALID , //not allowed..
ICEP_QWSERVER , //we're server side
ICEP_QWCLIENT , //we're client side
2013-11-21 23:02:28 +00:00
ICEP_VOICE , //speex. requires client.
ICEP_VIDEO //err... REALLY?!?!?
2013-06-29 16:01:07 +00:00
} ;
enum icemode_e
{
ICEM_RAW , //not actually interactive beyond a simple handshake.
ICEM_ICE //rfc5245. meant to be able to holepunch, but not implemented properly yet.
} ;
enum icestate_e
{
ICE_INACTIVE , //idle.
ICE_FAILED ,
ICE_CONNECTING , //exchanging pings.
ICE_CONNECTED //media is flowing, supposedly. sending keepalives.
2013-06-23 02:17:02 +00:00
} ;
2013-06-29 16:01:07 +00:00
struct icestate_s ;
# define ICE_API_CURRENT "Internet Connectivity Establishment 0.0"
typedef struct
{
2016-07-12 00:40:13 +00:00
struct icestate_s * ( QDECL * ICE_Create ) ( void * module , const char * conname , const char * peername , enum icemode_e mode , enum iceproto_e proto ) ; //doesn't start pinging anything.
2016-02-15 06:01:17 +00:00
qboolean ( QDECL * ICE_Set ) ( struct icestate_s * con , const char * prop , const char * value ) ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
qboolean ( QDECL * ICE_Get ) ( struct icestate_s * con , const char * prop , char * value , size_t valuesize ) ;
2013-06-29 16:01:07 +00:00
struct icecandinfo_s * ( QDECL * ICE_GetLCandidateInfo ) ( struct icestate_s * con ) ; //retrieves candidates that need reporting to the peer.
void ( QDECL * ICE_AddRCandidateInfo ) ( struct icestate_s * con , struct icecandinfo_s * cand ) ; //stuff that came from the peer.
void ( QDECL * ICE_Close ) ( struct icestate_s * con ) ; //bye then.
void ( QDECL * ICE_CloseModule ) ( void * module ) ; //closes all unclosed connections, with warning.
2016-07-12 00:40:13 +00:00
// struct icestate_s *(QDECL *ICE_Find)(void *module, const char *conname);
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
qboolean ( QDECL * ICE_GetLCandidateSDP ) ( struct icestate_s * con , char * out , size_t valuesize ) ; //retrieves candidates that need reporting to the peer.
2013-06-29 16:01:07 +00:00
} icefuncs_t ;
extern icefuncs_t iceapi ;
2013-07-31 00:20:16 +00:00
# endif
2013-11-21 23:02:28 +00:00
2020-02-26 00:37:52 +00:00
# ifdef HAVE_EPOLL
typedef struct epollctx_s
{
void ( * Polled ) ( struct epollctx_s * ctx , unsigned int events ) ;
} epollctx_t ;
# endif
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
//address flags
2014-02-07 08:38:40 +00:00
# define ADDR_NATPMP (1u<<0)
# define ADDR_UPNPIGP (1u<<1)
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
# define ADDR_REFLEX (1u<<2) //as reported by some external server.
2013-11-21 23:02:28 +00:00
# define FTENET_ADDRTYPES 2
typedef struct ftenet_generic_connection_s {
char name [ MAX_QPATH ] ;
2020-02-11 18:06:10 +00:00
int ( * GetLocalAddresses ) ( struct ftenet_generic_connection_s * con , unsigned int * adrflags , netadr_t * addresses , const char * * adrparams , int maxaddresses ) ;
qboolean ( * ChangeLocalAddress ) ( struct ftenet_generic_connection_s * con , const char * addressstring , netadr_t * newadr ) ;
2013-11-21 23:02:28 +00:00
qboolean ( * GetPacket ) ( struct ftenet_generic_connection_s * con ) ;
2016-07-12 00:40:13 +00:00
neterr_t ( * SendPacket ) ( struct ftenet_generic_connection_s * con , int length , const void * data , netadr_t * to ) ;
2013-11-21 23:02:28 +00:00
void ( * Close ) ( struct ftenet_generic_connection_s * con ) ;
2020-02-26 00:37:52 +00:00
# if defined(HAVE_PACKET) && !defined(HAVE_EPOLL)
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
int ( * SetFDSets ) ( struct ftenet_generic_connection_s * con , fd_set * readfdset , fd_set * writefdset ) ; /*set for connections which have multiple sockets (ie: listening tcp connections)*/
2013-11-21 23:02:28 +00:00
# endif
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
void ( * PrintStatus ) ( struct ftenet_generic_connection_s * con ) ;
2013-11-21 23:02:28 +00:00
2020-02-26 00:37:52 +00:00
netproto_t prot ; //if there's some special weirdness
netadrtype_t addrtype [ FTENET_ADDRTYPES ] ; //which address families it accepts
2013-11-21 23:02:28 +00:00
qboolean islisten ;
2020-02-26 00:37:52 +00:00
int connum ;
struct ftenet_connections_s * owner ;
# ifdef HAVE_EPOLL
epollctx_t epoll ;
# endif
2013-11-21 23:02:28 +00:00
# ifdef HAVE_PACKET
SOCKET thesocket ;
# else
int thesocket ;
# endif
} ftenet_generic_connection_t ;
2017-05-18 10:24:09 +00:00
# ifdef HAVE_DTLS
2017-06-21 01:24:25 +00:00
typedef struct dtlsfuncs_s
{
void * ( * CreateContext ) ( const char * remotehost , void * cbctx , neterr_t ( * push ) ( void * cbctx , const qbyte * data , size_t datasize ) , qboolean isserver ) ; //if remotehost is null then their certificate will not be validated.
void ( * DestroyContext ) ( void * ctx ) ;
neterr_t ( * Transmit ) ( void * ctx , const qbyte * data , size_t datasize ) ;
neterr_t ( * Received ) ( void * ctx , qbyte * data , size_t datasize ) ;
neterr_t ( * Timeouts ) ( void * ctx ) ;
2018-11-19 06:37:25 +00:00
void ( * GetPeerCertificate ) ( void * ctx ) ;
2017-06-21 01:24:25 +00:00
} dtlsfuncs_t ;
const dtlsfuncs_t * DTLS_InitServer ( void ) ;
const dtlsfuncs_t * DTLS_InitClient ( void ) ;
2018-10-23 07:09:06 +00:00
# endif
2017-06-21 01:24:25 +00:00
# ifdef HAVE_WINSSPI
2018-10-23 07:09:06 +00:00
vfsfile_t * SSPI_OpenVFS ( const char * hostname , vfsfile_t * source , qboolean isserver ) ;
int SSPI_GetChannelBinding ( vfsfile_t * vf , qbyte * binddata , size_t * bindsize ) ;
2017-06-21 01:24:25 +00:00
const dtlsfuncs_t * SSPI_DTLS_InitServer ( void ) ; //returns NULL if there's no cert available.
const dtlsfuncs_t * SSPI_DTLS_InitClient ( void ) ; //should always return something, if implemented.
# endif
# ifdef HAVE_GNUTLS
2018-10-23 07:09:06 +00:00
vfsfile_t * GNUTLS_OpenVFS ( const char * hostname , vfsfile_t * source , qboolean isserver ) ;
int GNUTLS_GetChannelBinding ( vfsfile_t * vf , qbyte * binddata , size_t * bindsize ) ;
2017-06-21 01:24:25 +00:00
const dtlsfuncs_t * GNUDTLS_InitServer ( void ) ; //returns NULL if there's no cert available.
const dtlsfuncs_t * GNUDTLS_InitClient ( void ) ; //should always return something, if implemented.
# endif
2018-10-23 07:09:06 +00:00
# ifdef HAVE_OPENSSL
vfsfile_t * OSSL_OpenVFS ( const char * hostname , vfsfile_t * source , qboolean isserver ) ;
int OSSL_GetChannelBinding ( vfsfile_t * vf , qbyte * binddata , size_t * bindsize ) ;
const dtlsfuncs_t * OSSL_InitServer ( void ) ; //returns NULL if there's no cert available.
const dtlsfuncs_t * OSSL_InitClient ( void ) ; //should always return something, if implemented.
2017-05-18 10:24:09 +00:00
# endif
2013-11-21 23:02:28 +00:00
# define MAX_CONNECTIONS 8
typedef struct ftenet_connections_s
{
qboolean islisten ;
2014-07-02 03:20:40 +00:00
unsigned int packetsin ;
unsigned int packetsout ;
unsigned int bytesin ;
unsigned int bytesout ;
unsigned int timemark ;
float packetsinrate ;
float packetsoutrate ;
float bytesinrate ;
float bytesoutrate ;
2013-11-21 23:02:28 +00:00
ftenet_generic_connection_t * conn [ MAX_CONNECTIONS ] ;
2017-05-18 10:24:09 +00:00
2020-02-26 00:37:52 +00:00
void ( * ReadGamePacket ) ( void ) ;
2017-05-18 10:24:09 +00:00
# ifdef HAVE_DTLS
struct dtlspeer_s * dtls ; //linked list. linked lists are shit, but at least it keeps pointers valid when things are resized.
2017-06-21 01:24:25 +00:00
const dtlsfuncs_t * dtlsfuncs ;
2017-05-18 10:24:09 +00:00
# endif
2017-11-15 12:38:20 +00:00
struct ftenet_delayed_packet_s
{
unsigned int sendtime ; //in terms of Sys_Milliseconds()
struct ftenet_delayed_packet_s * next ;
netadr_t dest ;
size_t cursize ;
qbyte data [ 1 ] ;
} * delayed_packets ;
2013-11-21 23:02:28 +00:00
} ftenet_connections_t ;
void ICE_Tick ( void ) ;
2018-12-28 00:04:36 +00:00
qboolean ICE_WasStun ( ftenet_connections_t * col ) ;
2013-11-21 23:02:28 +00:00
void QDECL ICE_AddLCandidateConn ( ftenet_connections_t * col , netadr_t * addr , int type ) ;
void QDECL ICE_AddLCandidateInfo ( struct icestate_s * con , netadr_t * adr , int adrno , int type ) ;
2020-02-26 00:37:52 +00:00
ftenet_generic_connection_t * FTENET_ICE_EstablishConnection ( ftenet_connections_t * col , const char * address , netadr_t adr ) ;
2020-02-11 18:06:10 +00:00
enum icemsgtype_s
{ //shared by rtcpeers+broker
ICEMSG_PEERDROP = 0 , //other side dropped connection
ICEMSG_GREETING = 1 , //master telling us our unique game name
ICEMSG_NEWPEER = 2 , //relay established, send an offer now.
ICEMSG_OFFER = 3 , //peer's initial details
ICEMSG_CANDIDATE = 4 , //candidate updates. may arrive late as new ones are discovered.
ICEMSG_ACCEPT = 5 , //go go go (response from offer)
ICEMSG_SERVERINFO = 6 , //server->broker (for advertising the server properly)
ICEMSG_SERVERUPDATE = 7 , //broker->browser (for querying available server lists)
} ;
enum websocketpackettype_e
{ //websocket packet types, used by both our tcp/http/broker/etc server and our ice client.
WS_PACKETTYPE_CONTINUATION = 0 ,
WS_PACKETTYPE_TEXTFRAME = 1 ,
WS_PACKETTYPE_BINARYFRAME = 2 ,
WS_PACKETTYPE_CLOSE = 8 ,
WS_PACKETTYPE_PING = 9 ,
WS_PACKETTYPE_PONG = 10 ,
} ;
2013-11-21 23:02:28 +00:00
2020-02-26 00:37:52 +00:00
ftenet_connections_t * FTENET_CreateCollection ( qboolean listen , void ( * ReadPacket ) ( void ) ) ;
2013-11-21 23:02:28 +00:00
void FTENET_CloseCollection ( ftenet_connections_t * col ) ;
2017-06-21 01:24:25 +00:00
qboolean FTENET_AddToCollection ( struct ftenet_connections_s * col , const char * name , const char * address , netadrtype_t addrtype , netproto_t addrprot ) ;
2020-02-11 18:06:10 +00:00
int NET_EnumerateAddresses ( ftenet_connections_t * collection , struct ftenet_generic_connection_s * * con , unsigned int * adrflags , netadr_t * addresses , const char * * adrparams , int maxaddresses ) ;
2014-02-07 08:38:40 +00:00
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
void * TLS_GetKnownCertificate ( const char * certname , size_t * size ) ;
2017-05-18 10:24:09 +00:00
vfsfile_t * FS_OpenSSL ( const char * hostname , vfsfile_t * source , qboolean server ) ;
2017-09-20 11:27:13 +00:00
int TLS_GetChannelBinding ( vfsfile_t * stream , qbyte * data , size_t * datasize ) ; //datasize should be preinitialised to the max length allowed. -1 for not implemented. 0 for peer problems. 1 for success
2014-03-30 08:55:06 +00:00
# ifdef HAVE_PACKET
2020-02-26 00:37:52 +00:00
vfsfile_t * FS_WrapTCPSocket ( SOCKET socket , qboolean conpending , const char * peername ) ; //conpending allows us to reject any writes until the connection has succeeded. considers the socket owned (so be sure to stop using the direct socket at least before the VFS_CLOSE call).
2014-03-30 08:55:06 +00:00
# endif
vfsfile_t * FS_OpenTCP ( const char * name , int defaultport ) ;
2016-07-12 00:40:13 +00:00
2017-03-26 23:03:02 +00:00
# endif //NETINC_INCLUDED