2004-08-21 01:25:48 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
2005-07-03 15:16:20 +00:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
2004-08-21 01:25:48 +00:00
See the GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
// net_wins.c
# include "quakedef.h"
2005-11-29 13:32:15 +00:00
# include "netinc.h"
2018-09-23 19:35:24 +00:00
# include <stddef.h>
# ifdef UNIXSOCKETS
# include <sys/stat.h> //to delete the file/socket.
# endif
//try to be slightly cleaner about the protocols that'll get killed.
# ifdef TCPCONNECT
# define NP_STREAM_OR_INVALID NP_STREAM
# define NP_TLS_OR_INVALID NP_TLS
# define NP_WS_OR_INVALID NP_WS
# define NP_WSS_OR_INVALID NP_WSS
# else
# define NP_STREAM_OR_INVALID NP_INVALID
# define NP_TLS_OR_INVALID NP_INVALID
# define NP_WS_OR_INVALID NP_INVALID
# define NP_WSS_OR_INVALID NP_INVALID
# endif
# define NP_DTLS_OR_INVALID NP_DTLS
# ifndef HAVE_SSL
# undef NP_WSS_OR_INVALID
# define NP_WSS_OR_INVALID NP_INVALID
# undef NP_TLS_OR_INVALID
# define NP_TLS_OR_INVALID NP_INVALID
# undef NP_DTLS_OR_INVALID
# define NP_DTLS_OR_INVALID NP_INVALID
# endif
2004-08-21 01:25:48 +00:00
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
extern ftemanifest_t * fs_manifest ;
2017-03-27 21:45:45 +00:00
// Eww, eww. This is hacky but so is netinc.h, so bite me
# ifdef _XBOX
struct sockaddr
{
short sa_family ;
} ;
# define ntohs BigShort
# define htons BigShort
# define htonl BigLong
# define ntohl BigLong
# endif
2015-06-14 08:16:15 +00:00
# if defined(_WIN32) || defined(__linux__) && !defined(ANDROID)
2019-02-16 19:09:07 +00:00
# define USE_GETHOSTNAME_LOCALLISTING
2012-10-18 15:20:00 +00:00
# endif
2012-04-09 19:12:12 +00:00
2011-10-27 16:16:29 +00:00
netadr_t net_local_cl_ipadr ; //still used to match local ui requests (quake/gamespy), and to generate ip reports for q3 servers (which is probably pointless).
2004-08-21 01:25:48 +00:00
netadr_t net_from ;
sizebuf_t net_message ;
//#define MAX_UDP_PACKET (MAX_MSGLEN*2) // one more than msg + header
# define MAX_UDP_PACKET 8192 // one more than msg + header
2016-07-12 00:40:13 +00:00
//emscripten can misalign stuff, which is a problem when the leading int is checked directly in a few places. gah.
FTE_ALIGN ( 4 ) qbyte net_message_buffer [ MAX_OVERALLMSGLEN ] ;
2014-03-30 08:55:06 +00:00
# if defined(_WIN32) && defined(HAVE_PACKET)
2019-02-16 19:09:07 +00:00
WSADATA winsockdata ;
2004-08-21 01:25:48 +00:00
# endif
2019-02-16 19:09:07 +00:00
# if defined(_WIN32)
2019-07-19 02:13:19 +00:00
# define getaddrinfo pgetaddrinfo
# define freeaddrinfo pfreeaddrinfo
# define getnameinfo pgetnameinfo
static int ( WSAAPI * getaddrinfo ) (
2019-02-16 19:09:07 +00:00
const char * nodename ,
const char * servname ,
const struct addrinfo * hints ,
struct addrinfo * * res
) ;
2019-07-19 02:13:19 +00:00
static void ( WSAAPI * freeaddrinfo ) ( struct addrinfo * ) ;
static int ( WSAAPI * getnameinfo ) ( const struct sockaddr * addr , socklen_t addrlen , char * host , socklen_t hostlen , char * serv , socklen_t servlen , int flags ) ;
2004-08-21 01:25:48 +00:00
# endif
2018-12-28 00:04:36 +00:00
# if defined(HAVE_IPV4) && defined(HAVE_SERVER)
2019-02-16 19:09:07 +00:00
# define HAVE_NATPMP
2012-04-09 19:12:12 +00:00
# endif
2013-03-31 04:21:08 +00:00
2019-05-23 15:11:32 +00:00
//#if !defined(HAVE_SERVER) && !defined(MASTERONLY)
// #undef HAVE_HTTPSV
//#endif
2018-12-28 00:04:36 +00:00
2013-03-31 04:21:08 +00:00
void NET_GetLocalAddress ( int socket , netadr_t * out ) ;
//int TCP_OpenListenSocket (const char *localip, int port);
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
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 UDP6_OpenSocket ( int port ) ;
2006-05-09 00:02:05 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2006-05-09 00:02:05 +00:00
void IPX_CloseSocket ( int socket ) ;
# endif
2018-10-23 07:09:06 +00:00
cvar_t timeout = CVARD ( " timeout " , " 65 " , " Connections will time out if no packets are received for this duration of time. " ) ; // seconds without any message
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
cvar_t net_hybriddualstack = CVARD ( " net_hybriddualstack " , " 1 " , " Uses hybrid ipv4+ipv6 sockets where possible. Not supported on xp or below. " ) ;
cvar_t net_fakeloss = CVARFD ( " net_fakeloss " , " 0 " , CVAR_CHEAT , " Simulates packetloss in both receiving and sending, on a scale from 0 to 1. " ) ;
2019-02-16 19:09:07 +00:00
static cvar_t net_dns_ipv4 = CVARD ( " net_dns_ipv4 " , " 1 " , " If 0, disables dns resolution of names to ipv4 addresses (removing any associated error messages). Also hides ipv4 addresses in address:port listings. " ) ;
static cvar_t net_dns_ipv6 = CVARD ( " net_dns_ipv6 " , " 1 " , " If 0, disables dns resolution of names to ipv6 addresses (removing any associated error messages). Also hides ipv6 addresses in address:port listings. " ) ;
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
cvar_t net_enabled = CVARD ( " net_enabled " , " 1 " , " If 0, disables all network access, including name resolution and socket creation. Does not affect loopback/internal connections. " ) ;
2019-06-05 20:48:06 +00:00
# if defined(HAVE_SSL)
cvar_t tls_ignorecertificateerrors = CVARFD ( " tls_ignorecertificateerrors " , " 0 " , CVAR_NOTFROMSERVER | CVAR_NOSAVE | CVAR_NOUNSAFEEXPAND | CVAR_NOSET , " This should NEVER be set to 1! " ) ;
# endif
2018-12-28 00:04:36 +00:00
# if defined(TCPCONNECT) && (defined(HAVE_SERVER) || defined(HAVE_HTTPSV))
# ifdef HAVE_SERVER
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
cvar_t net_enable_qizmo = CVARD ( " net_enable_qizmo " , " 1 " , " Enables compatibility with qizmo's tcp connections serverside. Frankly, using sv_port_tcp without this is a bit pointless. " ) ;
cvar_t net_enable_qtv = CVARD ( " net_enable_qtv " , " 1 " , " Listens for qtv proxies, or clients using the qtvplay command. " ) ;
2018-12-28 00:04:36 +00:00
# endif
2018-10-23 07:09:06 +00:00
# if defined(HAVE_SSL)
2017-05-18 10:24:09 +00:00
cvar_t net_enable_tls = CVARD ( " net_enable_tls " , " 1 " , " If enabled, binary data sent to a non-tls tcp port will be interpretted as a tls handshake (enabling https or wss over the same tcp port. " ) ;
2018-10-23 07:09:06 +00:00
# endif
2019-05-23 15:11:32 +00:00
# ifdef HAVE_HTTPSV
2018-12-28 00:04:36 +00:00
# ifdef SV_MASTER
2019-07-29 05:28:20 +00:00
cvar_t net_enable_http = CVARD ( " net_enable_http " , " 1 " , " If enabled, tcp ports will accept inbound http clients, potentially serving large files which could distrupt gameplay (This does not affect outgoing http(s) requests). " ) ;
2018-12-28 00:04:36 +00:00
# else
2019-07-29 05:28:20 +00:00
cvar_t net_enable_http = CVARD ( " net_enable_http " , " 0 " , " If enabled, tcp ports will accept inbound http clients, potentially serving large files which could distrupt gameplay (This does not affect outgoing http(s) requests). " ) ;
2018-12-28 00:04:36 +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
cvar_t net_enable_websockets = CVARD ( " net_enable_websockets " , " 1 " , " If enabled, tcp ports will accept websocket game clients. " ) ;
2018-06-02 08:55:57 +00:00
cvar_t net_enable_webrtcbroker = CVARD ( " net_enable_webrtcbroker " , " 0 " , " If 1, tcp ports will accept websocket connections from clients trying to broker direct webrtc connections. This should be low traffic, but might involve a lot of mostly-idle connections. " ) ;
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
# endif
2019-05-23 15:11:32 +00:00
# endif
2018-12-28 00:04:36 +00:00
# if defined(HAVE_DTLS) && defined(HAVE_SERVER)
2018-03-24 04:02:09 +00:00
static void QDECL NET_Enable_DTLS_Changed ( struct cvar_s * var , char * oldvalue )
{
//set up the default value
if ( ! * var - > string )
var - > ival = 0 ; //FIXME: change to 1 then 2 when better tested.
if ( var - > ival & & svs . sockets )
{
if ( ! svs . sockets - > dtlsfuncs )
svs . sockets - > dtlsfuncs = DTLS_InitServer ( ) ;
if ( ! svs . sockets - > dtlsfuncs )
{
if ( var - > ival > = 2 )
Con_Printf ( " %sUnable to set %s to \" %s \" , no DTLS certificate available. \n " , ( var - > ival > = 2 ) ? CON_ERROR : CON_WARNING , var - > name , var - > string ) ;
var - > ival = 0 ; //disable the cvar (internally) if we don't have a usable certificate. this allows us to default the cvar to enabled without it breaking otherwise.
}
}
}
2019-08-24 16:09:08 +00:00
cvar_t net_enable_dtls = CVARAFCD ( " net_enable_dtls " , " " , " sv_listen_dtls " , 0 , NET_Enable_DTLS_Changed , " Controls serverside dtls support. \n 0: dtls blocked, not advertised. \n 1: clientside choice. \n 2: used where possible (recommended setting). \n 3: disallow non-dtls clients (sv_port_tcp should be eg tls://[::]:27500 to also disallow unencrypted tcp connections). " ) ;
2018-03-24 04:02:09 +00:00
# endif
2017-12-28 16:24:50 +00:00
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2018-03-04 14:41:16 +00:00
static void QDECL cl_delay_packets_Announce ( cvar_t * var , char * oldval )
2017-12-28 16:24:50 +00:00
{
if ( cls . state > = ca_connected & & cl . fpd & FPD_ANOUNCE_FAKE_LAG )
Cbuf_AddText ( va ( " say Fake lag now %ims \n " , var - > ival ) , RESTRICT_LOCAL ) ;
}
static cvar_t cl_delay_packets = CVARCD ( " cl_delay_packets " , " 0 " , cl_delay_packets_Announce , " Extra latency, in milliseconds. " ) ;
# endif
2004-08-21 01:25:48 +00:00
2017-05-18 10:24:09 +00:00
extern cvar_t sv_public , sv_listen_qw , sv_listen_nq , sv_listen_dp ;
# ifdef QWOVERQ3
extern cvar_t sv_listen_q3 ;
# endif
2004-08-21 01:25:48 +00:00
2014-03-30 08:55:06 +00:00
# define MAX_LOOPBACK 64
2004-08-21 01:25:48 +00:00
typedef struct
{
2014-03-30 08:55:06 +00:00
qbyte * data ;
2004-08-21 01:25:48 +00:00
int datalen ;
2014-03-30 08:55:06 +00:00
int datamax ;
2004-08-21 01:25:48 +00:00
} loopmsg_t ;
typedef struct
{
2013-03-31 04:21:08 +00:00
qboolean inited ;
2004-08-21 01:25:48 +00:00
loopmsg_t msgs [ MAX_LOOPBACK ] ;
int get , send ;
} loopback_t ;
loopback_t loopbacks [ 2 ] ;
2017-05-18 10:24:09 +00:00
# ifdef HAVE_DTLS
static neterr_t FTENET_DTLS_SendPacket ( ftenet_connections_t * col , int length , const void * data , netadr_t * to ) ;
# endif
2017-11-15 12:38:20 +00:00
static neterr_t NET_SendPacketCol ( ftenet_connections_t * collection , int length , const void * data , netadr_t * to ) ;
2017-05-18 10:24:09 +00:00
2004-08-21 01:25:48 +00:00
//=============================================================================
2005-11-30 01:20:53 +00:00
int NetadrToSockadr ( netadr_t * a , struct sockaddr_qstorage * s )
2004-08-21 01:25:48 +00:00
{
switch ( a - > type )
{
2012-04-09 19:12:12 +00:00
# ifdef HAVE_WEBSOCKCL
case NA_WEBSOCKET :
memset ( s , 0 , sizeof ( struct sockaddr_websocket ) ) ;
( ( struct sockaddr_websocket * ) s ) - > sws_family = AF_WEBSOCK ;
memcpy ( ( ( struct sockaddr_websocket * ) s ) - > url , a - > address . websocketurl , sizeof ( ( ( struct sockaddr_websocket * ) s ) - > url ) ) ;
return sizeof ( struct sockaddr_websocket ) ;
# endif
# ifdef HAVE_IPV4
2004-08-21 01:25:48 +00:00
case NA_IP :
memset ( s , 0 , sizeof ( struct sockaddr_in ) ) ;
( ( struct sockaddr_in * ) s ) - > sin_family = AF_INET ;
2006-02-17 02:51:59 +00:00
* ( int * ) & ( ( struct sockaddr_in * ) s ) - > sin_addr = * ( int * ) & a - > address . ip ;
2004-08-21 01:25:48 +00:00
( ( struct sockaddr_in * ) s ) - > sin_port = a - > port ;
2005-11-30 01:20:53 +00:00
return sizeof ( struct sockaddr_in ) ;
2012-04-09 19:12:12 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2004-08-21 01:25:48 +00:00
case NA_IPV6 :
2008-05-25 01:07:53 +00:00
memset ( s , 0 , sizeof ( struct sockaddr_in6 ) ) ;
2004-08-21 01:25:48 +00:00
( ( struct sockaddr_in6 * ) s ) - > sin6_family = AF_INET6 ;
2006-02-17 02:51:59 +00:00
memcpy ( & ( ( struct sockaddr_in6 * ) s ) - > sin6_addr , a - > address . ip6 , sizeof ( struct in6_addr ) ) ;
2004-08-21 01:25:48 +00:00
( ( struct sockaddr_in6 * ) s ) - > sin6_port = a - > port ;
2014-06-16 16:21:28 +00:00
( ( struct sockaddr_in6 * ) s ) - > sin6_scope_id = a - > scopeid ;
2005-11-30 01:20:53 +00:00
return sizeof ( struct sockaddr_in6 ) ;
2004-08-21 01:25:48 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2004-08-21 01:25:48 +00:00
case NA_IPX :
2018-09-23 19:35:24 +00:00
# ifdef _WIN32
2004-08-21 01:25:48 +00:00
( ( struct sockaddr_ipx * ) s ) - > sa_family = AF_IPX ;
2006-02-17 02:51:59 +00:00
memcpy ( ( ( struct sockaddr_ipx * ) s ) - > sa_netnum , & a - > address . ipx [ 0 ] , 4 ) ;
memcpy ( ( ( struct sockaddr_ipx * ) s ) - > sa_nodenum , & a - > address . ipx [ 4 ] , 6 ) ;
2004-08-21 01:25:48 +00:00
( ( struct sockaddr_ipx * ) s ) - > sa_socket = a - > port ;
2018-09-23 19:35:24 +00:00
# else
( ( struct sockaddr_ipx * ) s ) - > sipx_family = AF_IPX ;
memcpy ( & ( ( struct sockaddr_ipx * ) s ) - > sipx_network , & a - > address . ipx [ 0 ] , 4 ) ;
memcpy ( ( ( struct sockaddr_ipx * ) s ) - > sipx_node , & a - > address . ipx [ 4 ] , 6 ) ;
( ( struct sockaddr_ipx * ) s ) - > sipx_port = a - > port ;
# endif
2005-11-30 01:20:53 +00:00
return sizeof ( struct sockaddr_ipx ) ;
2018-09-23 19:35:24 +00:00
# endif
# ifdef UNIXSOCKETS
case NA_UNIX :
{
struct sockaddr_un * un = ( struct sockaddr_un * ) s ;
un - > sun_family = AF_UNIX ;
memcpy ( un - > sun_path , a - > address . un . path , a - > address . un . len ) ;
return offsetof ( struct sockaddr_un , sun_path ) + a - > address . un . len ;
}
2004-08-21 01:25:48 +00:00
# endif
default :
2014-10-11 19:39:45 +00:00
Sys_Error ( " NetadrToSockadr: Bad type %i " , a - > type ) ;
2005-11-30 01:20:53 +00:00
return 0 ;
2004-08-21 01:25:48 +00:00
}
}
2018-09-23 19:35:24 +00:00
void SockadrToNetadr ( struct sockaddr_qstorage * s , int sizeofsockaddr , netadr_t * a )
2004-08-21 01:25:48 +00:00
{
2019-08-03 01:58:03 +00:00
# ifndef HAVE_PACKET
memset ( a , 0 , sizeof ( * a ) ) ;
a - > type = NA_INVALID ;
# else
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
a - > scopeid = 0 ;
2008-11-09 22:29:28 +00:00
a - > connum = 0 ;
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
a - > prot = NP_DGRAM ;
2008-11-09 22:29:28 +00:00
2018-09-23 19:35:24 +00:00
if ( sizeofsockaddr < offsetof ( struct sockaddr , sa_family ) + sizeof ( ( ( struct sockaddr * ) s ) - > sa_family ) )
{ //truncated far too much...
memset ( a , 0 , sizeof ( * a ) ) ;
a - > type = NA_INVALID ;
return ;
}
2005-01-29 02:26:42 +00:00
switch ( ( ( struct sockaddr * ) s ) - > sa_family )
2004-08-21 01:25:48 +00:00
{
2012-04-09 19:12:12 +00:00
# ifdef HAVE_WEBSOCKCL
case AF_WEBSOCK :
a - > type = NA_WEBSOCKET ;
memcpy ( a - > address . websocketurl , ( ( struct sockaddr_websocket * ) s ) - > url , sizeof ( a - > address . websocketurl ) ) ;
a - > port = 0 ;
break ;
# endif
# ifdef HAVE_IPV4
2004-08-21 01:25:48 +00:00
case AF_INET :
a - > type = NA_IP ;
2006-02-17 02:51:59 +00:00
* ( int * ) & a - > address . ip = ( ( struct sockaddr_in * ) s ) - > sin_addr . s_addr ;
2004-08-21 01:25:48 +00:00
a - > port = ( ( struct sockaddr_in * ) s ) - > sin_port ;
break ;
2012-04-09 19:12:12 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2004-08-21 01:25:48 +00:00
case AF_INET6 :
a - > type = NA_IPV6 ;
2006-02-17 02:51:59 +00:00
memcpy ( & a - > address . ip6 , & ( ( struct sockaddr_in6 * ) s ) - > sin6_addr , sizeof ( a - > address . ip6 ) ) ;
2004-08-21 01:25:48 +00:00
a - > port = ( ( struct sockaddr_in6 * ) s ) - > sin6_port ;
2014-06-16 16:21:28 +00:00
a - > scopeid = ( ( struct sockaddr_in6 * ) s ) - > sin6_scope_id ;
2004-08-21 01:25:48 +00:00
break ;
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2004-08-21 01:25:48 +00:00
case AF_IPX :
a - > type = NA_IPX ;
2006-02-17 02:51:59 +00:00
* ( int * ) a - > address . ip = 0xffffffff ;
2018-09-23 19:35:24 +00:00
# ifdef _WIN32
2006-02-17 02:51:59 +00:00
memcpy ( & a - > address . ipx [ 0 ] , ( ( struct sockaddr_ipx * ) s ) - > sa_netnum , 4 ) ;
memcpy ( & a - > address . ipx [ 4 ] , ( ( struct sockaddr_ipx * ) s ) - > sa_nodenum , 6 ) ;
2004-08-21 01:25:48 +00:00
a - > port = ( ( struct sockaddr_ipx * ) s ) - > sa_socket ;
2018-09-23 19:35:24 +00:00
# else
memcpy ( & a - > address . ipx [ 0 ] , & ( ( struct sockaddr_ipx * ) s ) - > sipx_network , 4 ) ;
memcpy ( & a - > address . ipx [ 4 ] , ( ( struct sockaddr_ipx * ) s ) - > sipx_node , 6 ) ;
a - > port = ( ( struct sockaddr_ipx * ) s ) - > sipx_port ;
# endif
break ;
# endif
# ifdef UNIXSOCKETS
case AF_UNIX :
{
struct sockaddr_un * un = ( struct sockaddr_un * ) s ;
a - > type = NA_UNIX ;
a - > address . un . len = sizeofsockaddr - offsetof ( struct sockaddr_un , sun_path ) ;
memcpy ( a - > address . un . path , un - > sun_path , a - > address . un . len ) ;
if ( a - > address . un . len & & a - > address . un . path )
a - > address . un . len = strnlen ( a - > address . un . path , a - > address . un . len ) ;
a - > port = 0 ;
}
2004-08-21 01:25:48 +00:00
break ;
# endif
2012-03-19 06:30:41 +00:00
default :
Con_Printf ( " SockadrToNetadr: bad socket family - %i " , ( ( struct sockaddr * ) s ) - > sa_family ) ;
2004-08-21 01:25:48 +00:00
case AF_UNSPEC :
memset ( a , 0 , sizeof ( * a ) ) ;
a - > type = NA_INVALID ;
break ;
}
2019-08-03 01:58:03 +00:00
# endif
2004-08-21 01:25:48 +00:00
}
2018-09-23 19:35:24 +00:00
char * NET_SockadrToString ( char * s , int len , struct sockaddr_qstorage * a , size_t sizeofa )
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
{
netadr_t na ;
2018-09-23 19:35:24 +00:00
SockadrToNetadr ( a , sizeofa , & na ) ;
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
return NET_AdrToString ( s , len , & na ) ;
}
qboolean NET_AddrIsReliable ( netadr_t * adr ) //hints that the protocol is reliable. if so, we don't need to wait for acks
{
switch ( adr - > prot )
{
case NP_DGRAM :
case NP_DTLS :
case NP_NATPMP :
default :
return false ;
case NP_STREAM :
case NP_TLS :
case NP_WS :
case NP_WSS :
return true ;
}
}
2004-08-21 01:25:48 +00:00
2013-05-03 04:28:08 +00:00
qboolean NET_CompareAdr ( netadr_t * a , netadr_t * b )
2004-08-21 01:25:48 +00:00
{
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
if ( a - > prot ! = b - > prot )
return false ;
2013-05-03 04:28:08 +00:00
if ( a - > type ! = b - > type )
2013-03-31 04:21:08 +00:00
{
int i ;
2019-08-24 16:09:08 +00:00
if ( a - > port ! = b - > port )
return false ;
2013-05-03 04:28:08 +00:00
if ( a - > type = = NA_IP & & b - > type = = NA_IPV6 )
2013-03-31 04:21:08 +00:00
{
for ( i = 0 ; i < 10 ; i + + )
2013-05-03 04:28:08 +00:00
if ( b - > address . ip6 [ i ] ! = 0 )
2013-03-31 04:21:08 +00:00
return false ; //only matches if they're 0s, otherwise its not an ipv4 address there
for ( ; i < 12 ; i + + )
2014-08-03 14:47:47 +00:00
if ( b - > address . ip6 [ i ] ! = 0xff ) // && b->address.ip6[i] != 0x00) //0x00 is depricated
2013-03-31 04:21:08 +00:00
return false ; //only matches if they're 0s or ffs, otherwise its not an ipv4 address there
for ( i = 0 ; i < 4 ; i + + )
{
2013-05-03 04:28:08 +00:00
if ( a - > address . ip [ i ] ! = b - > address . ip6 [ 12 + i ] )
2013-03-31 04:21:08 +00:00
return false ; //mask doesn't match
}
return true ; //its an ipv4 address in there, the mask matched the whole way through
}
2013-05-03 04:28:08 +00:00
if ( a - > type = = NA_IPV6 & & b - > type = = NA_IP )
2013-03-31 04:21:08 +00:00
{
for ( i = 0 ; i < 10 ; i + + )
2013-05-03 04:28:08 +00:00
if ( a - > address . ip6 [ i ] ! = 0 )
2013-03-31 04:21:08 +00:00
return false ; //only matches if they're 0s, otherwise its not an ipv4 address there
for ( ; i < 12 ; i + + )
2014-08-03 14:47:47 +00:00
if ( a - > address . ip6 [ i ] ! = 0xff ) // && a->address.ip6[i] != 0x00) //0x00 is depricated
2013-03-31 04:21:08 +00:00
return false ; //only matches if they're 0s or ffs, otherwise its not an ipv4 address there
for ( i = 0 ; i < 4 ; i + + )
{
2013-05-03 04:28:08 +00:00
if ( a - > address . ip6 [ 12 + i ] ! = b - > address . ip [ i ] )
2013-03-31 04:21:08 +00:00
return false ; //mask doesn't match
}
return true ; //its an ipv4 address in there, the mask matched the whole way through
}
2004-08-21 01:25:48 +00:00
return false ;
2013-03-31 04:21:08 +00:00
}
2004-08-21 01:25:48 +00:00
2013-05-03 04:28:08 +00:00
if ( a - > type = = NA_LOOPBACK )
2004-08-21 01:25:48 +00:00
return true ;
2012-04-09 19:12:12 +00:00
# ifdef HAVE_WEBSOCKCL
2013-05-07 19:36:42 +00:00
if ( a - > type = = NA_WEBSOCKET )
2012-04-09 19:12:12 +00:00
{
2013-05-07 19:36:42 +00:00
if ( ! strcmp ( a - > address . websocketurl , a - > address . websocketurl ) & & a - > port = = b - > port )
2012-04-09 19:12:12 +00:00
return true ;
return false ;
}
# endif
# ifdef HAVE_IPV4
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
if ( a - > type = = NA_IP )
2004-08-21 01:25:48 +00:00
{
2013-05-03 04:28:08 +00:00
if ( ( memcmp ( a - > address . ip , b - > address . ip , sizeof ( a - > address . ip ) ) = = 0 ) & & a - > port = = b - > port )
2004-08-21 01:25:48 +00:00
return true ;
return false ;
}
2012-04-09 19:12:12 +00:00
# endif
2004-08-21 01:25:48 +00:00
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
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
if ( a - > type = = NA_IPV6 )
2004-08-21 01:25:48 +00:00
{
2013-05-03 04:28:08 +00:00
if ( ( memcmp ( a - > address . ip6 , b - > address . ip6 , sizeof ( a - > address . ip6 ) ) = = 0 ) & & a - > port = = b - > port )
2004-08-21 01:25:48 +00:00
return true ;
return false ;
}
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
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
if ( a - > type = = NA_IPX )
2004-08-21 01:25:48 +00:00
{
2013-05-03 04:28:08 +00:00
if ( ( memcmp ( a - > address . ipx , b - > address . ipx , sizeof ( a - > address . ipx ) ) = = 0 ) & & a - > port = = b - > port )
2004-08-21 01:25:48 +00:00
return true ;
return false ;
}
2008-11-13 08:55:41 +00:00
# endif
2004-08-21 01:25:48 +00:00
2008-11-09 22:29:28 +00:00
# ifdef IRCCONNECT
2013-05-03 04:28:08 +00:00
if ( a - > type = = NA_IRC )
2008-11-09 22:29:28 +00:00
{
2013-05-03 04:28:08 +00:00
if ( ! strcmp ( a - > address . irc . user , b - > address . irc . user ) )
2008-11-09 22:29:28 +00:00
return true ;
return false ;
}
# endif
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
if ( a - > type = = NA_UNIX )
{
if ( a - > address . un . len = = b - > address . un . len & & ! memcmp ( a - > address . un . path , b - > address . un . path , a - > address . un . len ) )
return true ;
return false ;
}
# endif
2015-07-09 18:02:49 +00:00
Con_Printf ( " NET_CompareAdr: Bad address type \n " ) ;
2004-08-21 01:25:48 +00:00
return false ;
}
2018-06-18 16:44:29 +00:00
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = = = = = = = = =
NET_CompareBaseAdr
Compares without the port
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
( udp / tcp / etc must still match )
2004-08-21 01:25:48 +00:00
= = = = = = = = = = = = = = = = = = =
*/
2013-05-03 04:28:08 +00:00
qboolean NET_CompareBaseAdr ( netadr_t * a , netadr_t * b )
2004-08-21 01:25:48 +00:00
{
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
if ( a - > prot ! = b - > prot )
return false ;
2013-05-03 04:28:08 +00:00
if ( a - > type ! = b - > type )
2004-08-21 01:25:48 +00:00
return false ;
2013-05-03 04:28:08 +00:00
if ( a - > type = = NA_LOOPBACK )
2004-08-21 01:25:48 +00:00
return true ;
2012-04-09 19:12:12 +00:00
# ifdef HAVE_IPV4
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
if ( a - > type = = NA_IP )
2004-08-21 01:25:48 +00:00
{
2013-05-03 04:28:08 +00:00
if ( ( memcmp ( a - > address . ip , b - > address . ip , sizeof ( a - > address . ip ) ) = = 0 ) )
2004-08-21 01:25:48 +00:00
return true ;
return false ;
}
2012-04-09 19:12:12 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
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
if ( a - > type = = NA_IPV6 )
2004-08-21 01:25:48 +00:00
{
2013-05-03 04:28:08 +00:00
if ( ( memcmp ( a - > address . ip6 , b - > address . ip6 , 16 ) = = 0 ) )
2004-08-21 01:25:48 +00:00
return true ;
return false ;
}
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2013-05-03 04:28:08 +00:00
if ( a - > type = = NA_IPX )
2004-08-21 01:25:48 +00:00
{
2013-05-03 04:28:08 +00:00
if ( ( memcmp ( a - > address . ipx , b - > address . ipx , 10 ) = = 0 ) )
2004-08-21 01:25:48 +00:00
return true ;
return false ;
}
2008-11-13 08:55:41 +00:00
# endif
2008-11-09 22:29:28 +00:00
# ifdef IRCCONNECT
2013-05-03 04:28:08 +00:00
if ( a - > type = = NA_IRC )
2008-11-09 22:29:28 +00:00
{
2013-05-03 04:28:08 +00:00
if ( ! strcmp ( a - > address . irc . user , b - > address . irc . user ) )
2008-11-09 22:29:28 +00:00
return true ;
return false ;
}
# endif
2004-08-21 01:25:48 +00:00
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
# ifdef HAVE_WEBSOCKCL
if ( a - > type = = NA_WEBSOCKET )
{
if ( ! strcmp ( a - > address . websocketurl , b - > address . websocketurl ) )
return true ;
return false ;
}
# endif
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
if ( a - > type = = NA_UNIX )
{
if ( a - > address . un . len = = b - > address . un . len & & ! memcmp ( a - > address . un . path , b - > address . un . path , a - > address . un . len ) )
return true ;
return false ;
}
# endif
2004-08-21 01:25:48 +00:00
Sys_Error ( " NET_CompareBaseAdr: Bad address type " ) ;
return false ;
}
2013-05-03 04:28:08 +00:00
qboolean NET_AddressSmellsFunny ( netadr_t * a )
2008-05-25 01:07:53 +00:00
{
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2008-05-25 01:07:53 +00:00
int i ;
2012-03-19 06:30:41 +00:00
# endif
2008-05-25 01:07:53 +00:00
//rejects certain blacklisted addresses
2013-05-03 04:28:08 +00:00
switch ( a - > type )
2008-05-25 01:07:53 +00:00
{
2012-04-09 19:12:12 +00:00
# ifdef HAVE_IPV4
2008-05-25 01:07:53 +00:00
case NA_IP :
//reject localhost
2013-05-03 04:28:08 +00:00
if ( a - > address . ip [ 0 ] = = 127 ) // && a->address.ip[1] == 0 && a->address.ip[2] == 0 && a->address.ip[3] == 1 )
2008-05-25 01:07:53 +00:00
return true ;
//'this' network (not an issue, but lets reject it anyway)
2013-05-03 04:28:08 +00:00
if ( a - > address . ip [ 0 ] = = 0 & & a - > address . ip [ 1 ] = = 0 & & a - > address . ip [ 2 ] = = 0 & & a - > address . ip [ 3 ] = = 0 )
2008-05-25 01:07:53 +00:00
return true ;
//reject any broadcasts
2013-05-03 04:28:08 +00:00
if ( a - > address . ip [ 0 ] = = 255 & & a - > address . ip [ 1 ] = = 255 & & a - > address . ip [ 2 ] = = 255 & & a - > address . ip [ 3 ] = = 0 )
2008-05-25 01:07:53 +00:00
return true ;
//not much else I can reject
return false ;
2012-04-09 19:12:12 +00:00
# endif
2008-05-25 01:07:53 +00:00
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2008-05-25 01:07:53 +00:00
case NA_IPV6 :
//reject [::XXXX] (this includes obsolete ipv4-compatible (not ipv4 mapped), and localhost)
for ( i = 0 ; i < 12 ; i + + )
2013-05-03 04:28:08 +00:00
if ( a - > address . ip6 [ i ] )
2008-05-25 01:07:53 +00:00
break ;
if ( i = = 12 )
return true ;
return false ;
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2008-05-25 01:07:53 +00:00
//no idea how this protocol's addresses work
case NA_IPX :
return false ;
# endif
2011-05-15 13:23:13 +00:00
2008-05-25 01:07:53 +00:00
case NA_LOOPBACK :
return false ;
default :
return true ;
}
}
2019-08-03 01:58:03 +00:00
# if (_POSIX_C_SOURCE >= 200112L || defined(getnameinfo)) && defined(HAVE_PACKET)
2015-06-16 23:53:58 +00:00
static void NET_AdrToStringDoResolve ( void * ctx , void * data , size_t a , size_t b )
{
netadr_t * n = data ;
struct sockaddr_qstorage s ;
int ssz ;
char * adrstring = Z_Malloc ( NI_MAXHOST ) ;
2015-06-17 06:42:27 +00:00
void ( * resolved ) ( void * ctx , void * data , size_t a , size_t b ) = * ( void * * ) ( n + 1 ) ;
2015-06-16 23:53:58 +00:00
if ( n - > type = = NA_LOOPBACK )
NET_BaseAdrToString ( adrstring , NI_MAXHOST , n ) ;
else
{
ssz = NetadrToSockadr ( n , & s ) ;
2019-07-19 02:13:19 +00:00
if (
# ifdef getnameinfo
! getnameinfo | |
# endif
getnameinfo ( ( struct sockaddr * ) & s , ssz , adrstring , NI_MAXHOST , NULL , 0 , NI_NUMERICSERV | NI_DGRAM ) )
2015-06-16 23:53:58 +00:00
{
NET_BaseAdrToString ( adrstring , NI_MAXHOST , n ) ;
}
}
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_MAIN , resolved , ctx , adrstring , a , b ) ;
2015-06-16 23:53:58 +00:00
Z_Free ( n ) ;
}
void NET_AdrToStringResolve ( netadr_t * adr , void ( * resolved ) ( void * ctx , void * data , size_t a , size_t b ) , void * ctx , size_t a , size_t b )
{
netadr_t * n = Z_Malloc ( sizeof ( * n ) + sizeof ( void * ) ) ;
* n = * adr ;
* ( void * * ) ( n + 1 ) = resolved ;
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_LOADER , NET_AdrToStringDoResolve , ctx , n , a , b ) ;
2015-06-16 23:53:58 +00:00
}
2019-07-19 02:13:19 +00:00
# else
void NET_AdrToStringResolve ( netadr_t * adr , void ( * resolved ) ( void * ctx , void * data , size_t a , size_t b ) , void * ctx , size_t a , size_t b )
{
2019-07-29 06:32:37 +00:00
char adrstring [ 512 ] ;
2019-07-19 02:13:19 +00:00
NET_BaseAdrToString ( adrstring , countof ( adrstring ) , adr ) ;
resolved ( ctx , Z_StrDup ( adrstring ) , a , b ) ;
}
# endif
2015-06-16 23:53:58 +00:00
2013-05-03 04:28:08 +00:00
char * NET_AdrToString ( char * s , int len , netadr_t * a )
2004-08-21 01:25:48 +00:00
{
2009-06-10 22:36:53 +00:00
char * rs = s ;
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
char * prot = " " ;
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2018-06-18 16:44:29 +00:00
int doneblank ;
2012-03-19 06:30:41 +00:00
# endif
2005-07-03 15:16:20 +00:00
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
switch ( a - > prot )
{
2018-09-23 19:35:24 +00:00
case NP_INVALID : prot = " invalid:// " ; break ;
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
case NP_DGRAM : prot = " " ; break ;
case NP_DTLS : prot = " dtls:// " ; break ;
case NP_STREAM : prot = " tcp:// " ; break ; //not strictly true for ipx, but whatever.
case NP_TLS : prot = " tls:// " ; break ;
case NP_WS : prot = " ws:// " ; break ;
case NP_WSS : prot = " wss:// " ; break ;
case NP_NATPMP : prot = " natpmp:// " ; break ;
}
2013-05-03 04:28:08 +00:00
switch ( a - > type )
2004-08-21 01:25:48 +00:00
{
2012-04-09 19:12:12 +00:00
# ifdef HAVE_WEBSOCKCL
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
case NA_WEBSOCKET : //ws / wss is part of the url
{
char * url = a - > address . websocketurl ;
prot = " " ;
if ( a - > prot = = NP_DTLS & & ! strncmp ( url , " ws:// " , 5 ) )
{
url + = 5 ;
prot = " rtc:// " ;
}
if ( a - > prot = = NP_DTLS & & ! strncmp ( url , " wss:// " , 6 ) )
{
url + = 6 ;
prot = " rtcs:// " ;
}
if ( a - > port )
Q_snprintfz ( s , len , " %s%s#%i " , prot , url , ntohs ( a - > port ) ) ;
else
Q_snprintfz ( s , len , " %s%s " , prot , url ) ;
}
2012-04-09 19:12:12 +00:00
break ;
# endif
# ifdef HAVE_IPV4
2004-08-21 01:25:48 +00:00
case NA_IP :
2013-05-03 04:28:08 +00:00
if ( a - > port )
2010-11-28 19:15:37 +00:00
{
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
Q_snprintfz ( s , len , " %s%i.%i.%i.%i:%i " ,
prot ,
2013-05-03 04:28:08 +00:00
a - > address . ip [ 0 ] ,
a - > address . ip [ 1 ] ,
a - > address . ip [ 2 ] ,
a - > address . ip [ 3 ] ,
ntohs ( a - > port ) ) ;
2010-11-28 19:15:37 +00:00
}
else
{
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
snprintf ( s , len , " %s%i.%i.%i.%i " ,
prot ,
2013-05-03 04:28:08 +00:00
a - > address . ip [ 0 ] ,
a - > address . ip [ 1 ] ,
a - > address . ip [ 2 ] ,
a - > address . ip [ 3 ] ) ;
2010-11-28 19:15:37 +00:00
}
2004-08-21 01:25:48 +00:00
break ;
2012-04-09 19:12:12 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2004-08-21 01:25:48 +00:00
case NA_IPV6 :
2011-12-05 15:23:40 +00:00
{
2016-07-12 00:40:13 +00:00
char * p ;
int i ;
2018-06-18 16:44:29 +00:00
if ( ! * ( int * ) & a - > address . ip6 [ 0 ] & &
2016-07-12 00:40:13 +00:00
! * ( int * ) & a - > address . ip6 [ 4 ] & &
! * ( short * ) & a - > address . ip6 [ 8 ] & &
* ( short * ) & a - > address . ip6 [ 10 ] = = ( short ) 0xffff )
{
if ( a - > port )
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
snprintf ( s , len , " %s%i.%i.%i.%i:%i " ,
prot ,
2016-07-12 00:40:13 +00:00
a - > address . ip6 [ 12 ] ,
a - > address . ip6 [ 13 ] ,
a - > address . ip6 [ 14 ] ,
a - > address . ip6 [ 15 ] ,
ntohs ( a - > port ) ) ;
else
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
snprintf ( s , len , " %s%i.%i.%i.%i " ,
prot ,
2016-07-12 00:40:13 +00:00
a - > address . ip6 [ 12 ] ,
a - > address . ip6 [ 13 ] ,
a - > address . ip6 [ 14 ] ,
a - > address . ip6 [ 15 ] ) ;
break ;
}
* s = 0 ;
doneblank = false ;
p = s ;
2013-05-03 04:28:08 +00:00
if ( a - > port )
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
snprintf ( s , len - strlen ( s ) , " %s[ " , prot ) ;
else
snprintf ( s , len - strlen ( s ) , " %s " , prot ) ;
p + = strlen ( p ) ;
2016-07-12 00:40:13 +00:00
for ( i = 0 ; i < 16 ; i + = 2 )
2008-05-25 01:07:53 +00:00
{
2016-07-12 00:40:13 +00:00
if ( doneblank ! = true & & a - > address . ip6 [ i ] = = 0 & & a - > address . ip6 [ i + 1 ] = = 0 )
2008-05-25 01:07:53 +00:00
{
2016-07-12 00:40:13 +00:00
if ( ! doneblank )
{
snprintf ( p , len - strlen ( s ) , " :: " ) ;
p + = strlen ( p ) ;
doneblank = 2 ;
}
2008-05-25 01:07:53 +00:00
}
else
{
2016-07-12 00:40:13 +00:00
if ( doneblank = = 2 )
doneblank = true ;
else if ( i ! = 0 )
{
snprintf ( p , len - strlen ( s ) , " : " ) ;
p + = strlen ( p ) ;
}
if ( a - > address . ip6 [ i + 0 ] )
{
snprintf ( p , len - strlen ( s ) , " %x%02x " ,
a - > address . ip6 [ i + 0 ] ,
a - > address . ip6 [ i + 1 ] ) ;
}
else
{
snprintf ( p , len - strlen ( s ) , " %x " ,
a - > address . ip6 [ i + 1 ] ) ;
}
p + = strlen ( p ) ;
2008-05-25 01:07:53 +00:00
}
2016-07-12 00:40:13 +00:00
}
if ( a - > scopeid )
{
snprintf ( p , len - strlen ( s ) , " %%%u " ,
a - > scopeid ) ;
2008-05-25 01:07:53 +00:00
p + = strlen ( p ) ;
}
2016-07-12 00:40:13 +00:00
if ( a - > port )
snprintf ( p , len - strlen ( s ) , " ]:%i " ,
ntohs ( a - > port ) ) ;
2014-06-16 16:21:28 +00:00
}
2004-08-21 01:25:48 +00:00
break ;
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2004-08-21 01:25:48 +00:00
case NA_IPX :
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
snprintf ( s , len , " %s%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%i " ,
prot ,
2013-05-03 04:28:08 +00:00
a - > address . ipx [ 0 ] ,
a - > address . ipx [ 1 ] ,
a - > address . ipx [ 2 ] ,
a - > address . ipx [ 3 ] ,
a - > address . ipx [ 4 ] ,
a - > address . ipx [ 5 ] ,
a - > address . ipx [ 6 ] ,
a - > address . ipx [ 7 ] ,
a - > address . ipx [ 8 ] ,
a - > address . ipx [ 9 ] ,
ntohs ( a - > port ) ) ;
2004-08-21 01:25:48 +00:00
break ;
# endif
case NA_LOOPBACK :
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
snprintf ( s , len , " %sQLoopBack:%i " , prot , a - > port ) ;
2004-08-21 01:25:48 +00:00
break ;
2008-11-09 22:29:28 +00:00
# ifdef IRCCONNECT
case NA_IRC :
2013-05-03 04:28:08 +00:00
if ( * a - > address . irc . channel )
snprintf ( s , len , " irc://%s@%s " , a - > address . irc . user , a - > address . irc . channel ) ;
2008-11-09 22:29:28 +00:00
else
2013-05-03 04:28:08 +00:00
snprintf ( s , len , " irc://%s " , a - > address . irc . user ) ;
2008-11-09 22:29:28 +00:00
break ;
# endif
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
case NA_UNIX :
switch ( a - > prot )
{
case NP_DGRAM : prot = " udg:// " ; break ;
case NP_STREAM : prot = " unix:// " ; break ;
default :
snprintf ( s , len , " unix+ " ) ;
len - = strlen ( s ) ;
s + = strlen ( s ) ;
break ;
}
snprintf ( s , len , prot ) ;
len - = strlen ( s ) ;
s + = strlen ( s ) ;
if ( len ) //hopefully this will always be true...
{
char * end = a - > address . un . path + a - > address . un . len , * in ;
char c ;
for ( in = a - > address . un . path ; in < end ; in + + )
{
if ( - - len = = 0 )
break ;
if ( * in = = ' \\ ' ) //ugly encoding
c = ' \\ ' ;
else if ( * in = = ' \0 ' ) //null chars are always a problem. abstract sockets generally get them displayed using @ chars.
{
* s + + = ' @ ' ;
continue ;
}
else if ( * in = = ' @ ' ) //which means actual @ chars need to be escaped
c = ' @ ' ;
//don't screw up from these, either.
else if ( * in = = ' \n ' )
c = ' n ' ;
else if ( * in = = ' \r ' )
c = ' r ' ;
else if ( * in = = ' \t ' )
c = ' t ' ;
//special quake chars can screw up display too
else if ( * in = = ' \1 ' )
c = ' 1 ' ;
else if ( * in = = ' \2 ' )
c = ' 2 ' ;
else if ( * in = = ' \3 ' )
c = ' 3 ' ;
else
{ //as-is.
* s + + = * in ;
continue ;
}
//marked up chars need extra storage.
if ( - - len = = 0 )
break ;
* s + + = ' \\ ' ;
* s + + = c ;
}
* s = 0 ; //and always null terminate the string.
}
break ;
# endif
2004-08-21 01:25:48 +00:00
default :
2008-06-08 20:20:11 +00:00
snprintf ( s , len , " invalid netadr_t type " ) ;
2004-08-21 01:25:48 +00:00
// Sys_Error("NET_AdrToString: Bad netadr_t type");
}
2009-06-10 22:36:53 +00:00
return rs ;
2004-08-21 01:25:48 +00:00
}
2013-05-03 04:28:08 +00:00
char * NET_BaseAdrToString ( char * s , int len , netadr_t * a )
2004-08-21 01:25:48 +00:00
{
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
char * prot = " " ;
switch ( a - > prot )
{
2018-09-23 19:35:24 +00:00
case NP_INVALID : prot = " invalid:// " ; break ;
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
case NP_DGRAM : prot = " " ; break ;
case NP_DTLS : prot = " dtls:// " ; break ;
case NP_STREAM : prot = " tcp:// " ; break ; //not strictly true for ipx, but whatever.
case NP_TLS : prot = " tls:// " ; break ;
case NP_WS : prot = " ws:// " ; break ;
case NP_WSS : prot = " wss:// " ; break ;
case NP_NATPMP : prot = " natpmp:// " ; break ;
}
2013-05-03 04:28:08 +00:00
switch ( a - > type )
2004-08-21 01:25:48 +00:00
{
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
# ifdef HAVE_WEBSOCKCL
case NA_WEBSOCKET : //ws / wss is part of the url
{
char * url = a - > address . websocketurl ;
prot = " " ;
if ( a - > prot = = NP_DTLS & & ! strncmp ( url , " ws:// " , 5 ) )
{
url + = 5 ;
prot = " rtc:// " ;
}
if ( a - > prot = = NP_DTLS & & ! strncmp ( url , " wss:// " , 6 ) )
{
url + = 6 ;
prot = " rtcs:// " ;
}
Q_snprintfz ( s , len , " %s%s " , prot , url ) ;
}
break ;
# endif
2004-08-21 01:25:48 +00:00
case NA_IP :
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
snprintf ( s , len , " %s%i.%i.%i.%i " ,
prot ,
2013-05-03 04:28:08 +00:00
a - > address . ip [ 0 ] ,
a - > address . ip [ 1 ] ,
a - > address . ip [ 2 ] ,
a - > address . ip [ 3 ] ) ;
2004-08-21 01:25:48 +00:00
break ;
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2004-08-21 01:25:48 +00:00
case NA_IPV6 :
2008-05-25 01:07:53 +00:00
{
2016-07-12 00:40:13 +00:00
char * p ;
int i , doneblank ;
2018-06-18 16:44:29 +00:00
if ( ! * ( int * ) & a - > address . ip6 [ 0 ] & &
2016-07-12 00:40:13 +00:00
! * ( int * ) & a - > address . ip6 [ 4 ] & &
! * ( short * ) & a - > address . ip6 [ 8 ] & &
* ( short * ) & a - > address . ip6 [ 10 ] = = ( short ) 0xffff )
2008-05-25 01:07:53 +00:00
{
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
snprintf ( s , len , " %s%i.%i.%i.%i " ,
prot ,
2016-07-12 00:40:13 +00:00
a - > address . ip6 [ 12 ] ,
a - > address . ip6 [ 13 ] ,
a - > address . ip6 [ 14 ] ,
a - > address . ip6 [ 15 ] ) ;
break ;
2008-05-25 01:07:53 +00:00
}
2016-07-12 00:40:13 +00:00
* s = 0 ;
doneblank = false ;
p = s ;
for ( i = 0 ; i < 16 ; i + = 2 )
2008-05-25 01:07:53 +00:00
{
2016-07-12 00:40:13 +00:00
if ( doneblank ! = true & & a - > address . ip6 [ i ] = = 0 & & a - > address . ip6 [ i + 1 ] = = 0 )
2008-05-25 01:07:53 +00:00
{
2016-07-12 00:40:13 +00:00
if ( ! doneblank )
{
snprintf ( p , len - strlen ( s ) , " :: " ) ;
p + = strlen ( p ) ;
doneblank = 2 ;
}
2008-05-25 01:07:53 +00:00
}
else
{
2016-07-12 00:40:13 +00:00
if ( doneblank = = 2 )
doneblank = true ;
else if ( i ! = 0 )
{
snprintf ( p , len - strlen ( s ) , " : " ) ;
p + = strlen ( p ) ;
}
if ( a - > address . ip6 [ i + 0 ] )
{
snprintf ( p , len - strlen ( s ) , " %x%02x " ,
a - > address . ip6 [ i + 0 ] ,
a - > address . ip6 [ i + 1 ] ) ;
}
else
{
snprintf ( p , len - strlen ( s ) , " %x " ,
a - > address . ip6 [ i + 1 ] ) ;
}
p + = strlen ( p ) ;
2008-05-25 01:07:53 +00:00
}
}
}
2004-08-21 01:25:48 +00:00
break ;
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2004-08-21 01:25:48 +00:00
case NA_IPX :
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
snprintf ( s , len , " %s%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x " ,
prot ,
2013-05-03 04:28:08 +00:00
a - > address . ipx [ 0 ] ,
a - > address . ipx [ 1 ] ,
a - > address . ipx [ 2 ] ,
a - > address . ipx [ 3 ] ,
a - > address . ipx [ 4 ] ,
a - > address . ipx [ 5 ] ,
a - > address . ipx [ 6 ] ,
a - > address . ipx [ 7 ] ,
a - > address . ipx [ 8 ] ,
a - > address . ipx [ 9 ] ) ;
2004-08-21 01:25:48 +00:00
break ;
# endif
case NA_LOOPBACK :
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
snprintf ( s , len , " %sQLoopBack " , prot ) ;
2004-08-21 01:25:48 +00:00
break ;
2008-11-09 22:29:28 +00:00
# ifdef IRCCONNECT
case NA_IRC :
2013-05-03 04:28:08 +00:00
NET_AdrToString ( s , len , a ) ;
2008-11-09 22:29:28 +00:00
break ;
# endif
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
case NA_UNIX :
//no ports, so no base paths.
return NET_AdrToString ( s , len , a ) ;
# endif
2004-08-21 01:25:48 +00:00
default :
Sys_Error ( " NET_BaseAdrToString: Bad netadr_t type " ) ;
}
return s ;
}
/*
= = = = = = = = = = = = =
NET_StringToAdr
idnewt
idnewt : 28000
192.246 .40 .70
192.246 .40 .70 : 28000
any form of ipv6 , including port number .
= = = = = = = = = = = = =
*/
2018-09-23 19:35:24 +00:00
size_t NET_StringToSockaddr2 ( const char * s , int defaultport , netadrtype_t afhint , struct sockaddr_qstorage * sadr , int * addrfamily , int * addrsize , size_t addresses )
2004-08-21 01:25:48 +00:00
{
2014-12-23 15:26:42 +00:00
size_t result = 0 ;
2005-07-03 15:16:20 +00:00
2014-12-23 15:26:42 +00:00
if ( ! ( * s ) | | ! addresses )
return result ;
2006-06-17 06:22:48 +00:00
2019-08-03 01:58:03 +00:00
# ifdef WEBCLIENT
2019-06-05 20:48:06 +00:00
//EVIL HACK!
2019-06-17 04:21:41 +00:00
//updates.tth uses a known self-signed certificate (to protect against dns hijacks like fteqw.com suffered).
//its not meant to be used for browsers etc, and I cba to register dns stuff for it.
2019-06-05 20:48:06 +00:00
//besides, browsers/etc would just bitch about its cert, so w/e.
//redirect the dns to the base host without affecting http(s) hosts/certificates.
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
if ( ! strncmp ( s , " updates. " , 8 ) )
{
conchar_t musite [ 256 ] , * e ;
char site [ 256 ] ;
char * oldprefix = " http://fte. " ;
e = COM_ParseFunString ( CON_WHITEMASK , ENGINEWEBSITE , musite , sizeof ( musite ) , false ) ;
COM_DeFunString ( musite , e , site , sizeof ( site ) , true , true ) ;
if ( ! strncmp ( site , oldprefix , strlen ( oldprefix ) ) )
{
if ( ! strcmp ( s + 8 , site + strlen ( oldprefix ) ) )
s + = 8 ;
}
}
2019-08-03 01:58:03 +00:00
# endif
2019-06-05 20:48:06 +00:00
2004-08-21 01:25:48 +00:00
memset ( sadr , 0 , sizeof ( * sadr ) ) ;
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
if ( afhint = = NA_UNIX )
{
struct sockaddr_un * sa = ( struct sockaddr_un * ) sadr ;
int i ;
2019-02-16 19:09:07 +00:00
//limit to known prefixes. this allows for sandboxing.
const char * allowedprefixes [ ] = { " @ " DISTRIBUTION , " /tmp/ " DISTRIBUTION " . " , " /tmp/qsock. " , " @FTE " , " @qtv " , " @qsock " } ;
for ( i = 0 ; i < countof ( allowedprefixes ) ; i + + )
{
if ( ! Q_strncasecmp ( s , allowedprefixes [ i ] , strlen ( allowedprefixes [ i ] ) ) )
break ;
}
if ( i = = countof ( allowedprefixes ) )
{
Con_DPrintf ( CON_WARNING " \" %s \" is not an accepted prefix for a unix socket. Forcing prefix. \n " , s ) ;
i = 0 ;
sa - > sun_path [ i + + ] = 0 ;
sa - > sun_path [ i + + ] = ' q ' ;
sa - > sun_path [ i + + ] = ' s ' ;
sa - > sun_path [ i + + ] = ' o ' ;
sa - > sun_path [ i + + ] = ' c ' ;
sa - > sun_path [ i + + ] = ' k ' ;
}
else i = 0 ;
2018-09-23 19:35:24 +00:00
sa - > sun_family = AF_UNIX ;
2019-02-16 19:09:07 +00:00
//this parsing is so annoying because I want to support abstract sockets too, which have nulls.
//we're using @ charsto represent nulls, to match 'lsof -U'
for ( ; * s & & i < countof ( sa - > sun_path ) ; )
2018-09-23 19:35:24 +00:00
{
if ( * s = = ' @ ' )
{
sa - > sun_path [ i + + ] = 0 ;
s + + ;
}
else if ( * s = = ' \\ ' )
{
if ( s [ 1 ] = = 0 )
2019-02-16 19:09:07 +00:00
{
sa - > sun_path [ i + + ] = ' \\ ' ;
2018-09-23 19:35:24 +00:00
break ; //error.
2019-02-16 19:09:07 +00:00
}
2018-09-23 19:35:24 +00:00
else if ( s [ 1 ] = = ' \\ ' )
sa - > sun_path [ i + + ] = ' \\ ' ;
else if ( s [ 1 ] = = ' @ ' )
sa - > sun_path [ i + + ] = ' @ ' ;
else if ( s [ 1 ] = = ' n ' )
2019-02-16 19:09:07 +00:00
sa - > sun_path [ i + + ] = ' \n ' ;
2018-09-23 19:35:24 +00:00
else if ( s [ 1 ] = = ' r ' )
2019-02-16 19:09:07 +00:00
sa - > sun_path [ i + + ] = ' \r ' ;
2018-09-23 19:35:24 +00:00
else if ( s [ 1 ] = = ' t ' )
2019-02-16 19:09:07 +00:00
sa - > sun_path [ i + + ] = ' \t ' ;
2018-09-23 19:35:24 +00:00
else if ( s [ 1 ] = = ' 1 ' )
2019-02-16 19:09:07 +00:00
sa - > sun_path [ i + + ] = ' \1 ' ;
2018-09-23 19:35:24 +00:00
else if ( s [ 1 ] = = ' 2 ' )
2019-02-16 19:09:07 +00:00
sa - > sun_path [ i + + ] = ' \2 ' ;
2018-09-23 19:35:24 +00:00
else if ( s [ 1 ] = = ' 3 ' )
2019-02-16 19:09:07 +00:00
sa - > sun_path [ i + + ] = ' \3 ' ;
2018-09-23 19:35:24 +00:00
else
sa - > sun_path [ i + + ] = ' ? ' ;
s + = 2 ;
}
else
sa - > sun_path [ i + + ] = * s + + ;
}
2019-02-16 19:09:07 +00:00
if ( sa - > sun_path [ 0 ] ) //'pathname sockets should be null terminated'
sa - > sun_path [ i + + ] = 0 ;
2018-09-23 19:35:24 +00:00
if ( i < countof ( sa - > sun_path ) )
sa - > sun_path [ i ] = ' X ' ;
if ( addrsize )
* addrsize = offsetof ( struct sockaddr_un , sun_path ) + i ;
if ( addrfamily )
* addrfamily = AF_UNIX ;
result + + ;
}
else
# endif
# ifdef HAVE_IPX
2004-08-21 01:25:48 +00:00
if ( ( strlen ( s ) > = 23 ) & & ( s [ 8 ] = = ' : ' ) & & ( s [ 21 ] = = ' : ' ) ) // check for an IPX address
{
unsigned int val ;
2016-07-12 00:40:13 +00:00
char copy [ 128 ] ;
2004-08-21 01:25:48 +00:00
( ( struct sockaddr_ipx * ) sadr ) - > sa_family = AF_IPX ;
2012-11-27 03:23:19 +00:00
# define DO(src,dest) \
copy [ 0 ] = s [ src ] ; \
copy [ 1 ] = s [ src + 1 ] ; \
sscanf ( copy , " %x " , & val ) ; \
( ( struct sockaddr_ipx * ) sadr ) - > dest = val
2004-08-21 01:25:48 +00:00
copy [ 2 ] = 0 ;
DO ( 0 , sa_netnum [ 0 ] ) ;
DO ( 2 , sa_netnum [ 1 ] ) ;
DO ( 4 , sa_netnum [ 2 ] ) ;
DO ( 6 , sa_netnum [ 3 ] ) ;
DO ( 9 , sa_nodenum [ 0 ] ) ;
DO ( 11 , sa_nodenum [ 1 ] ) ;
DO ( 13 , sa_nodenum [ 2 ] ) ;
DO ( 15 , sa_nodenum [ 3 ] ) ;
DO ( 17 , sa_nodenum [ 4 ] ) ;
DO ( 19 , sa_nodenum [ 5 ] ) ;
sscanf ( & s [ 22 ] , " %u " , & val ) ;
2012-11-27 03:23:19 +00:00
# undef DO
2004-08-21 01:25:48 +00:00
( ( struct sockaddr_ipx * ) sadr ) - > sa_socket = htons ( ( unsigned short ) val ) ;
2012-11-27 03:23:19 +00:00
if ( addrfamily )
* addrfamily = AF_IPX ;
if ( addrsize )
* addrsize = sizeof ( struct sockaddr_ipx ) ;
2014-12-23 15:26:42 +00:00
result + + ;
2004-08-21 01:25:48 +00:00
}
else
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2019-07-19 02:13:19 +00:00
# ifdef getaddrinfo
if ( getaddrinfo )
2013-05-11 05:03:07 +00:00
# else
2019-07-19 02:13:19 +00:00
if ( 1 )
2013-05-11 05:03:07 +00:00
# endif
2004-08-21 01:25:48 +00:00
{
2006-04-16 03:55:55 +00:00
struct addrinfo * addrinfo = NULL ;
struct addrinfo * pos ;
2004-08-21 01:25:48 +00:00
struct addrinfo udp6hint ;
int error ;
char * port ;
2004-09-07 23:18:20 +00:00
char dupbase [ 256 ] ;
int len ;
2014-12-23 15:26:42 +00:00
size_t i ;
2016-02-15 06:01:17 +00:00
double restime = Sys_DoubleTime ( ) ;
2011-05-15 13:23:13 +00:00
2004-08-21 01:25:48 +00:00
memset ( & udp6hint , 0 , sizeof ( udp6hint ) ) ;
2018-09-23 19:35:24 +00:00
switch ( afhint )
{
# ifdef HAVE_IPV4
case NA_IP :
udp6hint . ai_family = AF_INET ;
break ;
# endif
# ifdef HAVE_IPV6
case NA_IPV6 :
udp6hint . ai_family = AF_INET6 ;
break ;
# endif
# ifdef HAVE_IPX
case NA_IPX :
udp6hint . ai_family = AF_IPX ;
break ;
# endif
default :
udp6hint . ai_family = 0 ; //Any... we check for AF_INET6 or 4
break ;
}
2004-08-21 01:25:48 +00:00
udp6hint . ai_socktype = SOCK_DGRAM ;
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
udp6hint . ai_protocol = 0 ;
2004-08-21 01:25:48 +00:00
2005-11-30 01:20:53 +00:00
if ( * s = = ' [ ' )
2004-08-21 01:25:48 +00:00
{
2012-11-27 03:23:19 +00:00
port = strstr ( s , " ] " ) ;
2005-11-30 01:20:53 +00:00
if ( ! port )
error = EAI_NONAME ;
else
{
2009-04-01 22:03:56 +00:00
len = port - ( s + 1 ) ;
if ( len > = sizeof ( dupbase ) )
len = sizeof ( dupbase ) - 1 ;
strncpy ( dupbase , s + 1 , len ) ;
dupbase [ len ] = ' \0 ' ;
2019-07-19 02:13:19 +00:00
error = getaddrinfo ( dupbase , ( port [ 1 ] = = ' : ' ) ? port + 2 : NULL , & udp6hint , & addrinfo ) ;
2005-11-30 01:20:53 +00:00
}
2004-08-21 01:25:48 +00:00
}
else
2005-11-30 01:20:53 +00:00
{
2019-02-16 19:09:07 +00:00
# if defined(AI_ADDRCONFIG) && !defined(_WIN32)
udp6hint . ai_flags | = AI_ADDRCONFIG ; //don't return ipv6 if we can't send to ipv6 hosts
# endif
2008-11-09 22:29:28 +00:00
port = strrchr ( s , ' : ' ) ;
2005-11-30 01:20:53 +00:00
if ( port )
{
len = port - s ;
if ( len > = sizeof ( dupbase ) )
len = sizeof ( dupbase ) - 1 ;
strncpy ( dupbase , s , len ) ;
dupbase [ len ] = ' \0 ' ;
2019-07-19 02:13:19 +00:00
error = getaddrinfo ( dupbase , port + 1 , & udp6hint , & addrinfo ) ;
2005-11-30 01:20:53 +00:00
}
else
error = EAI_NONAME ;
if ( error ) //failed, try string with no port.
2019-07-19 02:13:19 +00:00
error = getaddrinfo ( s , NULL , & udp6hint , & addrinfo ) ; //remember, this func will return any address family that could be using the udp protocol... (ip4 or ip6)
2005-11-30 01:20:53 +00:00
}
2016-02-15 06:01:17 +00:00
restime = Sys_DoubleTime ( ) - restime ;
if ( restime > 0.5 )
{ //adding this in an attempt to debug somewhat periodic stalls that I'm being told about.
Con_DPrintf ( " DNS resolution of %s %s %f seconds (on %s thread) \n " , s , error ? " failed after " : " took " , restime , Sys_IsMainThread ( ) ? " main " : " worker " ) ;
}
2004-08-21 01:25:48 +00:00
if ( error )
{
return false ;
}
2005-01-29 02:26:42 +00:00
( ( struct sockaddr * ) sadr ) - > sa_family = 0 ;
2004-08-21 01:25:48 +00:00
for ( pos = addrinfo ; pos ; pos = pos - > ai_next )
{
switch ( pos - > ai_family )
{
case AF_INET6 :
2019-02-16 19:09:07 +00:00
if ( ! net_dns_ipv6 . ival )
continue ;
2014-12-23 15:26:42 +00:00
if ( result < addresses )
memcpy ( & sadr [ result + + ] , pos - > ai_addr , pos - > ai_addrlen ) ;
break ;
2012-04-09 19:12:12 +00:00
# ifdef HAVE_IPV4
2004-08-21 01:25:48 +00:00
case AF_INET :
2019-02-16 19:09:07 +00:00
if ( ! net_dns_ipv4 . ival )
continue ;
//ipv4 addresses have a higher priority than ipv6 ones (too few other quake engines support ipv6).
2014-12-23 15:26:42 +00:00
if ( result & & ( ( struct sockaddr_in * ) & sadr [ 0 ] ) - > sin_family = = AF_INET6 )
{
if ( result < addresses )
memcpy ( & sadr [ result + + ] , & sadr [ 0 ] , sizeof ( sadr [ 0 ] ) ) ;
memcpy ( & sadr [ 0 ] , pos - > ai_addr , pos - > ai_addrlen ) ;
}
else if ( result < addresses )
memcpy ( & sadr [ result + + ] , pos - > ai_addr , pos - > ai_addrlen ) ;
2004-08-21 01:25:48 +00:00
break ;
2012-04-09 19:12:12 +00:00
# endif
2004-08-21 01:25:48 +00:00
}
}
2019-07-19 02:13:19 +00:00
freeaddrinfo ( addrinfo ) ;
2012-11-27 03:23:19 +00:00
2014-12-23 15:26:42 +00:00
for ( i = 0 ; i < result ; i + + )
2012-11-27 03:23:19 +00:00
{
2014-12-23 15:26:42 +00:00
if ( addrfamily )
addrfamily [ i ] = ( ( struct sockaddr * ) sadr ) - > sa_family ;
2018-06-18 16:44:29 +00:00
2014-12-23 15:26:42 +00:00
if ( ( ( struct sockaddr * ) & sadr [ i ] ) - > sa_family = = AF_INET )
{
if ( ! ( ( struct sockaddr_in * ) & sadr [ i ] ) - > sin_port )
( ( struct sockaddr_in * ) & sadr [ i ] ) - > sin_port = htons ( defaultport ) ;
if ( addrsize )
addrsize [ i ] = sizeof ( struct sockaddr_in ) ;
}
else if ( ( ( struct sockaddr * ) & sadr [ i ] ) - > sa_family = = AF_INET6 )
{
if ( ! ( ( struct sockaddr_in6 * ) & sadr [ i ] ) - > sin6_port )
( ( struct sockaddr_in6 * ) & sadr [ i ] ) - > sin6_port = htons ( defaultport ) ;
if ( addrsize )
addrsize [ i ] = sizeof ( struct sockaddr_in6 ) ;
}
2012-11-27 03:23:19 +00:00
}
2004-08-21 01:25:48 +00:00
}
else
# endif
{
2019-07-19 02:13:19 +00:00
# if defined(HAVE_IPV4) && defined(getaddrinfo) && !defined(HAVE_IPV6)
2016-07-12 00:40:13 +00:00
char copy [ 128 ] ;
char * colon ;
2004-08-21 01:25:48 +00:00
( ( struct sockaddr_in * ) sadr ) - > sin_family = AF_INET ;
( ( struct sockaddr_in * ) sadr ) - > sin_port = 0 ;
2006-06-30 15:45:16 +00:00
if ( strlen ( s ) > = sizeof ( copy ) - 1 )
return false ;
2019-02-16 19:09:07 +00:00
if ( ! net_dns_ipv4 . ival )
return false ;
2011-05-15 13:23:13 +00:00
2012-11-27 03:23:19 +00:00
( ( struct sockaddr_in * ) sadr ) - > sin_port = htons ( defaultport ) ;
2004-08-21 01:25:48 +00:00
strcpy ( copy , s ) ;
// strip off a trailing :port if present
for ( colon = copy ; * colon ; colon + + )
if ( * colon = = ' : ' )
{
* colon = 0 ;
( ( struct sockaddr_in * ) sadr ) - > sin_port = htons ( ( short ) atoi ( colon + 1 ) ) ;
}
if ( copy [ 0 ] > = ' 0 ' & & copy [ 0 ] < = ' 9 ' ) //this is the wrong way to test. a server name may start with a number.
{
* ( int * ) & ( ( struct sockaddr_in * ) sadr ) - > sin_addr = inet_addr ( copy ) ;
}
else
{
2016-07-12 00:40:13 +00:00
struct hostent * h ;
2004-08-21 01:25:48 +00:00
if ( ! ( h = gethostbyname ( copy ) ) )
2006-06-17 06:22:48 +00:00
return false ;
2004-08-21 01:25:48 +00:00
if ( h - > h_addrtype ! = AF_INET )
2006-06-17 06:22:48 +00:00
return false ;
2004-08-21 01:25:48 +00:00
* ( int * ) & ( ( struct sockaddr_in * ) sadr ) - > sin_addr = * ( int * ) h - > h_addr_list [ 0 ] ;
}
2012-11-27 03:23:19 +00:00
if ( addrfamily )
* addrfamily = AF_INET ;
if ( addrsize )
* addrsize = sizeof ( struct sockaddr_in ) ;
2014-12-23 15:26:42 +00:00
result + + ;
2012-04-09 19:12:12 +00:00
# endif
2004-08-21 01:25:48 +00:00
}
2014-12-23 15:26:42 +00:00
return result ;
2004-08-21 01:25:48 +00:00
}
2008-11-09 22:29:28 +00:00
/*
accepts anything that NET_StringToSockaddr accepts plus certain url schemes
including : tcp , irc
*/
2014-12-23 15:26:42 +00:00
size_t NET_StringToAdr2 ( const char * s , int defaultport , netadr_t * a , size_t numaddresses )
2004-08-21 01:25:48 +00:00
{
2014-12-23 15:26:42 +00:00
size_t result = 0 , i ;
struct sockaddr_qstorage sadr [ 8 ] ;
2018-09-23 19:35:24 +00:00
int asize [ countof ( sadr ) ] ;
netproto_t prot ;
netadrtype_t afhint ;
struct
{
const char * name ;
netproto_t prot ;
netadrtype_t family ;
} schemes [ ] =
{
{ " udp:// " , NP_DGRAM , NA_INVALID } , //placeholder for dgram rather than an actual family.
{ " udp4// " , NP_DGRAM , NA_IP } ,
{ " udp6// " , NP_DGRAM , NA_IPV6 } ,
{ " ipx:// " , NP_DGRAM , NA_IPX } ,
//compat with qtv. we don't have any way to exclude specific protocols though.
{ " qw:// " , NP_DGRAM , NA_INVALID } ,
{ " nq:// " , NP_DGRAM , NA_INVALID } ,
{ " dp:// " , NP_DGRAM , NA_INVALID } ,
{ " q2:// " , NP_DGRAM , NA_INVALID } ,
{ " q3:// " , NP_DGRAM , NA_INVALID } ,
{ " tcp:// " , NP_STREAM_OR_INVALID , NA_INVALID } , //placeholder for dgram rather than an actual family.
{ " tcp4// " , NP_STREAM_OR_INVALID , NA_IP } ,
{ " tcp6// " , NP_STREAM_OR_INVALID , NA_IPV6 } ,
{ " spx:// " , NP_STREAM_OR_INVALID , NA_IPX } ,
{ " ws:// " , NP_WS_OR_INVALID , NA_INVALID } ,
{ " wss:// " , NP_WSS_OR_INVALID , NA_INVALID } ,
{ " tls:// " , NP_TLS_OR_INVALID , NA_INVALID } ,
{ " dtls:// " , NP_DTLS_OR_INVALID , NA_INVALID } ,
{ " irc:// " , NP_INVALID , NA_INVALID } , //should have been handled explicitly, if supported.
# ifdef UNIXSOCKETS
{ " udg:// " , NP_DGRAM , NA_UNIX } ,
{ " unix:// " , NP_STREAM_OR_INVALID , NA_UNIX } ,
# endif
} ;
2014-12-23 15:26:42 +00:00
memset ( a , 0 , sizeof ( * a ) * numaddresses ) ;
2004-08-21 01:25:48 +00:00
2014-12-23 15:26:42 +00:00
if ( ! numaddresses )
return false ;
2012-04-09 19:12:12 +00:00
if ( ! strcmp ( s , " internalserver " ) )
{
a - > type = NA_LOOPBACK ;
return true ;
}
2015-06-05 03:45:01 +00:00
2014-03-30 08:55:06 +00:00
if ( ! strncmp ( s , " QLoopBack " , 9 ) )
{
a - > type = NA_LOOPBACK ;
if ( s [ 9 ] = = ' : ' )
a - > port = atoi ( s + 10 ) ;
else
a - > port = defaultport ;
return true ;
}
2012-04-09 19:12:12 +00:00
2015-06-05 03:45:01 +00:00
if ( ! net_enabled . ival )
return false ;
Con_DPrintf ( " Resolving address: %s \n " , s ) ;
2012-04-09 19:12:12 +00:00
# ifdef HAVE_WEBSOCKCL
2018-09-23 19:35:24 +00:00
//with websockets we can't really resolve anything. failure happens only when trying to connect.
//`connect /GAMENAME` is equivelent to `connect rtc://broker/GAMENAME`
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
if ( ! strncmp ( s , " / " , 1 ) )
{
char * prefix = " " ;
if ( ! fs_manifest - > rtcbroker | | ! * fs_manifest - > rtcbroker )
{ //FIXME: use referrer? or the website's host?
Con_DPrintf ( " No default rtc broker \n " ) ;
2018-09-23 19:35:24 +00:00
return 0 ; //can't accept it
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
}
if ( ! strstr ( fs_manifest - > rtcbroker , " :// " ) )
prefix = " ws:// " ;
Q_snprintfz ( a - > address . websocketurl , sizeof ( a - > address . websocketurl ) , " %s%s%s " , prefix , fs_manifest - > rtcbroker , s ) ;
2018-09-23 19:35:24 +00:00
return 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
}
else if ( ! strncmp ( s , " rtc:// " , 6 ) | | ! strncmp ( s , " rtcs:// " , 7 ) )
2018-09-23 19:35:24 +00:00
{ //basically ICE using sdp-via-websockets to a named relay server.
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
const char * prot , * host , * path ;
a - > type = NA_WEBSOCKET ;
a - > prot = NP_DTLS ;
if ( ! strncmp ( s , " rtcs:// " , 7 ) )
{
prot = " wss:// " ;
path = s + 7 ;
}
else
{
prot = " ws:// " ;
path = s + 6 ;
}
if ( * path = = ' / ' )
{
host = fs_manifest - > rtcbroker ;
if ( ! host | | ! * host ) //can't guess the host
2018-09-23 19:35:24 +00:00
return 0 ;
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
if ( strstr ( host , " :// " ) )
prot = " " ;
}
else
host = " " ;
Q_snprintfz ( a - > address . websocketurl , sizeof ( a - > address . websocketurl ) , " %s%s%s " , prot , host , path ) ;
2018-09-23 19:35:24 +00:00
return 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
}
else if ( ! strncmp ( s , " ws:// " , 5 ) | | ! strncmp ( s , " wss:// " , 6 ) )
2012-04-09 19:12:12 +00:00
{
a - > type = NA_WEBSOCKET ;
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
if ( ! strncmp ( s , " wss:// " , 6 ) )
a - > prot = NP_WSS ;
else
a - > prot = NP_WS ;
2012-04-09 19:12:12 +00:00
Q_strncpyz ( a - > address . websocketurl , s , sizeof ( a - > address . websocketurl ) ) ;
2018-09-23 19:35:24 +00:00
return 1 ;
2012-04-09 19:12:12 +00:00
}
else
{
/*code for convienience - no other protocols work anyway*/
2013-03-12 23:09:25 +00:00
static float warned ;
if ( warned < realtime )
2012-04-09 19:12:12 +00:00
{
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
Con_DPrintf ( " Note: Assuming ws:// prefix \n " ) ;
2013-03-12 23:09:25 +00:00
warned = realtime + 1 ;
2012-04-09 19:12:12 +00:00
}
a - > type = NA_WEBSOCKET ;
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
a - > prot = NP_WS ;
2012-04-09 19:12:12 +00:00
memcpy ( a - > address . websocketurl , " ws:// " , 5 ) ;
Q_strncpyz ( a - > address . websocketurl + 5 , s , sizeof ( a - > address . websocketurl ) - 5 ) ;
2018-09-23 19:35:24 +00:00
return 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
}
2018-04-15 02:48:23 +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
2008-11-09 22:29:28 +00:00
if ( ! strncmp ( s , " irc:// " , 6 ) )
{
2018-09-23 19:35:24 +00:00
# ifdef IRCCONNECT
2008-11-09 22:29:28 +00:00
char * at ;
2013-05-03 04:28:08 +00:00
char * slash ;
2008-11-09 22:29:28 +00:00
memset ( a , 0 , sizeof ( * a ) ) ;
a - > type = NA_IRC ;
s + = 6 ;
2013-05-03 04:28:08 +00:00
slash = strchr ( s , ' / ' ) ;
if ( ! slash )
return false ;
if ( slash - s + 1 > = sizeof ( a - > address . irc . host ) )
return false ;
memcpy ( a - > address . irc . host , s , slash - s ) ;
a - > address . irc . host [ slash - s ] = 0 ;
s = slash + 1 ;
2008-11-09 22:29:28 +00:00
at = strchr ( s , ' @ ' ) ;
if ( at )
{
if ( at - s + 1 > = sizeof ( a - > address . irc . user ) )
return false ;
Q_strncpyz ( a - > address . irc . user , s , at - s + 1 ) ;
Q_strncpyz ( a - > address . irc . channel , at + 1 , sizeof ( a - > address . irc . channel ) ) ;
}
else
{
//just a user.
Q_strncpyz ( a - > address . irc . user , s , sizeof ( a - > address . irc . user ) ) ;
}
2018-09-23 19:35:24 +00:00
return 1 ;
# else
return 0 ;
2008-11-09 22:29:28 +00:00
# endif
2018-09-23 19:35:24 +00:00
}
2013-03-31 04:21:08 +00:00
# ifdef HAVE_NATPMP
if ( ! strncmp ( s , " natpmp:// " , 9 ) )
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
{ //our natpmp thing omits the host part. FIXME: host should be the NAT that we're sending to
NET_PortToAdr ( NA_IP , NP_NATPMP , s + 9 , a ) ;
if ( a - > prot ! = NP_NATPMP )
2013-03-31 04:21:08 +00:00
return false ;
return true ;
}
# endif
2008-11-09 22:29:28 +00:00
2018-09-23 19:35:24 +00:00
for ( prot = NP_DGRAM , afhint = NA_INVALID /*any*/ , i = 0 ; i < countof ( schemes ) ; i + + )
{
if ( ! strncmp ( s , schemes [ i ] . name , strlen ( schemes [ i ] . name ) ) )
{
s + = strlen ( schemes [ i ] . name ) ;
prot = schemes [ i ] . prot ;
afhint = schemes [ i ] . family ;
break ;
}
}
result = NET_StringToSockaddr2 ( s , defaultport , afhint , sadr , NULL , asize , min ( numaddresses , countof ( sadr ) ) ) ;
2014-12-23 15:26:42 +00:00
for ( i = 0 ; i < result ; i + + )
2009-03-03 01:53:19 +00:00
{
2018-09-23 19:35:24 +00:00
SockadrToNetadr ( & sadr [ i ] , asize [ i ] , & a [ i ] ) ;
a [ i ] . prot = prot ;
2014-12-23 15:26:42 +00:00
}
2013-04-08 11:27:39 +00:00
2014-12-23 15:26:42 +00:00
//invalidate any others
for ( ; i < numaddresses ; i + + )
a [ i ] . type = NA_INVALID ;
return result ;
2004-08-21 01:25:48 +00:00
}
2006-05-22 22:51:14 +00:00
// NET_IntegerToMask: given a source address pointer, a mask address pointer, and
2011-05-15 13:23:13 +00:00
// desired number of bits, fills the mask pointer with given bits
2006-05-22 22:51:14 +00:00
// (bits < 0 will always fill all bits)
void NET_IntegerToMask ( netadr_t * a , netadr_t * amask , int bits )
{
2006-05-25 04:47:03 +00:00
unsigned int i ;
2006-05-22 22:51:14 +00:00
qbyte * n ;
memset ( amask , 0 , sizeof ( * amask ) ) ;
amask - > type = a - > type ;
if ( bits < 0 )
i = 8000 ; // fill all bits
else
i = bits ;
switch ( amask - > type )
{
2007-08-07 19:16:32 +00:00
case NA_INVALID :
break ;
case NA_IP :
n = amask - > address . ip ;
if ( i > 32 )
i = 32 ;
2006-05-22 22:51:14 +00:00
for ( ; i > = 8 ; i - = 8 )
{
* n = 0xFF ;
n + + ;
}
// fill last bit
if ( i )
{
2006-05-25 04:47:03 +00:00
i = 8 - i ;
i = 255 - ( ( 1 < < i ) - 1 ) ;
2006-05-22 22:51:14 +00:00
* n = i ;
}
break ;
case NA_IPV6 :
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2006-05-22 22:51:14 +00:00
n = amask - > address . ip6 ;
if ( i > 128 )
i = 128 ;
for ( ; i > = 8 ; i - = 8 )
{
* n = 0xFF ;
n + + ;
}
// fill last bit
if ( i )
{
2006-05-25 04:47:03 +00:00
i = 8 - i ;
i = 255 - ( ( 1 < < i ) - 1 ) ;
2006-05-22 22:51:14 +00:00
* n = i ;
}
# endif
2007-08-07 19:16:32 +00:00
break ;
case NA_IPX :
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2007-08-07 19:16:32 +00:00
n = amask - > address . ipx ;
if ( i > 80 )
i = 80 ;
2006-05-22 22:51:14 +00:00
for ( ; i > = 8 ; i - = 8 )
{
* n = 0xFF ;
n + + ;
}
// fill last bit
if ( i )
{
2006-05-25 04:47:03 +00:00
i = 8 - i ;
i = 255 - ( ( 1 < < i ) - 1 ) ;
2006-05-22 22:51:14 +00:00
* n = i ;
}
2007-08-07 19:16:32 +00:00
# endif
break ;
case NA_LOOPBACK :
2006-05-22 22:51:14 +00:00
break ;
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
case NA_UNIX : //address masks/filtering don't make sense.
# 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
# ifdef HAVE_WEBSOCKCL
2012-07-14 17:25:21 +00:00
case NA_WEBSOCKET :
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
# endif
# ifdef IRCCONNECT
2011-05-15 13:23:13 +00:00
case NA_IRC :
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
# endif
2011-05-15 13:23:13 +00:00
break ;
2006-05-22 22:51:14 +00:00
}
}
2017-02-11 16:14:06 +00:00
// ParsePartialIP: check string to see if it is a partial IP address and
2006-05-25 04:47:03 +00:00
// return bits to mask and set netadr_t or 0 if not an address
2017-02-11 16:14:06 +00:00
int ParsePartialIP ( const char * s , netadr_t * a )
2006-05-25 04:47:03 +00:00
{
2017-02-11 16:14:06 +00:00
char * colon ;
int bits ;
2006-05-25 04:47:03 +00:00
if ( ! * s )
return 0 ;
memset ( a , 0 , sizeof ( * a ) ) ;
2017-02-11 16:14:06 +00:00
//multiple colons == ipv6
colon = strchr ( s , ' : ' ) ;
if ( colon & & strchr ( colon + 1 , ' : ' ) )
2006-05-25 04:47:03 +00:00
{
2017-02-11 16:14:06 +00:00
qbyte * address = a - > address . ip6 ;
unsigned long tmp ;
bits = 0 ;
//FIXME: check for ::ffff:a.b.c.d
//FIXME: check for xx::xx
if ( s [ 0 ] = = ' : ' & & s [ 1 ] = = ' : ' & & ! s [ 2 ] )
2006-05-25 04:47:03 +00:00
{
2017-02-11 16:14:06 +00:00
s + = 2 ;
bits = 1 ;
2006-05-25 04:47:03 +00:00
}
2017-02-11 16:14:06 +00:00
else while ( * s )
2006-05-25 04:47:03 +00:00
{
2017-02-11 16:14:06 +00:00
tmp = strtoul ( s , & colon , 16 ) ;
if ( tmp > 0xffff )
return 0 ; //invalid
* address + + = ( tmp > > 8 ) & 0xff ;
* address + + = ( tmp > > 0 ) & 0xff ;
bits + = 16 ;
if ( bits = = 128 )
{
if ( ! * colon )
break ;
return 0 ; //must have ended here
}
2006-05-25 04:47:03 +00:00
2017-02-11 16:14:06 +00:00
//double-colon ends it here. we can't parse xx::xx
//hopefully the last 64 bits or whatever will be irrelevant anyway, so such addresses won't be common
if ( colon [ 0 ] = = ' : ' & & colon [ 1 ] = = ' : ' & & ! colon [ 2 ] )
break ;
if ( * colon = = ' : ' )
colon + + ;
else
return 0 ; //don't allow it if it just ended without a double-colon.
s = colon ;
}
a - > type = NA_IPV6 ;
a - > port = 0 ;
2006-05-25 04:47:03 +00:00
}
2017-02-11 16:14:06 +00:00
else
{
char * address = a - > address . ip ;
int port = 0 ;
bits = 8 ;
while ( * s )
{
if ( * s = = ' : ' )
{
port = strtoul ( s + 1 , & address , 10 ) ;
if ( * address ) //if there was something other than a number there, give up now
return 0 ;
break ; //end-of-string
}
else if ( * s = = ' . ' )
{
if ( bits > = 32 ) // only 32 bits in ipv4
return 0 ;
else if ( * ( s + 1 ) = = ' . ' )
return 0 ;
else if ( * ( s + 1 ) = = ' \0 ' )
break ; // don't add more bits to the mask for x.x., etc
address + + ;
//many nq servers mask addresses with Xs.
if ( s [ 1 ] = = ' x ' | | s [ 1 ] = = ' X ' )
{
s + + ;
while ( * s = = ' x ' | | * s = = ' X ' | | * s = = ' . ' )
s + + ;
if ( * s )
return 0 ;
break ;
}
bits + = 8 ;
}
else if ( * s > = ' 0 ' & & * s < = ' 9 ' )
* address = ( ( * address ) * 10 ) + ( * s - ' 0 ' ) ;
else
return 0 ; // invalid character
2006-05-25 04:47:03 +00:00
2017-02-11 16:14:06 +00:00
s + + ;
}
a - > type = NA_IP ;
a - > port = port ;
}
2006-05-25 04:47:03 +00:00
return bits ;
}
2006-05-22 22:51:14 +00:00
// NET_StringToAdrMasked: extension to NET_StringToAdr to handle IP addresses
// with masks or integers representing the bit masks
2017-02-11 16:14:06 +00:00
qboolean NET_StringToAdrMasked ( const char * s , qboolean allowdns , netadr_t * a , netadr_t * amask )
2006-05-22 22:51:14 +00:00
{
char t [ 64 ] ;
char * spoint ;
int i ;
spoint = strchr ( s , ' / ' ) ;
if ( spoint )
{
// we have a slash in the address so split and resolve separately
char * c ;
2006-05-25 04:47:03 +00:00
i = ( int ) ( spoint - s ) + 1 ;
if ( i > sizeof ( t ) )
2006-05-22 22:51:14 +00:00
i = sizeof ( t ) ;
Q_strncpyz ( t , s , i ) ;
2017-02-11 16:14:06 +00:00
if ( ! ParsePartialIP ( t , a ) & & ( ! allowdns | | ! NET_StringToAdr ( t , 0 , a ) ) )
2006-05-22 22:51:14 +00:00
return false ;
spoint + + ;
2011-05-15 13:23:13 +00:00
2006-05-22 22:51:14 +00:00
c = spoint ;
if ( ! * c )
return false ;
while ( * c ) // check for non-numeric characters
{
if ( * c < ' 0 ' | | * c > ' 9 ' )
{
c = NULL ;
break ;
}
c + + ;
}
if ( c = = NULL ) // we have an address so resolve it and return
2017-02-11 16:14:06 +00:00
return ParsePartialIP ( spoint , amask ) | | ( allowdns & & NET_StringToAdr ( spoint , 0 , amask ) ) ;
2006-05-22 22:51:14 +00:00
// otherwise generate mask for given bits
i = atoi ( spoint ) ;
NET_IntegerToMask ( a , amask , i ) ;
}
else
{
// we don't have a slash, resolve and fill with a full mask
2017-02-11 16:14:06 +00:00
i = ParsePartialIP ( s , a ) ;
if ( ! i & & ( ! allowdns | | ! NET_StringToAdr ( s , 0 , a ) ) )
2006-05-22 22:51:14 +00:00
return false ;
memset ( amask , 0 , sizeof ( * amask ) ) ;
amask - > type = a - > type ;
2006-05-25 04:47:03 +00:00
if ( i )
NET_IntegerToMask ( a , amask , i ) ;
else
NET_IntegerToMask ( a , amask , - 1 ) ;
2006-05-22 22:51:14 +00:00
}
return true ;
}
// NET_CompareAdrMasked: given 3 addresses, 2 to compare with a complimentary mask,
// returns true or false if they match
2014-08-03 14:47:47 +00:00
//WARNING: a is typically an ipv6 address, even if its an ipv4-mapped address.
//so ipv4ify first.
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
//this is not intended to identify any specific connection, so we can ignore udp/tcp distinctions (especially as this is usually used for bans).
2013-05-03 04:28:08 +00:00
qboolean NET_CompareAdrMasked ( netadr_t * a , netadr_t * b , netadr_t * mask )
2006-05-22 22:51:14 +00:00
{
int i ;
2008-05-25 01:07:53 +00:00
//make sure the address being checked against matches the mask
2013-05-03 04:28:08 +00:00
if ( b - > type ! = mask - > type )
2006-05-22 22:51:14 +00:00
return false ;
// check port if both are non-zero
2013-05-03 04:28:08 +00:00
if ( a - > port & & b - > port & & a - > port ! = b - > port )
2006-05-22 22:51:14 +00:00
return false ;
2008-05-25 01:07:53 +00:00
// check to make sure all types match
2013-05-03 04:28:08 +00:00
if ( a - > type ! = b - > type )
2008-05-25 01:07:53 +00:00
{
2013-05-03 04:28:08 +00:00
if ( a - > type = = NA_IP & & b - > type = = NA_IPV6 & & mask - > type = = NA_IP )
2008-05-25 01:07:53 +00:00
{
2011-10-27 16:16:29 +00:00
for ( i = 0 ; i < 10 ; i + + )
2013-05-03 04:28:08 +00:00
if ( b - > address . ip6 [ i ] ! = 0 )
2011-10-27 16:16:29 +00:00
return false ; //only matches if they're 0s, otherwise its not an ipv4 address there
2008-05-25 01:07:53 +00:00
for ( ; i < 12 ; i + + )
2014-08-03 14:47:47 +00:00
if ( b - > address . ip6 [ i ] ! = 0xff ) // && b->address.ip6[i] != 0x00) //0x00 is depricated
2011-10-27 16:16:29 +00:00
return false ; //only matches if they're 0s or ffs, otherwise its not an ipv4 address there
for ( i = 0 ; i < 4 ; i + + )
2008-05-25 01:07:53 +00:00
{
2013-05-03 04:28:08 +00:00
if ( ( a - > address . ip [ i ] & mask - > address . ip [ i ] ) ! = ( b - > address . ip6 [ 12 + i ] & mask - > address . ip [ i ] ) )
2011-10-27 16:16:29 +00:00
return false ; //mask doesn't match
2008-05-25 01:07:53 +00:00
}
2011-10-27 16:16:29 +00:00
return true ; //its an ipv4 address in there, the mask matched the whole way through
2008-05-25 01:07:53 +00:00
}
2013-05-03 04:28:08 +00:00
if ( a - > type = = NA_IPV6 & & b - > type = = NA_IP & & mask - > type = = NA_IP )
2008-05-25 01:07:53 +00:00
{
for ( i = 0 ; i < 10 ; i + + )
2013-05-03 04:28:08 +00:00
if ( a - > address . ip6 [ i ] ! = 0 )
2008-05-25 01:07:53 +00:00
return false ; //only matches if they're 0s, otherwise its not an ipv4 address there
for ( ; i < 12 ; i + + )
2014-08-03 14:47:47 +00:00
if ( a - > address . ip6 [ i ] ! = 0xff ) // && a->address.ip6[i] != 0x00) //0x00 is depricated
2011-01-29 21:01:40 +00:00
return false ; //only matches if they're 0s or ffs, otherwise its not an ipv4 address there
2008-05-25 01:07:53 +00:00
for ( i = 0 ; i < 4 ; i + + )
{
2013-05-03 04:28:08 +00:00
if ( ( a - > address . ip6 [ 12 + i ] & mask - > address . ip [ i ] ) ! = ( b - > address . ip [ i ] & mask - > address . ip [ i ] ) )
2008-05-25 01:07:53 +00:00
return false ; //mask doesn't match
}
return true ; //its an ipv4 address in there, the mask matched the whole way through
}
return false ;
}
2006-05-22 22:51:14 +00:00
// match on protocol type and compare address
2013-05-03 04:28:08 +00:00
switch ( a - > type )
2006-05-22 22:51:14 +00:00
{
case NA_LOOPBACK :
return true ;
case NA_IP :
for ( i = 0 ; i < 4 ; i + + )
{
2013-05-03 04:28:08 +00:00
if ( ( a - > address . ip [ i ] & mask - > address . ip [ i ] ) ! = ( b - > address . ip [ i ] & mask - > address . ip [ i ] ) )
2006-05-22 22:51:14 +00:00
return false ;
}
break ;
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2006-05-22 22:51:14 +00:00
case NA_IPV6 :
for ( i = 0 ; i < 16 ; i + + )
{
2013-05-03 04:28:08 +00:00
if ( ( a - > address . ip6 [ i ] & mask - > address . ip6 [ i ] ) ! = ( b - > address . ip6 [ i ] & mask - > address . ip6 [ i ] ) )
2006-05-22 22:51:14 +00:00
return false ;
}
break ;
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2006-05-22 22:51:14 +00:00
case NA_IPX :
for ( i = 0 ; i < 10 ; i + + )
{
2013-05-03 04:28:08 +00:00
if ( ( a - > address . ipx [ i ] & mask - > address . ipx [ i ] ) ! = ( b - > address . ipx [ i ] & mask - > address . ipx [ i ] ) )
2006-05-22 22:51:14 +00:00
return false ;
}
break ;
# endif
2008-11-09 22:29:28 +00:00
# ifdef IRCCONNECT
case NA_IRC :
2011-05-15 13:23:13 +00:00
//masks are not supported, match explicitly
2013-05-03 04:28:08 +00:00
if ( strcmp ( a - > address . irc . user , b - > address . irc . user ) )
2008-11-09 22:29:28 +00:00
return false ;
break ;
# endif
2006-05-22 22:51:14 +00:00
default :
return false ; // invalid protocol
}
return true ; // all checks passed
}
// UniformMaskedBits: counts number of bits in an assumed uniform mask, returns
// -1 if not uniform
2013-05-03 04:28:08 +00:00
int UniformMaskedBits ( netadr_t * mask )
2006-05-22 22:51:14 +00:00
{
int bits ;
int b ;
2006-05-25 04:47:03 +00:00
unsigned int bs ;
2006-05-22 22:51:14 +00:00
qboolean bitenc = false ;
2013-05-03 04:28:08 +00:00
switch ( mask - > type )
2006-05-22 22:51:14 +00:00
{
case NA_IP :
bits = 32 ;
for ( b = 3 ; b > = 0 ; b - - )
{
2013-05-03 04:28:08 +00:00
if ( mask - > address . ip [ b ] = = 0xFF )
2006-05-22 22:51:14 +00:00
bitenc = true ;
2013-05-03 04:28:08 +00:00
else if ( mask - > address . ip [ b ] )
2006-05-22 22:51:14 +00:00
{
2013-05-03 04:28:08 +00:00
bs = ( ~ mask - > address . ip [ b ] ) & 0xFF ;
2006-05-22 22:51:14 +00:00
while ( bs )
{
if ( bs & 1 )
{
bits - = 1 ;
if ( bitenc )
return - 1 ;
}
else
bitenc = true ;
bs > > = 1 ;
}
}
else if ( bitenc )
return - 1 ;
else
bits - = 8 ;
}
break ;
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2006-05-22 22:51:14 +00:00
case NA_IPV6 :
bits = 128 ;
for ( b = 15 ; b > = 0 ; b - - )
{
2013-05-03 04:28:08 +00:00
if ( mask - > address . ip6 [ b ] = = 0xFF )
2006-05-22 22:51:14 +00:00
bitenc = true ;
2013-05-03 04:28:08 +00:00
else if ( mask - > address . ip6 [ b ] )
2006-05-22 22:51:14 +00:00
{
2013-05-03 04:28:08 +00:00
bs = ( ~ mask - > address . ip6 [ b ] ) & 0xFF ;
2006-05-22 22:51:14 +00:00
while ( bs )
{
if ( bs & 1 )
{
bits - = 1 ;
if ( bitenc )
return - 1 ;
}
else
bitenc = true ;
bs > > = 1 ;
}
}
else if ( bitenc )
return - 1 ;
else
bits - = 8 ;
}
break ;
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2006-05-22 22:51:14 +00:00
case NA_IPX :
bits = 80 ;
for ( b = 9 ; b > = 0 ; b - - )
{
2013-05-03 04:28:08 +00:00
if ( mask - > address . ipx [ b ] = = 0xFF )
2006-05-22 22:51:14 +00:00
bitenc = true ;
2013-05-03 04:28:08 +00:00
else if ( mask - > address . ipx [ b ] )
2006-05-22 22:51:14 +00:00
{
2013-05-03 04:28:08 +00:00
bs = ( ~ mask - > address . ipx [ b ] ) & 0xFF ;
2006-05-22 22:51:14 +00:00
while ( bs )
{
if ( bs & 1 )
{
bits - = 1 ;
if ( bitenc )
return - 1 ;
}
else
bitenc = true ;
bs > > = 1 ;
}
}
else if ( bitenc )
return - 1 ;
else
bits - = 8 ;
}
break ;
# endif
default :
return - 1 ; // invalid protocol
}
return bits ; // all checks passed
}
2013-05-03 04:28:08 +00:00
char * NET_AdrToStringMasked ( char * s , int len , netadr_t * a , netadr_t * amask )
2006-05-22 22:51:14 +00:00
{
int i ;
2008-06-08 14:37:57 +00:00
char adr [ MAX_ADR_SIZE ] , mask [ MAX_ADR_SIZE ] ;
2006-05-22 22:51:14 +00:00
i = UniformMaskedBits ( amask ) ;
if ( i > = 0 )
2008-06-08 20:20:11 +00:00
snprintf ( s , len , " %s/%i " , NET_AdrToString ( adr , sizeof ( adr ) , a ) , i ) ;
2006-05-22 22:51:14 +00:00
else
2008-06-08 20:20:11 +00:00
snprintf ( s , len , " %s/%s " , NET_AdrToString ( adr , sizeof ( adr ) , a ) , NET_AdrToString ( mask , sizeof ( mask ) , amask ) ) ;
2006-05-22 22:51:14 +00:00
return s ;
}
2005-07-03 15:16:20 +00:00
// Returns true if we can't bind the address locally--in other words,
2004-08-21 01:25:48 +00:00
// the IP is NOT one of our interfaces.
qboolean NET_IsClientLegal ( netadr_t * adr )
{
#if 0
struct sockaddr_in sadr ;
int newsocket ;
if ( adr - > ip [ 0 ] = = 127 )
return false ; // no local connections period
NetadrToSockadr ( adr , & sadr ) ;
2016-07-12 00:40:13 +00:00
if ( ( newsocket = socket ( PF_INET , SOCK_CLOEXEC | SOCK_DGRAM , IPPROTO_UDP ) ) = = INVALID_SOCKET )
2004-08-21 01:25:48 +00:00
Sys_Error ( " NET_IsClientLegal: socket: " , strerror ( qerrno ) ) ;
sadr . sin_port = 0 ;
2005-07-03 15:16:20 +00:00
if ( bind ( newsocket , ( void * ) & sadr , sizeof ( sadr ) ) = = - 1 )
2004-08-21 01:25:48 +00:00
{
// It is not a local address
close ( newsocket ) ;
return true ;
}
close ( newsocket ) ;
return false ;
# else
return true ;
# endif
}
2013-05-03 04:28:08 +00:00
qboolean NET_IsLoopBackAddress ( netadr_t * adr )
2004-08-21 01:25:48 +00:00
{
// return (!strcmp(cls.servername, NET_AdrToString(net_local_adr)) || !strcmp(cls.servername, "local");
2013-05-03 04:28:08 +00:00
return adr - > type = = NA_LOOPBACK ;
2004-08-21 01:25:48 +00:00
}
2018-10-23 07:09:06 +00:00
# ifdef HAVE_SSL
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 )
{
//Note: This is XORed because of shitty scanners flagging binaries through false positive, flagging the sites that they were downloaded from, flagging binaries that contain references to those sites, and flagging any site that contains binaries.
//the xor helps break that shitty recursive loop of mistrust from defects in other people's code.
//at least until there's a sandbox that checks the dns resolutions for our update requests anyway.
//I should probably just copy the downloadables file to sourceforge.
static struct
{
qbyte * data ;
} knowncerts [ ] = {
{
/*updates.triptohell.info*/ " \x8a \x8f \x9b \x9e \x8b \x9a \x8c \xd1 \x8b \x8d \x96 \x8f \x8b \x90 \x97 \x9a \x93 \x93 \xd1 \x96 \x91 \x99 \x90 \xff \xc2 \x03 \xcf \x7d \xfc \x41 \xcf \x7d \xfd \x59 \x5f \xfc \xfd \xfe \xfd \xfd \xf6 \xff \x0b \xb1 \xec \xf7 \xcd \x7a \x4a \xe6 \xcf \xf2 \xf9 \xf6 \xd5 \x79 \xb7 \x79 \x08 \xf2 \xfe \xfe \xf4 \xfa \xff \xcf \x8b \xce \xf4 \xcf \xf6 \xf9 \xfc \xaa \xfb \xf9 \xec \xfd \xaa \xb4 \xce \xef \xcf \xf1 \xf9 \xfc \xaa \xfb \xf7 \xf3 \xf8 \xba \x91 \x98 \x93 \x9e \x91 \x9b \xce \xf0 \xcf \xf2 \xf9 \xfc \xaa \xfb \xf8 \xf3 \xf9 \xb3 \x90 \x91 \x9b \x90 \x91 \xce \xf1 \xcf \xf3 \xf9 \xfc \xaa \xfb \xf5 \xf3 \xfa \xb9 \xab \xba \xae \xa8 \xce \xef \xcf \xf1 \xf9 \xfc \xaa \xfb \xf4 \xf3 \xf8 \xaa \x8f \x9b \x9e \x8b \x9a \x8c \xce \xdf \xcf \xe1 \xf9 \xfc \xaa \xfb \xfc \xf3 \xe8 \x8a \x8f \x9b \x9e \x8b \x9a \x8c \xd1 \x8b \x8d \x96 \x8f \x8b \x90 \x97 \x9a \x93 \x93 \xd1 \x96 \x91 \x99 \x90 \xcf \xe1 \xe8 \xf2 \xce \xc6 \xcf \xca \xcc \xce \xce \xcf \xcf \xc6 \xce \xc6 \xa5 \xe8 \xf2 \xcd \xc6 \xcf \xca \xcd \xc7 \xce \xcf \xcf \xc6 \xce \xc6 \xa5 \xcf \x8b \xce \xf4 \xcf \xf6 \xf9 \xfc \xaa \xfb \xf9 \xec \xfd \xaa \xb4 \xce \xef \xcf \xf1 \xf9 \xfc \xaa \xfb \xf7 \xf3 \xf8 \xba \x91 \x98 \x93 \x9e \x91 \x9b \xce \xf0 \xcf \xf2 \xf9 \xfc \xaa \xfb \xf8 \xf3 \xf9 \xb3 \x90 \x91 \x9b \x90 \x91 \xce \xf1 \xcf \xf3 \xf9 \xfc \xaa \xfb \xf5 \xf3 \xfa \xb9 \xab \xba \xae \xa8 \xce \xef \xcf \xf1 \xf9 \xfc \xaa \xfb \xf4 \xf3 \xf8 \xaa \x8f \x9b \x9e \x8b \x9a \x8c \xce \xdf \xcf \xe1 \xf9 \xfc \xaa \xfb \xfc \xf3 \xe8 \x8a \x8f \x9b \x9e \x8b \x9a \x8c \xd1 \x8b \x8d \x96 \x8f \x8b \x90 \x97 \x9a \x93 \x93 \xd1 \x96 \x91 \x99 \x90 \xcf \x7d \xfe \xdd \xcf \xf2 \xf9 \xf6 \xd5 \x79 \xb7 \x79 \x08 \xf2 \xfe \xfe \xfe \xfa \xff \xfc \x7d \xfe \xf0 \xff \xcf \x7d \xfe \xf5 \xfd \x7d \xfe \xfe \xff \x55 \x4a \x63 \x33 \x17 \x42 \x52 \xe3 \x80 \x94 \xe3 \x36 \xfb \x19 \xd3 \xef \x53 \x66 \x14 \x98 \xf4 \x63 \xdb \x47 \x6f \x88 \x21 \x55 \xbb \x5d \xea \xce \x9e \xad \xb2 \x14 \x70 \xa9 \x47 \x50 \x3e \xd0 \x99 \x22 \xaa \x72 \x29 \x13 \x3c \x5b \x6c \x73 \x79 \x14 \x50 \x76 \xe8 \xe6 \xd1 \x93 \x3d \x2b \x06 \x6d \x53 \xd1 \x8c \x66 \xa9 \x0d \x3c \x3b \xeb \xa9 \xb5 \xf2 \x41 \xae \x36 \x70 \xb1 \x6d \xdf \xd4 \x51 \xfa \xf3 \x81 \x78 \x5a \xfd \x1e \x3f \x82 \x8e \x58 \xc7 \x8d \xb8 \xc0 \xce \xf8 \x6f \x4f \x92 \x30 \x51 \x49 \x24 \x14 \xc6 \x55 \xa0 \x4b \x90 \xf3 \x9c \xd5 \xde \x9a \xc9 \x55 \x94 \x53 \x68 \x49 \x41 \xdf \x5b \x78 \xc9 \x40 \xca \x3a \x59 \xce \x1b \x62 \x7a \x0c \x51 \x70 \x94 \x07 \xa6 \x8a \xf0 \x4a \xa2 \xce \xbf \xc6 \xd1 \x15 \xb7 \x9a \x20 \x6e \x1c \xf9 \x04 \x4d \x13 \x23 \x2f \x6f \x6b \x29 \x97 \xb2 \x9d \xda \x65 \xc2 \x3c \x8b \xe8 \x82 \xf1 \x1d \xe1 \xcb \x40 \xfd \x7a \x3b \xbf \x77 \x6e \x14 \x1f \x0a \x6d \xa9 \xbd \xb0 \x59 \xb3 \xe8 \x77 \x4d \x76 \x2d \x13 \x9f \xab \x68 \xdf \xf5 \x35 \x0f \x2e \xcc \xc0 \xa4 \x99 \x48 \x75 \xbd \x8d \x98 \x36 \xb8 \x7c \x4c \x2b \xe1 \x57 \xbb \x40 \xa5 \xe5 \x7a \x86 \x11 \x07 \x7f \x21 \xe6 \xe2 \x3a \x22 \xaf \xbd \xef \xe8 \x48 \x3c \x2b \x0e \x34 \x75 \x47 \x8e \xaa \xce \xfd \xfc \xfe \xff \xfe \x5c \xac \xcf \xae \xcf \xe2 \xf9 \xfc \xaa \xe2 \xf1 \xfb \xe9 \xfb \xeb \xd3 \x97 \x7e \x70 \xbf \x73 \xbf \xbd \x60 \x42 \x3a \xf4 \xc9 \x04 \x1d \x89 \x14 \x72 \x4b \x0c \xcf \xe0 \xf9 \xfc \xaa \xe2 \xdc \xfb \xe7 \xcf \xe9 \x7f \xeb \xd3 \x97 \x7e \x70 \xbf \x73 \xbf \xbd \x60 \x42 \x3a \xf4 \xc9 \x04 \x1d \x89 \x14 \x72 \x4b \x0c \xcf \xf0 \xf9 \xfc \xaa \xe2 \xec \xfe \xfe \x00 \xfb \xfa \xcf \xfc \xfe \xfe \x00 \xcf \xf2 \xf9 \xf6 \xd5 \x79 \xb7 \x79 \x08 \xf2 \xfe \xfe \xf4 \xfa \xff \xfc \x7d \xfe \xfe \xff \xf3 \xfe \xca \xcd \x47 \x18 \x69 \x45 \xc1 \xac \x73 \x87 \xbe \x54 \x64 \x80 \x1d \x85 \x7f \xa5 \x36 \x77 \xf9 \xd6 \xd7 \x06 \xaf \x80 \x33 \x49 \x33 \xcb \xfc \xba \xcd \x86 \x9c \x18 \x21 \x63 \xb9 \xd6 \x0b \x50 \xcd \x8d \xd9 \xee \x5f \x84 \xad \xdc \xf5 \x2a \xae \x6e \x86 \x0d \xaf \x9e \x7f \x8d \xbf \x18 \x7a \x4f \xec \xe2 \x67 \x24 \xeb \xdc \xa6 \x5b \x43 \x16 \x1f \xe4 \x3f \xc7 \xcc \x69 \x43 \x44 \xa9 \xb8 \x33 \x42 \x17 \xbf \xb6 \x20 \x55 \x9b \x81 \xd6 \x1a \x62 \xbf \x5a \xe5 \xa3 \xba \xe0 \xa5 \x88 \xa6 \x01 \x85 \x47 \x07 \xb2 \x3b \x64 \xce \x19 \xf7 \x3b \x6a \x05 \x6e \x70 \x6e \x60 \xc3 \x3b \x7d \x46 \x0e \x92 \x57 \x59 \x3b \xf6 \x4e \x16 \x57 \x9f \x64 \x55 \xb3 \x86 \x0f \x66 \x47 \x52 \x9c \x4e \x1b \x3f \x50 \x0f \x20 \x36 \xcc \xac \xb2 \xf6 \x1b \xc0 \x72 \x61 \xc7 \x39 \x6c \x00 \x33 \x6e \xb9 \x81 \x98 \xd7 \x9e \x55 \x38 \xf4 \x1d \x27 \x73 \x1b \x13 \x72 \xbb \x18 \x95 \xeb \x87 \x6e \x82 \x13 \x38 \xf8 \x12 \x36 \xa7 \x24 \xca \x2b \x8f \xf9 \xf9 \xc6 \x72 \xb4 \x7f \xd3 \x49 \x57 \x86 \xa3 \x6b \xea \x93 \xcb \xf9 \xa3 \x28 \x3a \xbd \x3f \x8d \xfe \x8e \xf8 \x0a \xda \x95 \x2f \xdb \x79 \x32 \xe4 \xde \xf8 \x51 \xbf \x07 \x3e \x1b \xdc \xf2 \x5f \x3f \xdc \x0f \xf8 \x45 \x23 \xcb \xa2 \xb8 \x30 \xb4 \x84 \x2a \xa2 " ,
} ,
} ;
qbyte * r , * t ;
size_t i , j , sz ;
for ( i = 0 ; i < countof ( knowncerts ) ; i + + )
{
t = knowncerts [ i ] . data ;
for ( j = 0 ; ; j + + )
{
if ( certname [ j ] ! = ( t [ j ] ^ 0xff ) )
break ;
if ( ! certname [ j ] )
{
j + + ;
t + = j ;
sz = t [ 0 ] | ( t [ 1 ] < < 8 ) ;
t + = 2 ;
r = BZ_Malloc ( sz ) ;
* size = sz ;
while ( sz - - > 0 )
r [ sz ] = t [ sz ] ^ 0xff ;
return r ;
}
}
}
* size = 0 ;
//return Z_StrDup(""); //to force failure... gnutls debug code will dump out a cert that can be inserted above.
return NULL ;
}
2018-10-23 07:09:06 +00:00
vfsfile_t * FS_OpenSSL ( const char * hostname , vfsfile_t * source , qboolean isserver )
{
vfsfile_t * f = NULL ;
# ifdef HAVE_GNUTLS
if ( ! f )
f = GNUTLS_OpenVFS ( hostname , source , isserver ) ;
# endif
# ifdef HAVE_OPENSSL
if ( ! f )
f = OSSL_OpenVFS ( hostname , source , isserver ) ;
# endif
# ifdef HAVE_WINSSPI
if ( ! f )
f = SSPI_OpenVFS ( hostname , source , isserver ) ;
# endif
return f ;
}
int TLS_GetChannelBinding ( vfsfile_t * stream , qbyte * data , size_t * datasize )
{
int r = - 1 ;
# ifdef HAVE_GNUTLS
if ( r = = - 1 )
r = GNUTLS_GetChannelBinding ( stream , data , datasize ) ;
# endif
# ifdef HAVE_OPENSSL
if ( r = = - 1 )
r = OSSL_GetChannelBinding ( stream , data , datasize ) ;
# endif
# ifdef HAVE_WINSSPI
if ( r = = - 1 )
r = SSPI_GetChannelBinding ( stream , data , datasize ) ;
# endif
return r ;
}
# endif
2004-08-21 01:25:48 +00:00
/////////////////////////////////////////////
//loopback stuff
2018-12-28 00:04:36 +00:00
# if defined(HAVE_SERVER) && defined(HAVE_CLIENT)
2013-03-31 04:21:08 +00:00
qboolean NET_GetLoopPacket ( int sock , netadr_t * from , sizebuf_t * message )
2004-08-21 01:25:48 +00:00
{
int i ;
loopback_t * loop ;
2013-03-31 04:21:08 +00:00
sock & = 1 ;
2004-08-21 01:25:48 +00:00
loop = & loopbacks [ sock ] ;
if ( loop - > send - loop - > get > MAX_LOOPBACK )
2012-05-09 15:30:53 +00:00
{
extern cvar_t showdrop ;
if ( showdrop . ival )
Con_Printf ( " loopback dropping %i packets \n " , ( loop - > send - MAX_LOOPBACK ) - loop - > get ) ;
2004-08-21 01:25:48 +00:00
loop - > get = loop - > send - MAX_LOOPBACK ;
2012-05-09 15:30:53 +00:00
}
2004-08-21 01:25:48 +00:00
if ( loop - > get > = loop - > send )
return false ;
i = loop - > get & ( MAX_LOOPBACK - 1 ) ;
loop - > get + + ;
if ( message - > maxsize < loop - > msgs [ i ] . datalen )
Sys_Error ( " NET_SendLoopPacket: Loopback buffer was too big " ) ;
memcpy ( message - > data , loop - > msgs [ i ] . data , loop - > msgs [ i ] . datalen ) ;
message - > cursize = loop - > msgs [ i ] . datalen ;
memset ( from , 0 , sizeof ( * from ) ) ;
from - > type = NA_LOOPBACK ;
2004-12-24 08:45:56 +00:00
message - > packing = SZ_RAWBYTES ;
message - > currentbit = 0 ;
2014-03-30 08:55:06 +00:00
loop - > msgs [ i ] . datalen = 0 ;
2004-08-21 01:25:48 +00:00
return true ;
}
2016-07-12 00:40:13 +00:00
neterr_t NET_SendLoopPacket ( int sock , int length , const void * data , netadr_t * to )
2004-08-21 01:25:48 +00:00
{
int i ;
loopback_t * loop ;
2019-09-04 08:32:22 +00:00
if ( ! length & & ! data ) //NET_EnsureRoute tests.
return NETERR_SENT ;
2004-08-21 01:25:48 +00:00
2013-03-31 04:21:08 +00:00
sock & = 1 ;
2004-08-21 01:25:48 +00:00
loop = & loopbacks [ sock ^ 1 ] ;
2014-05-18 23:02:04 +00:00
if ( ! loop - > inited )
2016-07-12 00:40:13 +00:00
return NETERR_NOROUTE ;
2014-05-18 23:02:04 +00:00
2014-03-30 08:55:06 +00:00
i = loop - > send & ( MAX_LOOPBACK - 1 ) ;
if ( length > loop - > msgs [ i ] . datamax )
2013-03-12 23:24:15 +00:00
{
2014-03-30 08:55:06 +00:00
loop - > msgs [ i ] . datamax = length + 1024 ;
BZ_Free ( loop - > msgs [ i ] . data ) ;
loop - > msgs [ i ] . data = BZ_Malloc ( loop - > msgs [ i ] . datamax ) ;
2013-03-12 23:24:15 +00:00
}
2014-03-30 08:55:06 +00:00
if ( loop - > msgs [ i ] . datalen )
Con_Printf ( " Warning: loopback queue overflow \n " ) ;
2013-03-12 23:24:15 +00:00
2004-08-21 01:25:48 +00:00
loop - > send + + ;
memcpy ( loop - > msgs [ i ] . data , data , length ) ;
loop - > msgs [ i ] . datalen = length ;
2016-07-12 00:40:13 +00:00
return NETERR_SENT ;
2004-08-21 01:25:48 +00:00
}
2014-02-07 08:38:40 +00:00
int FTENET_Loop_GetLocalAddresses ( struct ftenet_generic_connection_s * con , unsigned int * adrflags , netadr_t * addresses , int maxaddresses )
2013-03-31 04:21:08 +00:00
{
2014-02-07 08:38:40 +00:00
if ( maxaddresses )
2013-03-31 04:21:08 +00:00
{
2014-02-07 08:38:40 +00:00
addresses - > type = NA_LOOPBACK ;
addresses - > port = con - > thesocket + 1 ;
* adrflags = 0 ;
return 1 ;
2013-03-31 04:21:08 +00:00
}
2014-02-07 08:38:40 +00:00
return 0 ;
2013-03-31 04:21:08 +00:00
}
2008-11-09 22:29:28 +00:00
2013-03-31 04:21:08 +00:00
qboolean FTENET_Loop_GetPacket ( ftenet_generic_connection_t * con )
{
return NET_GetLoopPacket ( con - > thesocket , & net_from , & net_message ) ;
}
2008-11-09 22:29:28 +00:00
2013-12-09 01:18:27 +00:00
# ifdef HAVE_PACKET
//just a null function so we don't pass bad things to select.
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 FTENET_Loop_SetFDSets ( ftenet_generic_connection_t * gcon , fd_set * readfdset , fd_set * writefdset )
2013-12-09 01:18:27 +00:00
{
return 0 ;
}
# endif
2016-07-12 00:40:13 +00:00
neterr_t FTENET_Loop_SendPacket ( ftenet_generic_connection_t * con , int length , const void * data , netadr_t * to )
2013-03-31 04:21:08 +00:00
{
2013-05-03 04:28:08 +00:00
if ( to - > type = = NA_LOOPBACK )
2013-03-31 04:21:08 +00:00
{
2016-07-12 00:40:13 +00:00
return NET_SendLoopPacket ( con - > thesocket , length , data , to ) ;
2013-03-31 04:21:08 +00:00
}
2016-07-12 00:40:13 +00:00
return NETERR_NOROUTE ;
2013-03-31 04:21:08 +00:00
}
void FTENET_Loop_Close ( ftenet_generic_connection_t * con )
{
2014-04-12 03:31:59 +00:00
int i ;
2013-03-31 04:21:08 +00:00
int sock = con - > thesocket ;
sock & = 1 ;
loopbacks [ sock ] . inited = false ;
2017-06-21 01:24:25 +00:00
loopbacks [ sock ] . get = loopbacks [ sock ] . send = 0 ;
2014-04-12 03:31:59 +00:00
for ( i = 0 ; i < MAX_LOOPBACK ; i + + )
{
BZ_Free ( loopbacks [ sock ] . msgs [ i ] . data ) ;
loopbacks [ sock ] . msgs [ i ] . data = NULL ;
loopbacks [ sock ] . msgs [ i ] . datalen = 0 ;
loopbacks [ sock ] . msgs [ i ] . datamax = 0 ;
}
2013-03-31 04:21:08 +00:00
Z_Free ( con ) ;
}
2015-12-12 19:25:15 +00:00
static ftenet_generic_connection_t * FTENET_Loop_EstablishConnection ( qboolean isserver , const char * address , netadr_t adr )
2013-03-31 04:21:08 +00:00
{
ftenet_generic_connection_t * newcon ;
int sock ;
2016-07-12 00:40:13 +00:00
for ( sock = 0 ; sock < countof ( loopbacks ) ; sock + + )
2013-03-31 04:21:08 +00:00
if ( ! loopbacks [ sock ] . inited )
break ;
2016-07-12 00:40:13 +00:00
if ( sock = = countof ( loopbacks ) )
2013-03-31 04:21:08 +00:00
return NULL ;
newcon = Z_Malloc ( sizeof ( * newcon ) ) ;
if ( newcon )
{
loopbacks [ sock ] . inited = true ;
2017-06-21 01:24:25 +00:00
loopbacks [ sock ] . get = loopbacks [ sock ] . send = 0 ;
2013-03-31 04:21:08 +00:00
2014-02-07 08:38:40 +00:00
newcon - > GetLocalAddresses = FTENET_Loop_GetLocalAddresses ;
2013-03-31 04:21:08 +00:00
newcon - > GetPacket = FTENET_Loop_GetPacket ;
newcon - > SendPacket = FTENET_Loop_SendPacket ;
newcon - > Close = FTENET_Loop_Close ;
2013-12-09 01:18:27 +00:00
# ifdef HAVE_PACKET
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
newcon - > SetFDSets = FTENET_Loop_SetFDSets ;
2013-12-09 01:18:27 +00:00
# endif
2013-03-31 04:21:08 +00:00
newcon - > islisten = isserver ;
newcon - > addrtype [ 0 ] = NA_LOOPBACK ;
newcon - > addrtype [ 1 ] = NA_INVALID ;
newcon - > thesocket = sock ;
}
return newcon ;
}
# endif
//=============================================================================
2008-11-09 22:29:28 +00:00
ftenet_connections_t * FTENET_CreateCollection ( qboolean listen )
2006-05-07 05:31:01 +00:00
{
2008-11-09 22:29:28 +00:00
ftenet_connections_t * col ;
col = Z_Malloc ( sizeof ( * col ) ) ;
col - > islisten = listen ;
return col ;
}
2018-12-28 00:04:36 +00:00
# if defined(HAVE_CLIENT) && defined(HAVE_SERVER)
2015-12-12 19:25:15 +00:00
static ftenet_generic_connection_t * FTENET_Loop_EstablishConnection ( qboolean isserver , const char * address , netadr_t adr ) ;
2016-02-15 06:01:17 +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
# ifdef HAVE_PACKET
static ftenet_generic_connection_t * FTENET_Datagram_EstablishConnection ( qboolean isserver , const char * address , netadr_t adr ) ;
2016-07-12 00:40:13 +00:00
# endif
2016-02-15 06:01:17 +00:00
# ifdef TCPCONNECT
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
static ftenet_generic_connection_t * FTENET_TCPConnect_EstablishConnection ( qboolean isserver , const char * address , netadr_t adr ) ;
2013-05-11 05:03:07 +00:00
# endif
# ifdef HAVE_WEBSOCKCL
2015-12-12 19:25:15 +00:00
static ftenet_generic_connection_t * FTENET_WebSocket_EstablishConnection ( qboolean isserver , const char * address , netadr_t adr ) ;
2013-05-11 05:03:07 +00:00
# endif
2016-02-15 06:01:17 +00:00
# ifdef IRCCONNECT
2015-12-12 19:25:15 +00:00
static ftenet_generic_connection_t * FTENET_IRCConnect_EstablishConnection ( qboolean isserver , const char * address , netadr_t adr ) ;
2016-02-15 06:01:17 +00:00
# endif
2014-02-22 00:28:22 +00:00
# ifdef HAVE_NATPMP
2015-12-12 19:25:15 +00:00
static ftenet_generic_connection_t * FTENET_NATPMP_EstablishConnection ( qboolean isserver , const char * address , netadr_t adr ) ;
2014-02-22 00:28:22 +00:00
# endif
2013-03-31 04:21:08 +00:00
# ifdef HAVE_NATPMP
typedef struct
{
ftenet_generic_connection_t pub ;
ftenet_connections_t * col ;
netadr_t reqpmpaddr ;
netadr_t pmpaddr ;
netadr_t natadr ;
unsigned int refreshtime ;
} pmpcon_t ;
2014-02-07 08:38:40 +00:00
int FTENET_NATPMP_GetLocalAddresses ( struct ftenet_generic_connection_s * con , unsigned int * adrflags , netadr_t * addresses , int maxaddresses ) ;
2013-03-31 04:21:08 +00:00
static qboolean NET_Was_NATPMP ( ftenet_connections_t * collection )
{
pmpcon_t * pmp ;
struct
{
qbyte ver ; qbyte op ; short resultcode ;
int age ;
union
{
struct
{
short privport ; short pubport ;
int mapping_expectancy ;
} ;
qbyte ipv4 [ 4 ] ;
} ;
} * pmpreqrep ;
int i ;
for ( i = 0 ; i < MAX_CONNECTIONS ; i + + )
{
if ( ! collection - > conn [ i ] )
continue ;
2014-02-07 08:38:40 +00:00
if ( collection - > conn [ i ] - > GetLocalAddresses = = FTENET_NATPMP_GetLocalAddresses )
2013-03-31 04:21:08 +00:00
{
pmp = ( pmpcon_t * ) collection - > conn [ i ] ;
2013-05-03 04:28:08 +00:00
if ( NET_CompareAdr ( & pmp - > pmpaddr , & net_from ) )
2013-03-31 04:21:08 +00:00
{
pmpreqrep = ( void * ) net_message . data ;
if ( pmpreqrep - > ver ! = 0 )
return false ;
if ( net_message . cursize = = 12 & & pmpreqrep - > op = = 128 )
{
char adrbuf [ 256 ] ;
pmp - > natadr . type = NA_IP ;
pmp - > natadr . port = 0 ;
memcpy ( pmp - > natadr . address . ip , pmpreqrep - > ipv4 , sizeof ( pmp - > natadr . address . ip ) ) ;
2013-05-03 04:28:08 +00:00
NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & pmp - > natadr ) ;
2014-02-07 08:38:40 +00:00
pmp - > natadr . connum = i + 1 ;
2013-11-21 23:02:28 +00:00
Con_DPrintf ( " NAT-PMP: Public ip is %s \n " , adrbuf ) ;
2014-02-22 00:28:22 +00:00
# ifdef SUPPORT_ICE
2013-11-21 23:02:28 +00:00
if ( pmp - > natadr . type & & pmp - > natadr . port )
ICE_AddLCandidateConn ( collection , & pmp - > natadr , ICE_SRFLX ) ; //let ICE connections know about it
2014-02-22 00:28:22 +00:00
# endif
2013-03-31 04:21:08 +00:00
return true ;
}
if ( net_message . cursize = = 16 & & pmpreqrep - > op = = 129 )
{
switch ( BigShort ( pmpreqrep - > resultcode ) )
{
case 0 :
break ;
case 1 :
Con_Printf ( " NAT-PMP: unsupported version \n " ) ;
return true ;
case 2 :
Con_Printf ( " NAT-PMP: refused - please reconfigure router \n " ) ;
return true ;
case 3 :
Con_Printf ( " NAT-PMP: network failure \n " ) ;
return true ;
case 4 :
Con_Printf ( " NAT-PMP: out of resources \n " ) ;
return true ;
case 5 :
Con_Printf ( " NAT-PMP: unsupported opcode \n " ) ;
return true ;
default :
return false ;
}
2013-11-21 23:02:28 +00:00
Con_DPrintf ( " NAT-PMP: Local port %u publically available on port %u \n " , ( unsigned short ) BigShort ( pmpreqrep - > privport ) , ( unsigned short ) BigShort ( pmpreqrep - > pubport ) ) ;
2013-03-31 04:21:08 +00:00
pmp - > natadr . port = pmpreqrep - > pubport ;
2013-11-21 23:02:28 +00:00
2014-02-22 00:28:22 +00:00
# ifdef SUPPORT_ICE
2013-11-21 23:02:28 +00:00
if ( pmp - > natadr . type & & pmp - > natadr . port )
ICE_AddLCandidateConn ( collection , & pmp - > natadr , ICE_SRFLX ) ;
2014-02-22 00:28:22 +00:00
# endif
2013-03-31 04:21:08 +00:00
return true ;
}
return false ;
}
}
}
return false ;
}
static void FTENET_NATPMP_Refresh ( pmpcon_t * pmp , short oldport , ftenet_connections_t * collection )
{
2014-02-07 08:38:40 +00:00
int i , m ;
2013-03-31 04:21:08 +00:00
netadr_t adr ;
2018-06-18 16:44:29 +00:00
2014-02-07 08:38:40 +00:00
netadr_t addr [ 64 ] ;
struct ftenet_generic_connection_s * con [ sizeof ( addr ) / sizeof ( addr [ 0 ] ) ] ;
int flags [ sizeof ( addr ) / sizeof ( addr [ 0 ] ) ] ;
2013-03-31 04:21:08 +00:00
struct
{
qbyte ver ; qbyte op ; short reserved1 ;
short privport ; short pubport ;
int mapping_expectancy ;
} pmpreqmsg ;
pmpreqmsg . ver = 0 ;
pmpreqmsg . op = 1 ;
pmpreqmsg . reserved1 = BigShort ( 0 ) ;
pmpreqmsg . privport = BigShort ( 0 ) ;
pmpreqmsg . pubport = BigShort ( 0 ) ;
pmpreqmsg . mapping_expectancy = BigLong ( 60 * 5 ) ;
if ( ! collection )
return ;
2014-02-07 08:38:40 +00:00
m = NET_EnumerateAddresses ( collection , con , flags , addr , sizeof ( addr ) / sizeof ( addr [ 0 ] ) ) ;
for ( i = 0 ; i < m ; i + + )
2013-03-31 04:21:08 +00:00
{
2014-02-07 08:38:40 +00:00
//ignore any ips which are proxied by other people. that would be too weird.
if ( flags [ i ] & ( ADDR_NATPMP | ADDR_UPNPIGP ) )
2013-03-31 04:21:08 +00:00
continue ;
2014-02-07 08:38:40 +00:00
adr = addr [ i ] ;
//unipv6ify it if its a hybrid socket.
if ( adr . type = = NA_IPV6 & &
! * ( int * ) & adr . address . ip6 [ 0 ] & &
! * ( int * ) & adr . address . ip6 [ 4 ] & &
! * ( short * ) & adr . address . ip6 [ 8 ] & &
2018-06-18 16:44:29 +00:00
* ( short * ) & adr . address . ip6 [ 10 ] = = ( short ) 0xffff & &
2014-02-07 08:38:40 +00:00
! * ( int * ) & adr . address . ip6 [ 12 ] )
2013-03-31 04:21:08 +00:00
{
2014-02-07 08:38:40 +00:00
* ( int * ) adr . address . ip = * ( int * ) & adr . address . ip6 [ 12 ] ;
adr . type = NA_IP ;
}
2013-03-31 04:21:08 +00:00
2014-02-07 08:38:40 +00:00
if ( adr . type = = NA_IP )
{
if ( adr . address . ip [ 0 ] = = 127 ) //yes. loopback has a lot of ip addresses. wasteful but whatever.
continue ;
2013-03-31 04:21:08 +00:00
2014-02-07 08:38:40 +00:00
//assume a netmask of 255.255.255.0
adr . address . ip [ 3 ] = 1 ;
}
// else if (adr.type == NA_IPV6)
// {
// }
else
continue ;
2013-03-31 04:21:08 +00:00
2014-02-07 08:38:40 +00:00
pmpreqmsg . privport = adr . port ;
pmpreqmsg . pubport = oldport ? oldport : adr . port ;
2013-03-31 04:21:08 +00:00
2014-02-07 08:38:40 +00:00
if ( * ( int * ) pmp - > reqpmpaddr . address . ip = = INADDR_ANY )
{
pmp - > pmpaddr = adr ;
pmp - > pmpaddr . port = pmp - > reqpmpaddr . port ;
}
else
pmp - > pmpaddr = pmp - > reqpmpaddr ;
2013-03-31 04:21:08 +00:00
2014-02-07 08:38:40 +00:00
if ( * ( int * ) pmp - > pmpaddr . address . ip = = INADDR_ANY )
continue ;
2013-04-04 08:08:49 +00:00
2014-02-07 08:38:40 +00:00
//get the public ip.
pmpreqmsg . op = 0 ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( collection , 2 , & pmpreqmsg , & pmp - > pmpaddr ) ;
2013-03-31 04:21:08 +00:00
2014-02-07 08:38:40 +00:00
//open the firewall/nat.
pmpreqmsg . op = 1 ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( collection , sizeof ( pmpreqmsg ) , & pmpreqmsg , & pmp - > pmpaddr ) ;
2013-04-04 08:08:49 +00:00
2014-02-07 08:38:40 +00:00
break ;
2013-03-31 04:21:08 +00:00
}
}
# define PMP_POLL_TIME (1000*30) //every 30 seconds
2014-02-07 08:38:40 +00:00
qboolean Net_OpenUDPPort ( char * privateip , int privateport , char * publicip , size_t publiciplen , int * publicport ) ;
int FTENET_NATPMP_GetLocalAddresses ( struct ftenet_generic_connection_s * con , unsigned int * adrflags , netadr_t * addresses , int maxaddresses )
2013-03-31 04:21:08 +00:00
{
pmpcon_t * pmp = ( pmpcon_t * ) con ;
2014-02-07 08:38:40 +00:00
/*
char pubip [ 256 ] ;
int pubport ;
2013-03-31 04:21:08 +00:00
2014-02-07 08:38:40 +00:00
if ( Net_OpenUDPPort ( " 192.168.1.4 " , 27500 , pubip , sizeof ( pubip ) , & pubport ) )
{
* adrflags = ADDR_UPNPIGP ;
NET_StringToAdr ( pubip , pubport , addresses ) ;
return 1 ;
}
*/
if ( maxaddresses )
{
* adrflags = ADDR_NATPMP ;
* addresses = pmp - > natadr ;
return ( pmp - > natadr . type ! = NA_INVALID ) & & ( pmp - > natadr . port ! = 0 ) ;
}
return 0 ;
2013-03-31 04:21:08 +00:00
}
qboolean FTENET_NATPMP_GetPacket ( struct ftenet_generic_connection_s * con )
{
pmpcon_t * pmp = ( pmpcon_t * ) con ;
unsigned int now = Sys_Milliseconds ( ) ;
if ( now - pmp - > refreshtime > PMP_POLL_TIME ) //weird logic to cope with wrapping
{
pmp - > refreshtime = now ;
FTENET_NATPMP_Refresh ( pmp , pmp - > natadr . port , pmp - > col ) ;
}
return false ;
}
2016-07-12 00:40:13 +00:00
neterr_t FTENET_NATPMP_SendPacket ( struct ftenet_generic_connection_s * con , int length , const void * data , netadr_t * to )
2013-03-31 04:21:08 +00:00
{
2018-06-18 16:44:29 +00:00
return NETERR_NOROUTE ;
2013-03-31 04:21:08 +00:00
}
2013-04-04 08:08:49 +00:00
void FTENET_NATPMP_Close ( struct ftenet_generic_connection_s * con )
2013-03-31 04:21:08 +00:00
{
//FIXME: we should send a packet to close the port
Z_Free ( con ) ;
}
2013-11-21 23:02:28 +00:00
//qboolean Net_OpenUDPPort(char *privateip, int privateport, char *publicip, size_t publiciplen, int *publicport);
2015-12-12 19:25:15 +00:00
ftenet_generic_connection_t * FTENET_NATPMP_EstablishConnection ( qboolean isserver , const char * address , netadr_t pmpadr )
2013-03-31 04:21:08 +00:00
{
pmpcon_t * pmp ;
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
if ( pmpadr . prot = = NP_NATPMP )
pmpadr . prot = NP_DGRAM ;
2013-03-31 04:21:08 +00:00
if ( pmpadr . type ! = NA_IP )
return NULL ;
2014-02-07 08:38:40 +00:00
2013-03-31 04:21:08 +00:00
pmp = Z_Malloc ( sizeof ( * pmp ) ) ;
pmp - > col = svs . sockets ;
Q_strncpyz ( pmp - > pub . name , " natpmp " , sizeof ( pmp - > pub . name ) ) ;
pmp - > reqpmpaddr = pmpadr ;
2014-02-07 08:38:40 +00:00
pmp - > pub . GetLocalAddresses = FTENET_NATPMP_GetLocalAddresses ;
2013-03-31 04:21:08 +00:00
pmp - > pub . GetPacket = FTENET_NATPMP_GetPacket ;
//qboolean (*ChangeLocalAddress)(struct ftenet_generic_connection_s *con, const char *newaddress);
pmp - > pub . SendPacket = FTENET_NATPMP_SendPacket ;
pmp - > pub . Close = FTENET_NATPMP_Close ;
pmp - > pub . thesocket = INVALID_SOCKET ;
pmp - > refreshtime = Sys_Milliseconds ( ) + PMP_POLL_TIME * 64 ;
2013-11-21 23:02:28 +00:00
// Net_OpenUDPPort();
2013-03-31 04:21:08 +00:00
return & pmp - > pub ;
}
# endif
2006-05-09 00:02:05 +00:00
2017-05-18 10:24:09 +00:00
# ifdef HAVE_DTLS
struct dtlspeer_s
{
2017-06-21 01:24:25 +00:00
const dtlsfuncs_t * funcs ;
2017-05-18 10:24:09 +00:00
ftenet_connections_t * col ;
void * dtlsstate ;
netadr_t addr ;
float timeout ;
struct dtlspeer_s * next ;
struct dtlspeer_s * * link ;
} ;
void NET_DTLS_Timeouts ( ftenet_connections_t * col )
{
2018-10-23 07:09:06 +00:00
struct dtlspeer_s * peer , * * link ;
2017-05-18 10:24:09 +00:00
if ( ! col )
return ;
2018-10-23 07:09:06 +00:00
for ( link = & col - > dtls ; ( peer = * link ) ; )
2017-05-18 10:24:09 +00:00
{
2018-10-23 07:09:06 +00:00
if ( peer - > timeout < realtime )
{
peer - > funcs - > DestroyContext ( peer - > dtlsstate ) ;
* link = peer - > next ;
continue ;
}
2017-06-21 01:24:25 +00:00
peer - > funcs - > Timeouts ( peer - > dtlsstate ) ;
2018-10-23 07:09:06 +00:00
link = & peer - > next ;
2017-05-18 10:24:09 +00:00
}
}
2017-06-21 01:24:25 +00:00
const dtlsfuncs_t * DTLS_InitServer ( void )
{
2018-10-23 07:09:06 +00:00
const dtlsfuncs_t * f = NULL ;
# ifdef HAVE_GNUTLS
if ( ! f )
f = GNUDTLS_InitServer ( ) ;
2017-06-21 01:24:25 +00:00
# endif
2018-10-23 07:09:06 +00:00
# ifdef HAVE_OPENSSL
if ( ! f )
f = OSSL_InitServer ( ) ;
# endif
# ifdef HAVE_WINSSPI
if ( ! f )
f = SSPI_DTLS_InitServer ( ) ;
# endif
return f ;
2017-06-21 01:24:25 +00:00
}
const dtlsfuncs_t * DTLS_InitClient ( void )
{
2018-10-23 07:09:06 +00:00
const dtlsfuncs_t * f = NULL ;
2017-06-21 01:24:25 +00:00
# ifdef HAVE_WINSSPI
2018-10-23 07:09:06 +00:00
if ( ! f )
f = SSPI_DTLS_InitClient ( ) ;
2017-06-21 01:24:25 +00:00
# endif
2018-10-23 07:09:06 +00:00
# ifdef HAVE_GNUTLS
if ( ! f )
f = GNUDTLS_InitClient ( ) ;
# endif
# ifdef HAVE_OPENSSL
if ( ! f )
f = OSSL_InitClient ( ) ;
# endif
return f ;
2017-06-21 01:24:25 +00:00
}
2017-05-18 10:24:09 +00:00
static neterr_t NET_SendPacketCol ( ftenet_connections_t * collection , int length , const void * data , netadr_t * to ) ;
static neterr_t FTENET_DTLS_DoSendPacket ( void * cbctx , const qbyte * data , size_t length )
{ //callback that does the actual sending
struct dtlspeer_s * peer = cbctx ;
return NET_SendPacketCol ( peer - > col , length , data , & peer - > addr ) ;
}
qboolean NET_DTLS_Create ( ftenet_connections_t * col , netadr_t * to )
{
2018-10-23 07:09:06 +00:00
extern cvar_t timeout ;
2017-05-18 10:24:09 +00:00
struct dtlspeer_s * peer ;
if ( to - > prot ! = NP_DGRAM )
return false ;
for ( peer = col - > dtls ; peer ; peer = peer - > next )
{
if ( NET_CompareAdr ( & peer - > addr , to ) )
break ;
}
if ( ! peer )
{
char hostname [ 256 ] ;
peer = Z_Malloc ( sizeof ( * peer ) ) ;
peer - > addr = * to ;
peer - > col = col ;
2017-06-21 01:24:25 +00:00
if ( col - > islisten )
peer - > funcs = DTLS_InitServer ( ) ;
else
peer - > funcs = DTLS_InitClient ( ) ;
if ( peer - > funcs )
peer - > dtlsstate = peer - > funcs - > CreateContext ( NET_BaseAdrToString ( hostname , sizeof ( hostname ) , to ) , peer , FTENET_DTLS_DoSendPacket , col - > islisten ) ;
2018-10-23 07:09:06 +00:00
peer - > timeout = realtime + timeout . value ;
2017-06-21 01:24:25 +00:00
if ( peer - > dtlsstate )
{
if ( peer - > next )
peer - > next - > link = & peer - > next ;
peer - > link = & col - > dtls ;
peer - > next = col - > dtls ;
col - > dtls = peer ;
}
else
{
Z_Free ( peer ) ;
peer = NULL ;
}
2017-05-18 10:24:09 +00:00
}
2017-06-21 01:24:25 +00:00
return peer ! = NULL ;
2017-05-18 10:24:09 +00:00
}
static void NET_DTLS_DisconnectPeer ( ftenet_connections_t * col , struct dtlspeer_s * peer )
{
// Sys_Printf("Destroy %p\n", peer->dtlsstate);
if ( peer - > next )
peer - > next - > link = peer - > link ;
* peer - > link = peer - > next ;
2017-06-21 01:24:25 +00:00
peer - > funcs - > DestroyContext ( peer - > dtlsstate ) ;
2017-05-18 10:24:09 +00:00
Z_Free ( peer ) ;
}
qboolean NET_DTLS_Disconnect ( ftenet_connections_t * col , netadr_t * to )
{
struct dtlspeer_s * peer ;
netadr_t n = * to ;
if ( ! col | | ( to - > prot ! = NP_DGRAM & & to - > prot ! = NP_DTLS ) )
return false ;
n . prot = NP_DGRAM ;
for ( peer = col - > dtls ; peer ; peer = peer - > next )
{
if ( NET_CompareAdr ( & peer - > addr , & n ) )
{
NET_DTLS_DisconnectPeer ( col , peer ) ;
break ;
}
}
return peer ? true : false ;
}
static neterr_t FTENET_DTLS_SendPacket ( ftenet_connections_t * col , int length , const void * data , netadr_t * to )
{
struct dtlspeer_s * peer ;
to - > prot = NP_DGRAM ;
for ( peer = col - > dtls ; peer ; peer = peer - > next )
{
if ( NET_CompareAdr ( & peer - > addr , to ) )
break ;
}
to - > prot = NP_DTLS ;
if ( peer )
2017-06-21 01:24:25 +00:00
return peer - > funcs - > Transmit ( peer - > dtlsstate , data , length ) ;
2017-05-18 10:24:09 +00:00
else
return NETERR_NOROUTE ;
}
qboolean NET_DTLS_Decode ( ftenet_connections_t * col )
{
2018-10-23 07:09:06 +00:00
extern cvar_t timeout ;
2017-05-18 10:24:09 +00:00
struct dtlspeer_s * peer ;
for ( peer = col - > dtls ; peer ; peer = peer - > next )
{
if ( NET_CompareAdr ( & peer - > addr , & net_from ) )
{
2018-10-23 07:09:06 +00:00
peer - > timeout = realtime + timeout . value ; //refresh the timeout if our peer is still alive.
2017-06-21 01:24:25 +00:00
switch ( peer - > funcs - > Received ( peer - > dtlsstate , net_message . data , net_message . cursize ) )
2017-05-18 10:24:09 +00:00
{
case NETERR_DISCONNECTED :
Sys_Printf ( " disconnected %p \n " , peer - > dtlsstate ) ;
NET_DTLS_DisconnectPeer ( col , peer ) ;
break ;
case NETERR_NOROUTE :
return false ; //not a valid dtls packet.
default :
case NETERR_CLOGGED :
//ate it
net_message . cursize = 0 ;
break ;
case NETERR_SENT :
//we decoded it properly
break ;
}
net_from . prot = NP_DTLS ;
return true ;
}
}
return false ;
}
# endif
2018-11-19 06:37:25 +00:00
size_t NET_GetConnectionCertificate ( struct ftenet_connections_s * col , netadr_t * a , enum certprops_e prop , char * out , size_t outsize )
{
if ( ! col )
return 0 ;
switch ( prop )
{
default :
break ;
case QCERT_PEERFINGERPRINT :
#if 0 //def HAVE_DTLS
if ( a - > prot = = NP_DTLS )
{
struct dtlspeer_s * peer ;
{
a - > prot = NP_DGRAM ;
for ( peer = col - > dtls ; peer ; peer = peer - > next )
{
if ( NET_CompareAdr ( & peer - > addr , a ) )
break ;
}
a - > prot = NP_DTLS ;
}
if ( peer )
return peer - > funcs - > GetPeerCertificate ( peer - > dtlsstate , data , length ) ;
}
# endif
return 0 ;
}
return 0 ;
}
2017-05-18 10:24:09 +00:00
2015-12-12 19:25:15 +00:00
static qboolean FTENET_AddToCollection_Ptr ( ftenet_connections_t * col , const char * name , ftenet_generic_connection_t * ( * establish ) ( qboolean isserver , const char * address , netadr_t adr ) , qboolean islisten , const char * address , netadr_t * adr )
2008-11-09 22:29:28 +00:00
{
2012-01-01 06:25:51 +00:00
int count = 0 ;
2008-11-09 22:29:28 +00:00
int i ;
2013-03-31 04:21:08 +00:00
2008-11-09 22:29:28 +00:00
if ( ! col )
return false ;
2013-11-21 23:02:28 +00:00
if ( name )
{
for ( i = 0 ; i < MAX_CONNECTIONS ; i + + )
{
if ( col - > conn [ i ] )
2016-07-12 00:40:13 +00:00
if ( * col - > conn [ i ] - > name & & ! strcmp ( col - > conn [ i ] - > name , name ) )
2013-11-21 23:02:28 +00:00
{
2015-12-12 19:25:15 +00:00
if ( adr & & adr - > type ! = NA_INVALID & & islisten )
2013-11-21 23:02:28 +00:00
if ( col - > conn [ i ] - > ChangeLocalAddress )
{
2015-12-12 19:25:15 +00:00
if ( col - > conn [ i ] - > ChangeLocalAddress ( col - > conn [ i ] , adr ) )
2013-11-21 23:02:28 +00:00
return true ;
}
col - > conn [ i ] - > Close ( col - > conn [ i ] ) ;
col - > conn [ i ] = NULL ;
}
}
}
2015-12-12 19:25:15 +00:00
if ( adr & & establish )
2013-11-21 23:02:28 +00:00
{
for ( i = 0 ; i < MAX_CONNECTIONS ; i + + )
{
if ( ! col - > conn [ i ] )
{
2015-12-12 19:25:15 +00:00
col - > conn [ i ] = establish ( islisten , address , * adr ) ;
2013-11-21 23:02:28 +00:00
if ( ! col - > conn [ i ] )
break ;
if ( name )
Q_strncpyz ( col - > conn [ i ] - > name , name , sizeof ( col - > conn [ i ] - > name ) ) ;
count + + ;
break ;
}
}
}
return count > 0 ;
}
2017-06-21 01:24:25 +00:00
qboolean FTENET_AddToCollection ( ftenet_connections_t * col , const char * name , const char * addresslist , netadrtype_t addrtype , netproto_t addrprot )
2013-11-21 23:02:28 +00:00
{
2017-06-21 01:24:25 +00:00
qboolean islisten ;
2015-12-28 17:41:39 +00:00
netadr_t adr [ 8 ] ;
ftenet_generic_connection_t * ( * establish [ countof ( adr ) ] ) ( qboolean isserver , const char * address , netadr_t adr ) ;
char address [ countof ( adr ) ] [ 256 ] ;
unsigned int i , j ;
2016-02-15 06:01:17 +00:00
qboolean success = false ;
2013-11-21 23:02:28 +00:00
2017-06-21 01:24:25 +00:00
if ( ! col )
return false ;
islisten = col - > islisten ;
2016-07-12 00:40:13 +00:00
if ( name & & strchr ( name , ' : ' ) )
2015-12-28 17:41:39 +00:00
return false ;
2013-03-31 04:21:08 +00:00
2015-12-28 17:41:39 +00:00
for ( i = 0 ; addresslist & & * addresslist & & i < countof ( adr ) ; i + + )
2013-03-31 04:21:08 +00:00
{
2015-12-28 17:41:39 +00:00
addresslist = COM_ParseStringSet ( addresslist , address [ i ] , sizeof ( address [ i ] ) ) ;
//resolve the address to something sane so we can determine the address type and thus the connection type to use
if ( ! * address [ i ] )
adr [ i ] . type = NA_INVALID ;
2017-06-21 01:24:25 +00:00
else //if (islisten)
{
if ( ! NET_PortToAdr ( addrtype , addrprot , address [ i ] , & adr [ i ] ) )
return false ;
}
/* else
2016-02-15 06:01:17 +00:00
{
if ( ! NET_StringToAdr ( address [ i ] , 0 , & adr [ i ] ) )
return false ;
}
2017-06-21 01:24:25 +00:00
*/
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
# ifdef HAVE_WEBSOCKCL
if ( adr [ i ] . prot = = NP_WS & & adr [ i ] . type = = NA_WEBSOCKET ) establish [ i ] = FTENET_WebSocket_EstablishConnection ; else
if ( adr [ i ] . prot = = NP_WSS & & adr [ i ] . type = = NA_WEBSOCKET ) establish [ i ] = FTENET_WebSocket_EstablishConnection ; else
if ( adr [ i ] . prot = = NP_DTLS & & adr [ i ] . type = = NA_WEBSOCKET ) establish [ i ] = FTENET_WebSocket_EstablishConnection ; else
# endif
2013-03-31 04:21:08 +00:00
# ifdef HAVE_NATPMP
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
if ( adr [ i ] . prot = = NP_NATPMP & & adr [ i ] . type = = NA_IP ) establish [ i ] = FTENET_NATPMP_EstablishConnection ; else
2013-03-31 04:21:08 +00:00
# endif
2018-12-28 00:04:36 +00:00
# if defined(HAVE_CLIENT) && defined(HAVE_SERVER)
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
if ( adr [ i ] . prot = = NP_DGRAM & & adr [ i ] . type = = NA_LOOPBACK ) establish [ i ] = FTENET_Loop_EstablishConnection ; else
2013-03-31 04:21:08 +00:00
# endif
# ifdef HAVE_IPV4
2017-05-18 10:24:09 +00:00
if ( ( adr [ i ] . prot = = NP_DGRAM ) & & adr [ i ] . type = = NA_IP ) establish [ i ] = FTENET_Datagram_EstablishConnection ; else
2013-03-31 04:21:08 +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
# ifdef HAVE_IPV6
2017-05-18 10:24:09 +00:00
if ( ( adr [ i ] . prot = = NP_DGRAM ) & & adr [ i ] . type = = NA_IPV6 ) establish [ i ] = FTENET_Datagram_EstablishConnection ; else
2013-03-31 04:21:08 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
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
if ( adr [ i ] . prot = = NP_DGRAM & & adr [ i ] . type = = NA_IPX ) establish [ i ] = FTENET_Datagram_EstablishConnection ; else
2013-03-31 04:21:08 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
if ( adr [ i ] . prot = = NP_DGRAM & & adr [ i ] . type = = NA_UNIX ) establish [ i ] = FTENET_Datagram_EstablishConnection ; else
# if defined(TCPCONNECT)
if ( adr [ i ] . prot = = NP_STREAM & & adr [ i ] . type = = NA_UNIX ) establish [ i ] = FTENET_TCPConnect_EstablishConnection ; else
if ( adr [ i ] . prot = = NP_WS & & adr [ i ] . type = = NA_UNIX ) establish [ i ] = FTENET_TCPConnect_EstablishConnection ; else
if ( adr [ i ] . prot = = NP_TLS & & adr [ i ] . type = = NA_UNIX ) establish [ i ] = FTENET_TCPConnect_EstablishConnection ; else
# endif
# 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
# if defined(TCPCONNECT) && defined(HAVE_IPV4)
if ( adr [ i ] . prot = = NP_WS & & adr [ i ] . type = = NA_IP ) establish [ i ] = FTENET_TCPConnect_EstablishConnection ; else
if ( adr [ i ] . prot = = NP_STREAM & & adr [ i ] . type = = NA_IP ) establish [ i ] = FTENET_TCPConnect_EstablishConnection ; else
if ( adr [ i ] . prot = = NP_TLS & & adr [ i ] . type = = NA_IP ) establish [ i ] = FTENET_TCPConnect_EstablishConnection ; else
2013-03-31 04:21:08 +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
# if defined(TCPCONNECT) && defined(HAVE_IPV6)
if ( adr [ i ] . prot = = NP_WS & & adr [ i ] . type = = NA_IPV6 ) establish [ i ] = FTENET_TCPConnect_EstablishConnection ; else
if ( adr [ i ] . prot = = NP_STREAM & & adr [ i ] . type = = NA_IPV6 ) establish [ i ] = FTENET_TCPConnect_EstablishConnection ; else
if ( adr [ i ] . prot = = NP_TLS & & adr [ i ] . type = = NA_IPV6 ) establish [ i ] = FTENET_TCPConnect_EstablishConnection ; else
2013-03-31 04:21:08 +00:00
# endif
# ifdef IRCCONNECT
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
if ( adr [ i ] . prot = = NP_TLS ) establish [ i ] = FTENET_IRCConnect_EstablishConnection ; else
2013-03-31 04:21:08 +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
establish [ i ] = NULL ;
2013-03-31 04:21:08 +00:00
}
2015-12-28 17:41:39 +00:00
if ( i = = 1 )
{
success | = FTENET_AddToCollection_Ptr ( col , name , establish [ 0 ] , islisten , address [ 0 ] , & adr [ 0 ] ) ;
i = 0 ;
}
else
success | = FTENET_AddToCollection_Ptr ( col , name , NULL , islisten , NULL , NULL ) ;
for ( j = 0 ; j < i ; j + + )
{
success | = FTENET_AddToCollection_Ptr ( col , va ( " %s:%i " , name , j ) , establish [ j ] , islisten , address [ j ] , & adr [ j ] ) ;
}
for ( ; j < countof ( adr ) ; j + + )
{
success | = FTENET_AddToCollection_Ptr ( col , va ( " %s:%i " , name , j ) , NULL , islisten , NULL , NULL ) ;
}
return success ;
2006-05-09 00:02:05 +00:00
}
2008-11-09 22:29:28 +00:00
void FTENET_CloseCollection ( ftenet_connections_t * col )
2006-05-09 00:02:05 +00:00
{
2008-12-02 21:54:10 +00:00
int i ;
2008-12-03 01:57:02 +00:00
if ( ! col )
return ;
2008-12-02 21:54:10 +00:00
for ( i = 0 ; i < MAX_CONNECTIONS ; i + + )
{
if ( col - > conn [ i ] )
{
col - > conn [ i ] - > Close ( col - > conn [ i ] ) ;
2016-07-12 00:40:13 +00:00
col - > conn [ i ] = NULL ;
2008-12-02 21:54:10 +00:00
}
}
2008-11-09 22:29:28 +00:00
Z_Free ( col ) ;
}
2006-05-09 00:02:05 +00:00
2008-11-09 22:29:28 +00:00
void FTENET_Generic_Close ( ftenet_generic_connection_t * con )
{
2012-04-09 19:12:12 +00:00
# ifdef HAVE_PACKET
2008-11-09 22:29:28 +00:00
if ( con - > thesocket ! = INVALID_SOCKET )
closesocket ( con - > thesocket ) ;
2012-04-09 19:12:12 +00:00
# endif
2008-11-09 22:29:28 +00:00
Z_Free ( con ) ;
}
2014-03-30 08:55:06 +00:00
# if defined(_WIN32) && defined(HAVE_PACKET)
2014-02-07 08:38:40 +00:00
int FTENET_GetLocalAddress ( int port , qboolean ipx , qboolean ipv4 , qboolean ipv6 , unsigned int * adrflags , netadr_t * addresses , int maxaddresses )
2013-11-24 16:35:52 +00:00
{
//in win32, we can look up our own hostname to retrieve a list of local interface addresses.
char adrs [ MAX_ADR_SIZE ] ;
2014-02-07 08:38:40 +00:00
int found = 0 ;
2013-11-24 16:35:52 +00:00
gethostname ( adrs , sizeof ( adrs ) ) ;
2019-02-16 19:09:07 +00:00
# ifndef pgetaddrinfo
if ( ! pgetaddrinfo )
{
struct hostent * h = gethostbyname ( adrs ) ;
int b = 0 ;
# ifdef HAVE_IPV4
if ( h & & h - > h_addrtype = = AF_INET )
{
for ( b = 0 ; h - > h_addr_list [ b ] & & maxaddresses ; b + + )
{
struct sockaddr_in from ;
from . sin_family = AF_INET ;
from . sin_port = port ;
memcpy ( & from . sin_addr , h - > h_addr_list [ b ] , sizeof ( from . sin_addr ) ) ;
SockadrToNetadr ( ( struct sockaddr_qstorage * ) & from , sizeof ( from ) , addresses ) ;
* adrflags + + = 0 ;
addresses + + ;
maxaddresses - - ;
found + + ;
}
}
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2019-02-16 19:09:07 +00:00
if ( h & & h - > h_addrtype = = AF_INET6 )
{
for ( b = 0 ; h - > h_addr_list [ b ] & & maxaddresses ; b + + )
{
struct sockaddr_in6 from ;
from . sin6_family = AF_INET6 ;
from . sin6_port = port ;
from . sin6_scope_id = 0 ;
memcpy ( & from . sin6_addr , h - > h_addr_list [ b ] , sizeof ( ( ( struct sockaddr_in6 * ) & from ) - > sin6_addr ) ) ;
SockadrToNetadr ( ( struct sockaddr_qstorage * ) & from , sizeof ( from ) , addresses ) ;
* adrflags + + = 0 ;
addresses + + ;
maxaddresses - - ;
found + + ;
}
}
# endif
}
else
# endif
2013-11-24 16:35:52 +00:00
{
struct addrinfo hints , * result , * itr ;
memset ( & hints , 0 , sizeof ( struct addrinfo ) ) ;
hints . ai_family = 0 ; /* Allow IPv4 or IPv6 */
hints . ai_socktype = SOCK_DGRAM ; /* Datagram socket */
hints . ai_flags = 0 ;
hints . ai_protocol = 0 ; /* Any protocol */
if ( pgetaddrinfo ( adrs , NULL , & hints , & result ) = = 0 )
{
for ( itr = result ; itr ; itr = itr - > ai_next )
{
2019-02-16 19:09:07 +00:00
if ( 0
# ifdef HAVE_IPV4
| | ( itr - > ai_addr - > sa_family = = AF_INET & & ipv4 )
# endif
# ifdef HAVE_IPV6
2013-11-24 16:35:52 +00:00
| | ( itr - > ai_addr - > sa_family = = AF_INET6 & & ipv6 )
2019-02-16 19:09:07 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2013-11-24 16:35:52 +00:00
| | ( itr - > ai_addr - > sa_family = = AF_IPX & & ipx )
# endif
)
2014-02-07 08:38:40 +00:00
if ( maxaddresses )
2013-11-24 16:35:52 +00:00
{
2018-09-23 19:35:24 +00:00
SockadrToNetadr ( ( struct sockaddr_qstorage * ) itr - > ai_addr , sizeof ( struct sockaddr_qstorage ) , addresses ) ;
2014-02-07 08:38:40 +00:00
addresses - > port = port ;
* adrflags + + = 0 ;
addresses + + ;
maxaddresses - - ;
found + + ;
2013-11-24 16:35:52 +00:00
}
}
2019-07-19 02:13:19 +00:00
freeaddrinfo ( result ) ;
2013-11-24 16:35:52 +00:00
/*if none found, fill in the 0.0.0.0 or whatever*/
2014-02-07 08:38:40 +00:00
if ( ! found & & maxaddresses )
2013-11-24 16:35:52 +00:00
{
2014-02-07 08:38:40 +00:00
memset ( addresses , 0 , sizeof ( * addresses ) ) ;
addresses - > port = port ;
2013-11-24 16:35:52 +00:00
if ( ipv6 )
2014-02-07 08:38:40 +00:00
addresses - > type = NA_IPV6 ;
2013-11-24 16:35:52 +00:00
else if ( ipv4 )
2014-02-07 08:38:40 +00:00
addresses - > type = NA_IP ;
2013-11-24 16:35:52 +00:00
else if ( ipx )
2014-02-07 08:38:40 +00:00
addresses - > type = NA_IPX ;
2013-11-24 16:35:52 +00:00
else
2014-02-07 08:38:40 +00:00
addresses - > type = NA_INVALID ;
* adrflags + + = 0 ;
addresses + + ;
maxaddresses - - ;
found + + ;
2013-11-24 16:35:52 +00:00
}
}
}
2014-02-07 08:38:40 +00:00
return found ;
2013-11-24 16:35:52 +00:00
}
2013-11-28 00:45:22 +00:00
# elif defined(__linux__) && !defined(ANDROID)
2013-11-24 16:35:52 +00:00
//in linux, looking up our own hostname to retrieve a list of local interface addresses will give no indication that other systems are able to do the same thing and is thus not supported.
//there's some special api instead
//glibc 2.3.
2015-06-14 08:16:15 +00:00
//also available with certain bsds, I'm but unsure which preprocessor we can use.
2013-11-24 16:35:52 +00:00
# include <ifaddrs.h>
static struct ifaddrs * iflist ;
unsigned int iftime ; //requery sometimes.
2014-02-07 09:36:04 +00:00
int FTENET_GetLocalAddress ( int port , qboolean ipx , qboolean ipv4 , qboolean ipv6 , unsigned int * adrflags , netadr_t * addresses , int maxaddresses )
2013-11-24 16:35:52 +00:00
{
struct ifaddrs * ifa ;
int fam ;
2014-02-07 09:36:04 +00:00
int idx = 0 ;
2013-11-24 16:35:52 +00:00
unsigned int time = Sys_Milliseconds ( ) ;
2019-02-16 19:09:07 +00:00
ipv4 = ipv4 & & net_dns_ipv4 . ival ;
ipv6 = ipv6 & & net_dns_ipv6 . ival ;
2013-11-24 16:35:52 +00:00
if ( time - iftime > 1000 & & iflist )
{
2013-11-24 16:47:17 +00:00
freeifaddrs ( iflist ) ;
2013-11-24 16:35:52 +00:00
iflist = NULL ;
}
if ( ! iflist )
{
iftime = time ;
getifaddrs ( & iflist ) ;
}
2014-02-07 09:36:04 +00:00
for ( ifa = iflist ; ifa & & idx < maxaddresses ; ifa = ifa - > ifa_next )
2013-11-24 16:35:52 +00:00
{
//can happen if the interface is not bound.
if ( ifa - > ifa_addr = = NULL )
continue ;
//filter out families that we're not interested in.
fam = ifa - > ifa_addr - > sa_family ;
if (
# ifdef HAVE_IPV4
( fam = = AF_INET & & ipv4 ) | |
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2013-11-24 16:35:52 +00:00
( fam = = AF_INET6 & & ipv6 ) | |
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2013-11-24 16:35:52 +00:00
( fam = = AF_IPX & & ipx ) | |
# endif
0 )
{
2018-09-23 19:35:24 +00:00
SockadrToNetadr ( ( struct sockaddr_qstorage * ) ifa - > ifa_addr , sizeof ( struct sockaddr_qstorage ) , & addresses [ idx ] ) ;
2014-02-07 09:39:18 +00:00
addresses [ idx ] . port = port ;
2014-02-07 09:36:04 +00:00
adrflags [ idx ] = 0 ;
idx + + ;
2013-11-24 16:35:52 +00:00
}
}
return idx ;
}
# else
2014-02-07 09:36:04 +00:00
int FTENET_GetLocalAddress ( int port , qboolean ipx , qboolean ipv4 , qboolean ipv6 , unsigned int * adrflags , netadr_t * addresses , int maxaddresses )
2013-11-24 16:35:52 +00:00
{
return 0 ;
}
# endif
2014-02-07 08:38:40 +00:00
int FTENET_Generic_GetLocalAddresses ( struct ftenet_generic_connection_s * con , unsigned int * adrflags , netadr_t * addresses , int maxaddresses )
2004-08-21 01:25:48 +00:00
{
2012-04-09 19:12:12 +00:00
# ifndef HAVE_PACKET
return 0 ;
# else
2004-08-21 01:25:48 +00:00
struct sockaddr_qstorage from ;
2008-11-09 22:29:28 +00:00
int fromsize = sizeof ( from ) ;
netadr_t adr ;
2014-02-07 08:38:40 +00:00
int found = 0 ;
2004-08-21 01:25:48 +00:00
2008-11-09 22:29:28 +00:00
if ( getsockname ( con - > thesocket , ( struct sockaddr * ) & from , & fromsize ) ! = - 1 )
2004-08-21 01:25:48 +00:00
{
2008-11-09 22:29:28 +00:00
memset ( & adr , 0 , sizeof ( adr ) ) ;
2018-09-23 19:35:24 +00:00
SockadrToNetadr ( & from , fromsize , & adr ) ;
2004-08-21 01:25:48 +00:00
2012-10-18 15:20:00 +00:00
# ifdef USE_GETHOSTNAME_LOCALLISTING
2013-11-24 16:35:52 +00:00
//if its bound to 'any' address, ask the system what addresses it actually accepts.
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
if ( ( adr . type = = NA_IPV6 ) & &
2011-12-05 15:23:40 +00:00
! * ( int * ) & adr . address . ip6 [ 0 ] & &
! * ( int * ) & adr . address . ip6 [ 4 ] & &
! * ( short * ) & adr . address . ip6 [ 8 ] & &
2018-06-18 16:44:29 +00:00
* ( short * ) & adr . address . ip6 [ 10 ] = = ( short ) 0xffff & &
2011-12-05 15:23:40 +00:00
! * ( int * ) & adr . address . ip6 [ 12 ] )
{
2013-11-24 16:35:52 +00:00
//ipv6 socket bound to the ipv4-any address is a bit weird, but oh well.
2015-06-12 14:44:50 +00:00
# ifdef _WIN32
//win32 is buggy and treats binding to [::] as [::ffff:0.0.0.0] (even with pure ipv6 sockets)
//explicitly binding to [::ffff:0.0.0.0] appears to fail in windows, thus any such socket will definitely support ipv6.
qboolean canipv4 = ( con - > addrtype [ 0 ] = = NA_IP ) | | ( con - > addrtype [ 1 ] = = NA_IP ) ;
found = FTENET_GetLocalAddress ( adr . port , false , canipv4 , true , adrflags , addresses , maxaddresses ) ;
# else
//FIXME: we should validate that we support hybrid sockets?
2014-02-07 08:38:40 +00:00
found = FTENET_GetLocalAddress ( adr . port , false , true , false , adrflags , addresses , maxaddresses ) ;
2015-06-12 14:44:50 +00:00
# endif
2011-12-05 15:23:40 +00:00
}
else
{
2013-11-24 16:35:52 +00:00
int b ;
2011-12-05 15:23:40 +00:00
for ( b = 0 ; b < sizeof ( adr . address ) ; b + + )
if ( ( ( unsigned char * ) & adr . address ) [ b ] ! = 0 )
break ;
2013-11-24 16:35:52 +00:00
if ( b = = sizeof ( adr . address ) )
2008-11-09 22:29:28 +00:00
{
2013-11-24 16:35:52 +00:00
qboolean ipx = false , ipv4 = false , ipv6 = false ;
if ( adr . type = = NA_IP )
ipv4 = true ;
else if ( adr . type = = NA_IPX )
ipx = true ;
else if ( adr . type = = NA_IPV6 )
2011-12-05 15:23:40 +00:00
{
2015-06-12 14:44:50 +00:00
ipv4 = ( con - > addrtype [ 0 ] = = NA_IP ) | | ( con - > addrtype [ 1 ] = = NA_IP ) ;
2013-11-24 16:35:52 +00:00
ipv6 = true ;
2011-12-05 15:23:40 +00:00
}
2014-02-07 08:38:40 +00:00
found = FTENET_GetLocalAddress ( adr . port , ipx , ipv4 , ipv6 , adrflags , addresses , maxaddresses ) ;
2008-11-09 22:29:28 +00:00
}
2004-08-21 01:25:48 +00:00
}
2012-10-18 15:20:00 +00:00
# endif
2013-11-24 16:35:52 +00:00
//and use the bound address (even if its 0.0.0.0) if we didn't grab a list from the system.
2014-02-07 08:38:40 +00:00
if ( ! found )
2004-08-21 01:25:48 +00:00
{
2014-02-07 08:38:40 +00:00
if ( maxaddresses & & adr . type = = NA_IPV6 & &
2012-10-18 15:20:00 +00:00
! * ( int * ) & adr . address . ip6 [ 0 ] & &
! * ( int * ) & adr . address . ip6 [ 4 ] & &
! * ( int * ) & adr . address . ip6 [ 8 ] & &
! * ( int * ) & adr . address . ip6 [ 12 ] )
{
2014-02-07 08:38:40 +00:00
* addresses = adr ;
addresses - > type = NA_IP ;
* adrflags + + = 0 ;
addresses + + ;
maxaddresses - - ;
found + + ;
}
if ( maxaddresses )
{
* addresses = adr ;
* adrflags + + = 0 ;
addresses + + ;
maxaddresses - - ;
found + + ;
2012-10-18 15:20:00 +00:00
}
2004-08-21 01:25:48 +00:00
}
}
2005-11-30 01:20:53 +00:00
2014-02-07 08:38:40 +00:00
return found ;
2012-04-09 19:12:12 +00:00
# endif
2008-11-09 22:29:28 +00:00
}
2005-11-30 01:20:53 +00:00
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 FTENET_Datagram_GetPacket ( ftenet_generic_connection_t * con )
2008-11-09 22:29:28 +00:00
{
2012-04-09 19:12:12 +00:00
# ifndef HAVE_PACKET
return false ;
# else
2008-11-09 22:29:28 +00:00
struct sockaddr_qstorage from ;
int fromlen ;
int ret ;
int err ;
char adr [ MAX_ADR_SIZE ] ;
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
if ( con - > thesocket = = INVALID_SOCKET )
return false ;
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
fromlen = sizeof ( from ) ;
2018-03-04 14:41:16 +00:00
( ( struct sockaddr * ) & from ) - > sa_family = AF_UNSPEC ;
2008-11-09 22:29:28 +00:00
ret = recvfrom ( con - > thesocket , ( char * ) net_message_buffer , sizeof ( net_message_buffer ) , 0 , ( struct sockaddr * ) & from , & fromlen ) ;
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
if ( ret = = - 1 )
{
2014-02-07 08:38:40 +00:00
err = neterrno ( ) ;
2005-11-30 01:20:53 +00:00
2014-02-07 08:38:40 +00:00
if ( err = = NET_EWOULDBLOCK )
2008-11-09 22:29:28 +00:00
return false ;
2014-02-07 08:38:40 +00:00
if ( err = = NET_EMSGSIZE )
2008-11-09 22:29:28 +00:00
{
2017-01-24 10:27:39 +00:00
static unsigned int resettime ;
unsigned int curtime = Sys_Milliseconds ( ) ;
if ( curtime - resettime > = 5000 ) //throttle prints to once per 5 secs (even if they're about different clients, yay ddos)
{
2018-09-23 19:35:24 +00:00
SockadrToNetadr ( & from , fromlen , & net_from ) ;
2017-01-24 10:27:39 +00:00
Con_TPrintf ( " Warning: Oversize packet from %s \n " ,
2013-05-03 04:28:08 +00:00
NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) ) ;
2017-01-24 10:27:39 +00:00
}
2008-11-09 22:29:28 +00:00
return false ;
}
2014-02-07 08:38:40 +00:00
if ( err = = NET_ECONNABORTED | | err = = NET_ECONNRESET )
2008-11-09 22:29:28 +00:00
{
2017-01-24 10:27:39 +00:00
static unsigned int resettime ;
unsigned int curtime = Sys_Milliseconds ( ) ;
if ( curtime - resettime > = 5000 | | err = = NET_ECONNRESET ) //throttle prints to once per 5 secs (even if they're about different clients, yay ddos)
2005-11-30 01:20:53 +00:00
{
2018-03-04 14:41:16 +00:00
if ( ( ( struct sockaddr * ) & from ) - > sa_family ! = AF_UNSPEC )
2018-04-10 18:15:24 +00:00
{
2018-09-23 19:35:24 +00:00
SockadrToNetadr ( & from , fromlen , & net_from ) ;
2017-01-24 10:27:39 +00:00
Con_TPrintf ( " Connection lost or aborted (%s) \n " , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) ) ; //server died/connection lost.
2018-04-10 18:15:24 +00:00
}
2008-11-09 22:29:28 +00:00
else
2017-01-24 10:27:39 +00:00
Con_TPrintf ( " Connection lost or aborted \n " ) ; //server died/connection lost.
resettime = curtime ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2017-01-24 10:27:39 +00:00
//fixme: synthesise a reset packet for the caller to handle? "\xff\xff\xff\xffreset" ?
if ( cls . state ! = ca_disconnected & & ! con - > islisten )
{
if ( cls . lastarbiatarypackettime + 5 < Sys_DoubleTime ( ) ) //too many mvdsv
Cbuf_AddText ( " disconnect \n reconnect \n " , RESTRICT_LOCAL ) ; //retry connecting.
else
Con_Printf ( " Packet was not delivered - server might be badly configured \n " ) ;
return false ;
}
2005-11-30 01:20:53 +00:00
# endif
2017-01-24 10:27:39 +00:00
}
2008-11-09 22:29:28 +00:00
return false ;
2005-11-30 01:20:53 +00:00
}
2018-03-04 14:41:16 +00:00
if ( ( ( struct sockaddr * ) & from ) - > sa_family ! = AF_UNSPEC )
Con_Printf ( " NET_GetPacket: Error (%i): %s (%s) \n " , err , strerror ( err ) , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) ) ;
else
Con_Printf ( " NET_GetPacket: Error (%i): %s \n " , err , strerror ( err ) ) ;
2008-11-09 22:29:28 +00:00
return false ;
}
2018-09-23 19:35:24 +00:00
SockadrToNetadr ( & from , fromlen , & net_from ) ;
if ( net_from . type = = NA_INVALID )
{ //this really shouldn't happen. Blame the OS.
Con_TPrintf ( " Warning: sender's address type not known (%i) \n " , ( int ) ( ( struct sockaddr * ) & from ) - > sa_family ) ;
return false ; //packet from an unsupported protocol? no way can we respond, so what's the point
}
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
net_message . packing = SZ_RAWBYTES ;
net_message . currentbit = 0 ;
net_message . cursize = ret ;
2018-03-04 14:41:16 +00:00
if ( net_message . cursize > = sizeof ( net_message_buffer ) )
2008-11-09 22:29:28 +00:00
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Warning: Oversize packet from %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) ) ;
2008-11-09 22:29:28 +00:00
return false ;
}
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
return true ;
2012-04-09 19:12:12 +00:00
# endif
2008-11-09 22:29:28 +00:00
}
2005-11-30 01:20:53 +00:00
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
neterr_t FTENET_Datagram_SendPacket ( ftenet_generic_connection_t * con , int length , const void * data , netadr_t * to )
2008-11-09 22:29:28 +00:00
{
2012-04-09 19:12:12 +00:00
# ifndef HAVE_PACKET
2016-07-12 00:40:13 +00:00
return NETERR_DISCONNECTED ;
2012-04-09 19:12:12 +00:00
# else
2008-11-09 22:29:28 +00:00
struct sockaddr_qstorage addr ;
int size ;
int ret ;
2005-11-30 01:20:53 +00:00
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
if ( to - > prot ! = NP_DGRAM )
return NETERR_NOROUTE ;
2008-11-09 22:29:28 +00:00
for ( size = 0 ; size < FTENET_ADDRTYPES ; size + + )
2013-05-03 04:28:08 +00:00
if ( to - > type = = con - > addrtype [ size ] )
2008-11-09 22:29:28 +00:00
break ;
if ( size = = FTENET_ADDRTYPES )
2016-07-12 00:40:13 +00:00
return NETERR_NOROUTE ;
2005-11-30 01:20:53 +00:00
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2011-12-05 15:23:40 +00:00
/*special code to handle sending to hybrid sockets*/
2013-05-03 04:28:08 +00:00
if ( con - > addrtype [ 1 ] = = NA_IPV6 & & to - > type = = NA_IP )
2011-12-05 15:23:40 +00:00
{
memset ( & addr , 0 , sizeof ( struct sockaddr_in6 ) ) ;
( ( struct sockaddr_in6 * ) & addr ) - > sin6_family = AF_INET6 ;
* ( short * ) & ( ( struct sockaddr_in6 * ) & addr ) - > sin6_addr . s6_addr [ 10 ] = 0xffff ;
2013-05-03 04:28:08 +00:00
* ( int * ) & ( ( struct sockaddr_in6 * ) & addr ) - > sin6_addr . s6_addr [ 12 ] = * ( int * ) & to - > address . ip ;
( ( struct sockaddr_in6 * ) & addr ) - > sin6_port = to - > port ;
2011-12-05 15:23:40 +00:00
size = sizeof ( struct sockaddr_in6 ) ;
}
else
# endif
2008-11-09 22:29:28 +00:00
{
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
size = NetadrToSockadr ( to , & addr ) ;
2011-12-05 15:23:40 +00:00
}
2008-11-09 22:29:28 +00:00
2019-02-01 08:29:14 +00:00
if ( ! data )
ret = 0 ; //don't send a runt, but pretend we did... yes, this'll confuse EnsureRoute, but at least it'll ensure there's a udp socket open, somewhere.
else
ret = sendto ( con - > thesocket , data , length , 0 , ( struct sockaddr * ) & addr , size ) ;
2008-11-09 22:29:28 +00:00
if ( ret = = - 1 )
{
2014-02-07 08:38:40 +00:00
int ecode = neterrno ( ) ;
2008-11-09 22:29:28 +00:00
// wouldblock is silent
2014-02-07 08:38:40 +00:00
if ( ecode = = NET_EWOULDBLOCK )
2016-07-12 00:40:13 +00:00
return NETERR_CLOGGED ;
2008-11-09 22:29:28 +00:00
2014-02-07 08:38:40 +00:00
if ( ecode = = NET_ECONNREFUSED )
2016-07-12 00:40:13 +00:00
return NETERR_DISCONNECTED ;
if ( ecode = = NET_EMSGSIZE )
return NETERR_MTU ;
2008-11-09 22:29:28 +00:00
2019-04-19 23:55:47 +00:00
if ( ecode = = NET_EADDRNOTAVAIL )
2018-12-28 00:04:36 +00:00
return NETERR_NOROUTE ; //this interface doesn't actually support that (eg: happens when ipv6 is disabled on a specific interface).
2014-02-07 08:38:40 +00:00
if ( ecode = = NET_EACCES )
2013-05-03 04:28:08 +00:00
{
Con_Printf ( " Access denied: check firewall \n " ) ;
2016-07-12 00:40:13 +00:00
return NETERR_DISCONNECTED ;
2013-05-03 04:28:08 +00:00
}
2018-08-24 00:35:16 +00:00
{
2019-02-16 19:09:07 +00:00
char adr [ 256 ] ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2019-02-16 19:09:07 +00:00
if ( ecode = = NET_EADDRNOTAVAIL )
Con_DPrintf ( " NET_SendPacket(%s) Warning: %i \n " , NET_AdrToString ( adr , sizeof ( adr ) , to ) , ecode ) ;
else
2008-11-09 22:29:28 +00:00
# endif
2019-02-16 19:09:07 +00:00
{
2015-04-14 23:12:17 +00:00
# ifdef _WIN32
2019-02-16 19:09:07 +00:00
Con_Printf ( " NET_SendPacket(%s) ERROR: %i \n " , NET_AdrToString ( adr , sizeof ( adr ) , to ) , ecode ) ;
2015-04-14 23:12:17 +00:00
# else
2019-02-16 19:09:07 +00:00
Con_Printf ( " NET_SendPacket(%s) ERROR: %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , to ) , strerror ( ecode ) ) ;
2015-04-14 23:12:17 +00:00
# endif
2019-02-16 19:09:07 +00:00
}
}
2008-11-09 22:29:28 +00:00
}
2016-07-12 00:40:13 +00:00
else if ( ret < length )
return NETERR_MTU ;
return NETERR_SENT ;
2012-04-09 19:12:12 +00:00
# endif
2008-11-09 22:29:28 +00:00
}
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 NET_PortToAdr ( netadrtype_t adrfamily , netproto_t adrprot , const char * s , netadr_t * a )
2008-11-09 22:29:28 +00:00
{
char * e ;
2015-06-05 03:45:01 +00:00
if ( net_enabled . ival | | adrfamily = = NA_LOOPBACK )
2008-11-09 22:29:28 +00:00
{
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 port = strtoul ( s , & e , 10 ) ;
2015-06-05 03:45:01 +00:00
if ( * e ) //if *e then its not just a single number in there, so treat it as a proper address.
return NET_StringToAdr ( s , 0 , a ) ;
else if ( e ! = s ) //if we actually read something (even a 0)
{
memset ( a , 0 , sizeof ( * a ) ) ;
a - > port = htons ( ( unsigned short ) port ) ;
a - > type = adrfamily ;
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
a - > prot = adrprot ;
2013-03-31 04:21:08 +00:00
2015-06-05 03:45:01 +00:00
return a - > type ! = NA_INVALID ;
}
2008-11-09 22:29:28 +00:00
}
2009-03-03 01:53:19 +00:00
a - > type = NA_INVALID ;
2008-11-09 22:29:28 +00:00
return false ;
}
2017-05-23 07:48:45 +00:00
# ifdef HAVE_PACKET
2015-12-12 19:25:15 +00:00
/*just here to prevent the client from spamming new sockets, which can be a problem with certain q2 servers*/
2017-05-23 07:48:45 +00:00
static qboolean FTENET_Datagram_ChangeLocalAddress ( struct ftenet_generic_connection_s * con , netadr_t * adr )
2015-12-12 19:25:15 +00:00
{
2017-05-22 05:12:01 +00:00
struct sockaddr_qstorage address ;
netadr_t current ;
2017-06-21 01:24:25 +00:00
int namelen = sizeof ( address ) ;
2017-05-22 05:12:01 +00:00
if ( getsockname ( con - > thesocket , ( struct sockaddr * ) & address , & namelen ) = = 0 )
{
2018-09-23 19:35:24 +00:00
SockadrToNetadr ( & address , namelen , & current ) ;
2017-05-22 05:12:01 +00:00
//make sure the types match (special check for ipv6 hybrid sockets that accept ipv4 too)
if ( adr - > type = = current . type
# if defined(HAVE_IPV4) && defined(HAVE_IPV6)
| | ( net_hybriddualstack . ival & & adr - > type = = NA_IP & & current . type = = NA_IPV6 )
# endif
)
{ //make sure the port is currect (or they don't care which port)
if ( adr - > port = = current . port | | ! adr - > port )
return true ; //then pretend we changed it, because needed to change in the first place.
}
}
//doesn't match how its currently bound, so I guess we need to rebind then.
2015-12-12 19:25:15 +00:00
return false ;
}
2017-05-23 07:48:45 +00:00
# endif
2015-12-12 19:25:15 +00:00
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
ftenet_generic_connection_t * FTENET_Datagram_EstablishConnection ( qboolean isserver , const char * address , netadr_t adr )
2008-11-09 22:29:28 +00:00
{
2012-04-09 19:12:12 +00:00
# ifndef HAVE_PACKET
return NULL ;
# else
2008-11-09 22:29:28 +00:00
//this is written to support either ipv4 or ipv6, depending on the remote addr.
ftenet_generic_connection_t * newcon ;
unsigned long _true = true ;
2011-12-23 03:12:29 +00:00
SOCKET newsocket = INVALID_SOCKET ;
2008-11-09 22:29:28 +00:00
int temp ;
struct sockaddr_qstorage qs ;
int family ;
int port ;
int bindtries ;
2018-04-07 12:33:06 +00:00
const int bindmaxtries = 100 ;
2011-10-27 16:16:29 +00:00
int bufsz ;
2011-12-05 15:23:40 +00:00
qboolean hybrid = false ;
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 protocol ;
2018-04-07 12:33:06 +00:00
char addrstr [ 128 ] ;
2008-11-09 22:29:28 +00:00
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
switch ( adr . type )
2008-11-09 22:29:28 +00:00
{
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
# if defined(HAVE_IPV4) || defined(HAVE_IPV6)
case NA_IP :
case NA_IPV6 :
protocol = IPPROTO_UDP ;
break ;
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
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
case NA_IPX :
protocol = NSPROTO_IPX ;
break ;
# endif
default :
protocol = 0 ;
break ;
}
2018-06-18 16:44:29 +00:00
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
if ( adr . type = = NA_INVALID )
{
2018-04-07 12:33:06 +00:00
Con_Printf ( CON_ERROR " unable to resolve local address %s \n " , address ) ;
2008-11-09 22:29:28 +00:00
return NULL ; //couldn't resolve the name
}
temp = NetadrToSockadr ( & adr , & qs ) ;
2011-12-05 15:23:40 +00:00
family = ( ( struct sockaddr * ) & qs ) - > sa_family ;
2008-11-09 22:29:28 +00:00
2018-09-23 19:35:24 +00:00
# if defined(HAVE_IPV6) && defined(IPV6_V6ONLY)
2018-04-10 18:15:24 +00:00
if ( /*isserver &&*/ family = = AF_INET & & net_hybriddualstack . ival & & ! ( ( struct sockaddr_in * ) & qs ) - > sin_addr . s_addr )
2008-11-09 22:29:28 +00:00
{
2011-12-05 15:23:40 +00:00
unsigned long _false = false ;
2016-07-12 00:40:13 +00:00
if ( ( newsocket = socket ( AF_INET6 , SOCK_CLOEXEC | SOCK_DGRAM , protocol ) ) ! = INVALID_SOCKET )
2011-12-05 15:23:40 +00:00
{
if ( 0 = = setsockopt ( newsocket , IPPROTO_IPV6 , IPV6_V6ONLY , ( char * ) & _false , sizeof ( _false ) ) )
{
2013-05-11 05:03:07 +00:00
// int ip = ((struct sockaddr_in*)&qs)->sin_addr.s_addr;
2011-12-05 15:23:40 +00:00
int port = ( ( struct sockaddr_in * ) & qs ) - > sin_port ;
2013-05-11 05:03:07 +00:00
// ip = ((struct sockaddr_in*)&qs)->sin_addr.s_addr;
2011-12-05 15:23:40 +00:00
memset ( & qs , 0 , sizeof ( struct sockaddr_in6 ) ) ;
( ( struct sockaddr_in6 * ) & qs ) - > sin6_family = AF_INET6 ;
/*
if ( ( ( struct sockaddr_in * ) & qs ) - > sin_addr . s_addr )
{
( ( struct sockaddr_in6 * ) & qs ) - > sin6_addr . s6_addr [ 10 ] = 0xff ;
( ( struct sockaddr_in6 * ) & qs ) - > sin6_addr . s6_addr [ 11 ] = 0xff ;
( ( struct sockaddr_in6 * ) & qs ) - > sin6_addr . s6_addr [ 12 ] = ( ( qbyte * ) & ip ) [ 0 ] ;
( ( struct sockaddr_in6 * ) & qs ) - > sin6_addr . s6_addr [ 13 ] = ( ( qbyte * ) & ip ) [ 1 ] ;
( ( struct sockaddr_in6 * ) & qs ) - > sin6_addr . s6_addr [ 14 ] = ( ( qbyte * ) & ip ) [ 2 ] ;
( ( struct sockaddr_in6 * ) & qs ) - > sin6_addr . s6_addr [ 15 ] = ( ( qbyte * ) & ip ) [ 3 ] ;
}
*/
( ( struct sockaddr_in6 * ) & qs ) - > sin6_port = port ;
temp = sizeof ( struct sockaddr_in6 ) ;
2015-06-12 14:44:50 +00:00
adr . type = NA_IPV6 ;
2011-12-05 15:23:40 +00:00
hybrid = true ;
}
else
{
/*v6only failed... if the option doesn't exist, chances are this is a hybrid system which doesn't support both simultaneously anyway*/
closesocket ( newsocket ) ;
newsocket = INVALID_SOCKET ;
}
}
2008-11-09 22:29:28 +00:00
}
2011-12-05 15:23:40 +00:00
# endif
if ( newsocket = = INVALID_SOCKET )
2016-07-12 00:40:13 +00:00
if ( ( newsocket = socket ( family , SOCK_CLOEXEC | SOCK_DGRAM , protocol ) ) = = INVALID_SOCKET )
2011-12-05 15:23:40 +00:00
{
return NULL ;
}
2018-09-23 19:35:24 +00:00
# if defined(HAVE_IPV6) && defined(IPV6_V6ONLY)
2011-12-23 03:12:29 +00:00
if ( family = = AF_INET6 )
2011-12-05 15:23:40 +00:00
setsockopt ( newsocket , IPPROTO_IPV6 , IPV6_V6ONLY , ( char * ) & _true , sizeof ( _true ) ) ;
2011-12-23 03:12:29 +00:00
# endif
2008-11-09 22:29:28 +00:00
2016-08-25 00:12:14 +00:00
# if defined(_WIN32) && defined(SO_EXCLUSIVEADDRUSE)
2013-06-23 03:59:48 +00:00
//win32 is so fucked up
2013-06-23 02:17:02 +00:00
setsockopt ( newsocket , SOL_SOCKET , SO_EXCLUSIVEADDRUSE , ( char * ) & _true , sizeof ( _true ) ) ;
2013-06-23 03:59:48 +00:00
# endif
2013-06-23 02:17:02 +00:00
2011-10-27 16:16:29 +00:00
bufsz = 1 < < 18 ;
setsockopt ( newsocket , SOL_SOCKET , SO_RCVBUF , ( void * ) & bufsz , sizeof ( bufsz ) ) ;
2018-09-23 19:35:24 +00:00
switch ( family )
{
# ifdef UNIXSOCKETS
case AF_UNIX :
{
struct sockaddr_un * sa = ( struct sockaddr_un * ) & qs ;
if ( ! isserver )
temp = ( char * ) & sa - > sun_path [ 0 ] - ( char * ) sa ; //linux-specific: bind to an automatic abstract address.
if ( * sa - > sun_path & & isserver )
{ //non-abstract sockets don't clean up the filesystem when the socket is closed
//and we can't re-bind to it while it still exists.
//so standard practise is to delete it before the bind.
//we do want to make sure the file is actually a socket before we remove it (so people can't abuse stuffcmds)
2019-02-16 19:09:07 +00:00
//FIXME: use lock-files
2018-09-23 19:35:24 +00:00
struct stat s ;
if ( stat ( sa - > sun_path , & s ) ! = - 1 )
{
if ( ( s . st_mode & S_IFMT ) = = S_IFSOCK )
unlink ( sa - > sun_path ) ;
}
}
if ( bind ( newsocket , ( struct sockaddr * ) sa , temp ) = = INVALID_SOCKET )
{
// perror("gah");
SockadrToNetadr ( & qs , temp , & adr ) ;
NET_AdrToString ( addrstr , sizeof ( addrstr ) , & adr ) ;
Con_Printf ( CON_ERROR " Unable to bind to %s \n " , addrstr ) ;
closesocket ( newsocket ) ;
return NULL ;
}
}
break ;
# endif
// case AF_INET:
// case AF_INET6:
// case AF_IPX:
default :
//try and find an unused port.
port = ntohs ( ( ( struct sockaddr_in * ) & qs ) - > sin_port ) ;
for ( bindtries = 0 ; bindtries < bindmaxtries ; bindtries + + )
2008-11-09 22:29:28 +00:00
{
2018-09-23 19:35:24 +00:00
( ( struct sockaddr_in * ) & qs ) - > sin_port = htons ( ( unsigned short ) ( port + bindtries ) ) ;
if ( ( bind ( newsocket , ( struct sockaddr * ) & qs , temp ) = = INVALID_SOCKET ) )
{
if ( port = = 0 )
{ //if binding to an ephemerial port failed, binding to the admin-only ports won't work any better...
bindtries = bindmaxtries ;
break ;
}
continue ;
2018-04-07 12:33:06 +00:00
}
2018-09-23 19:35:24 +00:00
break ;
}
if ( bindtries = = bindmaxtries )
{
SockadrToNetadr ( & qs , temp , & adr ) ;
NET_AdrToString ( addrstr , sizeof ( addrstr ) , & adr ) ;
Con_Printf ( CON_ERROR " Unable to listen at %s \n " , addrstr ) ;
closesocket ( newsocket ) ;
return NULL ;
}
else if ( bindtries & & isserver )
{
SockadrToNetadr ( & qs , temp , & adr ) ;
NET_AdrToString ( addrstr , sizeof ( addrstr ) , & adr ) ;
Con_Printf ( CON_ERROR " Unable to bind to port %i, bound to %s instead \n " , port , addrstr ) ;
2008-11-09 22:29:28 +00:00
}
break ;
}
if ( ioctlsocket ( newsocket , FIONBIO , & _true ) = = - 1 )
2014-02-07 08:38:40 +00:00
Sys_Error ( " UDP_OpenSocket: ioctl FIONBIO: %s " , strerror ( neterrno ( ) ) ) ;
2008-11-09 22:29:28 +00:00
2016-09-08 19:04:35 +00:00
//ipv6 sockets need to add themselves to a multicast group, so that we can receive broadcasts on a lan
2018-09-23 19:35:24 +00:00
# if defined(HAVE_IPV6)
2016-09-08 19:04:35 +00:00
if ( family = = AF_INET6 | | hybrid | | isserver )
{
struct ipv6_mreq req ;
memset ( & req , 0 , sizeof ( req ) ) ;
req . ipv6mr_multiaddr . s6_addr [ 0 ] = 0xff ;
req . ipv6mr_multiaddr . s6_addr [ 1 ] = 0x02 ;
req . ipv6mr_multiaddr . s6_addr [ 15 ] = 0x01 ;
req . ipv6mr_interface = 0 ;
setsockopt ( newsocket , IPPROTO_IPV6 , IPV6_JOIN_GROUP , ( char * ) & req , sizeof ( req ) ) ;
}
# endif
2011-10-27 16:16:29 +00:00
//
// determine my name & address if we don't already know it
//
2014-06-02 16:50:40 +00:00
if ( ! isserver & & net_local_cl_ipadr . type = = NA_INVALID )
2011-10-27 16:16:29 +00:00
NET_GetLocalAddress ( newsocket , & net_local_cl_ipadr ) ;
2008-11-09 22:29:28 +00:00
newcon = Z_Malloc ( sizeof ( * newcon ) ) ;
if ( newcon )
{
2014-02-07 08:38:40 +00:00
newcon - > GetLocalAddresses = FTENET_Generic_GetLocalAddresses ;
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
newcon - > GetPacket = FTENET_Datagram_GetPacket ;
newcon - > SendPacket = FTENET_Datagram_SendPacket ;
2008-11-09 22:29:28 +00:00
newcon - > Close = FTENET_Generic_Close ;
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
newcon - > ChangeLocalAddress = FTENET_Datagram_ChangeLocalAddress ;
2008-11-09 22:29:28 +00:00
newcon - > islisten = isserver ;
2011-12-05 15:23:40 +00:00
if ( hybrid )
{
newcon - > addrtype [ 0 ] = NA_IP ;
newcon - > addrtype [ 1 ] = NA_IPV6 ;
}
else
{
newcon - > addrtype [ 0 ] = adr . type ;
newcon - > addrtype [ 1 ] = NA_INVALID ;
}
2008-11-09 22:29:28 +00:00
newcon - > thesocket = newsocket ;
return newcon ;
}
else
{
closesocket ( newsocket ) ;
return NULL ;
}
2012-04-09 19:12:12 +00:00
# endif
2008-11-09 22:29:28 +00:00
}
# ifdef TCPCONNECT
typedef struct ftenet_tcpconnect_stream_s {
2014-03-30 08:55:06 +00:00
vfsfile_t * clientstream ;
2008-11-09 22:29:28 +00:00
int inlen ;
2012-04-09 19:12:12 +00:00
int outlen ;
enum
{
2013-04-06 03:36:00 +00:00
TCPC_UNKNOWN , //waiting to see what they send us.
TCPC_QIZMO , //'qizmo\n' handshake, followed by packets prefixed with a 16bit packet length.
2019-05-23 15:11:32 +00:00
# ifdef HAVE_HTTPSV
2013-04-06 03:36:00 +00:00
TCPC_WEBSOCKETU , //utf-8 encoded data.
TCPC_WEBSOCKETB , //binary encoded data (subprotocol = 'binary')
2013-12-09 01:18:27 +00:00
TCPC_WEBSOCKETNQ , //raw nq msg buffers with no encapsulation or handshake
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
TCPC_HTTPCLIENT , //we're sending a file to this victim.
TCPC_WEBRTC_CLIENT , //for brokering webrtc connections, doesn't carry any actual game data itself.
TCPC_WEBRTC_HOST //for brokering webrtc connections, doesn't carry any actual game data itself.
# endif
2012-04-09 19:12:12 +00:00
} clienttype ;
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
qbyte inbuffer [ MAX_OVERALLMSGLEN ] ;
qbyte outbuffer [ MAX_OVERALLMSGLEN ] ;
2014-03-30 08:55:06 +00:00
vfsfile_t * dlfile ; //if the client looked like an http client, this is the file that they're downloading.
2008-11-09 22:29:28 +00:00
float timeouttime ;
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 pinging ;
2008-11-09 22:29:28 +00:00
netadr_t remoteaddr ;
struct ftenet_tcpconnect_stream_s * next ;
2013-12-09 01:18:27 +00:00
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
SOCKET socketnum ; //for select. not otherwise used.
2014-03-30 08:55:06 +00:00
2013-12-09 01:18:27 +00:00
int fakesequence ; //TCPC_WEBSOCKETNQ
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
2018-12-28 00:04:36 +00:00
# ifdef HAVE_HTTPSV
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
struct
{
qboolean connection_close ;
} httpstate ;
2018-09-01 04:18:08 +00:00
# ifdef MVD_RECORDING
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
qtvpendingstate_t qtvstate ;
2018-09-01 04:18:08 +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
struct
{
char resource [ 32 ] ;
int clientnum ;
# ifdef SUPPORT_RTC_ICE
struct icestate_s * ice ;
# endif
} webrtc ;
# endif
2008-11-09 22:29:28 +00:00
} ftenet_tcpconnect_stream_t ;
typedef struct {
ftenet_generic_connection_t generic ;
2014-03-30 08:55:06 +00:00
qboolean tls ;
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
int active ;
ftenet_tcpconnect_stream_t * tcpstreams ;
} ftenet_tcpconnect_connection_t ;
2012-04-09 19:12:12 +00:00
void tobase64 ( unsigned char * out , int outlen , unsigned char * in , int inlen )
{
2012-07-14 17:25:21 +00:00
static unsigned char tab [ 64 ] =
2012-04-09 19:12:12 +00:00
{
' A ' , ' B ' , ' C ' , ' D ' , ' E ' , ' F ' , ' G ' , ' H ' , ' I ' , ' J ' , ' K ' , ' L ' , ' M ' , ' N ' , ' O ' , ' P ' ,
' Q ' , ' R ' , ' S ' , ' T ' , ' U ' , ' V ' , ' W ' , ' X ' , ' Y ' , ' Z ' , ' a ' , ' b ' , ' c ' , ' d ' , ' e ' , ' f ' ,
' g ' , ' h ' , ' i ' , ' j ' , ' k ' , ' l ' , ' m ' , ' n ' , ' o ' , ' p ' , ' q ' , ' r ' , ' s ' , ' t ' , ' u ' , ' v ' ,
' w ' , ' x ' , ' y ' , ' z ' , ' 0 ' , ' 1 ' , ' 2 ' , ' 3 ' , ' 4 ' , ' 5 ' , ' 6 ' , ' 7 ' , ' 8 ' , ' 9 ' , ' + ' , ' / '
} ;
unsigned int usedbits = 0 ;
unsigned int val = 0 ;
outlen - - ;
while ( inlen )
{
while ( usedbits < 24 & & inlen )
{
val < < = 8 ;
val | = ( * in + + ) ;
inlen - - ;
usedbits + = 8 ;
}
if ( outlen < 4 )
return ;
val < < = 24 - usedbits ;
* out + + = ( usedbits > 0 ) ? tab [ ( val > > 18 ) & 0x3f ] : ' = ' ;
* out + + = ( usedbits > 6 ) ? tab [ ( val > > 12 ) & 0x3f ] : ' = ' ;
* out + + = ( usedbits > 12 ) ? tab [ ( val > > 6 ) & 0x3f ] : ' = ' ;
* out + + = ( usedbits > 18 ) ? tab [ ( val > > 0 ) & 0x3f ] : ' = ' ;
val = 0 ;
usedbits = 0 ;
}
* out = 0 ;
}
2016-07-12 00:40:13 +00:00
neterr_t FTENET_TCPConnect_WebSocket_Splurge ( ftenet_tcpconnect_stream_t * st , qbyte packettype , const qbyte * data , unsigned int length )
2015-04-14 23:12:17 +00:00
{
/*as a server, we don't need the mask stuff*/
unsigned short ctrl = 0x8000 | ( packettype < < 8 ) ;
unsigned int paylen = 0 ;
unsigned int payoffs = st - > outlen ;
int i ;
switch ( ( ctrl > > 8 ) & 0xf )
{
case 1 :
for ( i = 0 ; i < length ; i + + )
{
paylen + = ( ( ( char * ) data ) [ i ] = = 0 | | ( ( unsigned char * ) data ) [ i ] > = 0x80 ) ? 2 : 1 ;
}
break ;
default :
paylen = length ;
break ;
}
if ( paylen > = 126 )
ctrl | = 126 ;
else
ctrl | = paylen ;
2016-07-12 00:40:13 +00:00
if ( 6 + paylen > sizeof ( st - > outbuffer ) )
return NETERR_MTU ;
if ( payoffs + 6 + paylen > sizeof ( st - > outbuffer ) )
return NETERR_CLOGGED ;
2015-04-14 23:12:17 +00:00
st - > outbuffer [ payoffs + + ] = ctrl > > 8 ;
st - > outbuffer [ payoffs + + ] = ctrl & 0xff ;
if ( ( ctrl & 0x7f ) = = 126 )
{
st - > outbuffer [ payoffs + + ] = paylen > > 8 ;
st - > outbuffer [ payoffs + + ] = paylen & 0xff ;
}
switch ( ( ctrl > > 8 ) & 0xf )
{
case 1 : /*utf8ify the data*/
for ( i = 0 ; i < length ; i + + )
{
if ( ! ( ( unsigned char * ) data ) [ i ] )
{ /*0 is encoded as 0x100 to avoid safety checks*/
st - > outbuffer [ payoffs + + ] = 0xc0 | ( 0x100 > > 6 ) ;
st - > outbuffer [ payoffs + + ] = 0x80 | ( 0x100 & 0x3f ) ;
}
else if ( ( ( unsigned char * ) data ) [ i ] > = 0x80 )
{ /*larger bytes require markup*/
st - > outbuffer [ payoffs + + ] = 0xc0 | ( ( ( unsigned char * ) data ) [ i ] > > 6 ) ;
st - > outbuffer [ payoffs + + ] = 0x80 | ( ( ( unsigned char * ) data ) [ i ] & 0x3f ) ;
}
else
{ /*lower 7 bits are as-is*/
st - > outbuffer [ payoffs + + ] = ( ( char * ) data ) [ i ] ;
}
}
break ;
default : //raw data
memcpy ( st - > outbuffer + payoffs , data , length ) ;
payoffs + = length ;
break ;
}
st - > outlen = payoffs ;
if ( st - > outlen )
{ /*try and flush the old data*/
int done ;
done = VFS_WRITE ( st - > clientstream , st - > outbuffer , st - > outlen ) ;
if ( done > 0 )
{
memmove ( st - > outbuffer , st - > outbuffer + done , st - > outlen - done ) ;
st - > outlen - = done ;
}
}
2016-07-12 00:40:13 +00:00
return NETERR_SENT ;
2015-04-14 23:12:17 +00:00
}
2018-12-28 00:04:36 +00:00
# ifdef HAVE_HTTPSV
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
enum
{
WCATTR_METHOD ,
WCATTR_URL ,
WCATTR_HTTP ,
WCATTR_HOST ,
WCATTR_CONNECTION ,
WCATTR_UPGRADE ,
WCATTR_WSKEY ,
//WCATTR_ORIGIN,
WCATTR_WSPROTO ,
//WCATTR_WSEXT,
WCATTR_IFNONEMATCH ,
WCATTR_COUNT ,
WCATTR_WSVER ,
WCATTR_CONTENT_LENGTH ,
WCATTR_ACCEPT_ENCODING ,
WCATTR_TRANSFER_ENCODING
} ;
typedef char httparg_t [ 64 ] ;
2013-04-06 03:36:00 +00:00
# include "fs.h"
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
# ifdef _WIN32
# include "resource.h"
# endif
void SV_UserCmdMVDList_HTML ( vfsfile_t * pipe ) ;
qboolean FTENET_TCPConnect_HTTPResponse ( ftenet_tcpconnect_stream_t * st , httparg_t arg [ WCATTR_COUNT ] , qboolean allowgzip )
2008-11-09 22:29:28 +00:00
{
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
char adr [ 256 ] ;
int i ;
const char * filetype = NULL ;
2018-09-01 04:18:08 +00:00
const char * resp = NULL ; //response headers (no length/gap)
const char * body = NULL ; //response body
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 method ;
if ( ! strcmp ( arg [ WCATTR_METHOD ] , " GET " ) )
method = 0 ;
else if ( ! strcmp ( arg [ WCATTR_METHOD ] , " HEAD " ) )
method = 1 ;
else //if (!strcmp(arg[WCATTR_METHOD], "POST") || !strcmp(arg[WCATTR_METHOD], "PUT") || !strcmp(arg[WCATTR_METHOD], "OPTIONS"))
{
method = 404 ;
resp = " HTTP/1.1 405 Method Not Allowed \r \n " ;
body = NULL ;
}
st - > dlfile = NULL ;
if ( ! resp & & * arg [ WCATTR_URL ] = = ' / ' )
{ //'can't use SV_LocateDownload, as that assumes an active client.
2018-09-01 04:18:08 +00:00
const char * name = arg [ WCATTR_URL ] + 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
char * extraheaders = " " ;
time_t modificationtime = 0 ;
char * query = strchr ( arg [ WCATTR_URL ] + 1 , ' ? ' ) ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_SERVER
2018-09-01 04:18:08 +00:00
func_t func = 0 ;
2018-12-28 00:04:36 +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
if ( query )
* query + + = 0 ;
//FIXME: remove ?
//FIXME: any path that ends with / should be sent to index.html or something
if ( ! * name )
name = " index.html " ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_SERVER
2018-09-01 04:18:08 +00:00
if ( sv . state & & svs . gametype = = GT_PROGS & & svprogfuncs )
func = svprogfuncs - > FindFunction ( svprogfuncs , " HTTP_GeneratePage " , PR_ANY ) ;
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
2018-09-01 04:18:08 +00:00
if ( func )
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
{
2018-09-01 04:18:08 +00:00
void * pr_globals = PR_globals ( svprogfuncs , PR_CURRENT ) ;
( ( string_t * ) pr_globals ) [ OFS_PARM0 ] = svprogfuncs - > TempString ( svprogfuncs , query ? va ( " %s?%s " , name , query ) : name ) ;
( ( string_t * ) pr_globals ) [ OFS_PARM1 ] = svprogfuncs - > TempString ( svprogfuncs , arg [ WCATTR_METHOD ] ) ;
( ( string_t * ) pr_globals ) [ OFS_PARM2 ] = 0 ; //we don't support any postdata at this time.
( ( string_t * ) pr_globals ) [ OFS_PARM3 ] = 0 ; //we don't support any request headers at this time.
( ( string_t * ) pr_globals ) [ OFS_PARM4 ] = 0 ; //we don't have any default response headers yet.
( ( string_t * ) pr_globals ) [ OFS_PARM5 ] = 0 ;
( ( string_t * ) pr_globals ) [ OFS_PARM6 ] = 0 ;
( ( string_t * ) pr_globals ) [ OFS_PARM7 ] = 0 ;
svprogfuncs - > ExecuteProgram ( svprogfuncs , func ) ;
if ( ( ( string_t * ) pr_globals ) [ OFS_RETURN ] )
{ //note that "" is not null
body = svprogfuncs - > StringToNative ( svprogfuncs , ( ( string_t * ) pr_globals ) [ OFS_RETURN ] ) ;
resp = svprogfuncs - > StringToNative ( svprogfuncs , ( ( string_t * ) pr_globals ) [ OFS_PARM4 ] ) ;
resp = va ( " %s%s " , * body ? " HTTP/1.1 200 Ok \r \n " : " HTTP/1.1 404 File Not Found \r \n " , resp ) ;
}
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
}
2018-12-28 00:04:36 +00:00
# endif
2018-09-01 04:18:08 +00:00
//FIXME: provide some resource->filename mapping that allows various misc files.
if ( body )
;
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
# ifdef _WIN32
else if ( ! strcmp ( name , " favicon.ico " ) )
{ //we can serve up the icon from the exe. we just have to reformat it a little.
st - > dlfile = VFSPIPE_Open ( 1 , false ) ;
if ( st - > dlfile )
{
struct
{
short reserved ;
short type ;
short count ;
struct
{
qbyte width ;
qbyte height ;
qbyte colours ;
qbyte reserved ;
short planes ;
short bitcount ;
unsigned short bytes [ 2 ] ;
unsigned short fileoffset [ 2 ] ;
} entry [ 1 ] ;
} icohdr ;
struct
{
short reserved ;
short type ;
short count ;
struct
{
qbyte width ;
qbyte height ;
qbyte colours ;
qbyte reserved ;
short planes ;
short bitcount ;
unsigned short bytes [ 2 ] ;
unsigned short id ;
} entry [ 1 ] ;
} * grphdr = LockResource ( LoadResource ( NULL , FindResource ( NULL , MAKEINTRESOURCE ( IDI_ICON1 ) , RT_GROUP_ICON ) ) ) ;
void * blob ;
//fixme: scan for the best icon size to use.
icohdr . reserved = 0 ;
icohdr . type = 1 ; //type
icohdr . count = countof ( icohdr . entry ) ; //count
icohdr . entry [ 0 ] . width = grphdr - > entry [ 0 ] . width ;
icohdr . entry [ 0 ] . height = grphdr - > entry [ 0 ] . height ;
icohdr . entry [ 0 ] . colours = grphdr - > entry [ 0 ] . colours ;
icohdr . entry [ 0 ] . reserved = grphdr - > entry [ 0 ] . reserved ;
icohdr . entry [ 0 ] . planes = grphdr - > entry [ 0 ] . planes ;
icohdr . entry [ 0 ] . bitcount = grphdr - > entry [ 0 ] . bitcount ;
icohdr . entry [ 0 ] . bytes [ 0 ] = grphdr - > entry [ 0 ] . bytes [ 0 ] ;
icohdr . entry [ 0 ] . bytes [ 1 ] = grphdr - > entry [ 0 ] . bytes [ 1 ] ;
icohdr . entry [ 0 ] . fileoffset [ 0 ] = sizeof ( icohdr ) ;
icohdr . entry [ 0 ] . fileoffset [ 1 ] = sizeof ( icohdr ) > > 16 ;
VFS_WRITE ( st - > dlfile , & icohdr , sizeof ( icohdr ) ) ;
blob = LockResource ( LoadResource ( NULL , FindResource ( NULL , MAKEINTRESOURCE ( grphdr - > entry [ 0 ] . id ) , RT_ICON ) ) ) ;
VFS_WRITE ( st - > dlfile , blob , grphdr - > entry [ 0 ] . bytes [ 0 ] | ( grphdr - > entry [ 0 ] . bytes [ 1 ] < < 16 ) ) ;
resp = NULL ;
body = NULL ;
}
2013-04-06 03:36:00 +00:00
}
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
# endif
2018-12-28 00:04:36 +00:00
# if defined(SV_MASTER) && !defined(HAVE_SERVER)
else if ( ( st - > dlfile = SVM_GenerateIndex ( name ) ) )
;
# endif
# ifdef HAVE_SERVER
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
/*else if (!strcmp(name, "index.html"))
2018-12-28 00:04:36 +00:00
{
resp = " HTTP/1.1 200 Ok \r \n "
" Content-Type: text/html \r \n " ;
body = va (
" <html lang='en-us'> "
" <head> "
" <meta charset='utf-8'> "
" <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> "
" <meta name=viewport content='width=device-width, initial-scale=1'> "
" <link rel='icon' type='image/vnd.microsoft.icon' href='/favicon.ico' /> "
" <title>%s - %s</title> "
" <style> "
" body { background-color:#000000; color:#808080; height:100%%;width:100%%;margin:0;padding:0;} "
" </style> "
" </head> "
" <body> "
" <iframe name='steve' "
" src='%s/%s?+connect%%20%s%s' allowfullscreen=true "
" frameborder='0' scrolling='no' marginheight='0' marginwidth='0' width='100%%' height='100%%' "
" onerror= \" alert('Failed to load engine') \" > "
" </iframe> "
" </body> "
" </html> "
, fs_manifest - > formalname , hostname . string , ENGINEWEBSITE , fs_manifest - > installation , ( st - > remoteaddr . prot = = NP_TLS ) ? " wss:// " : " ws:// " , arg [ WCATTR_HOST ] ) ;
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
} */
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
/*else if (!strcmp(name, "default.fmf") && (st->dlfile = FS_OpenVFS("default.fmf", "rb", FS_ROOT)))
2013-04-06 03:36:00 +00:00
{
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
resp = " HTTP/1.1 200 Ok \r \n "
" Content-Type: application/x-ftemanifest \r \n " ;
body = NULL ;
} */
2018-09-01 04:18:08 +00:00
# ifdef MVD_RECORDING
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
else if ( ! Q_strncasecmp ( name , " demolist " , 8 ) )
{
filetype = " text/html " ;
st - > dlfile = VFSPIPE_Open ( 1 , false ) ;
if ( st - > dlfile )
SV_UserCmdMVDList_HTML ( st - > dlfile ) ;
2008-11-09 22:29:28 +00:00
}
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
else if ( ! Q_strncasecmp ( name , " demonum/ " , 8 ) )
2008-11-09 22:29:28 +00:00
{
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
char * mvdname = SV_MVDNum ( arg [ WCATTR_METHOD ] , sizeof ( arg [ WCATTR_METHOD ] ) , atoi ( name + 8 ) ) ;
if ( mvdname )
{
Con_Printf ( " Redirect %s to %s (copyrighted) \n " , arg [ WCATTR_URL ] , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
resp = va ( " HTTP/1.1 302 Found \r \n "
" Location: /demos/%s \r \n "
" Content-Type: text/html \r \n "
, mvdname ) ;
body = NULL ;
}
}
2018-09-01 04:18:08 +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
else if ( ! SV_AllowDownload ( name ) )
{
Con_Printf ( " Denied download of %s to %s \n " , arg [ WCATTR_URL ] , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
resp = " HTTP/1.1 403 Forbidden \r \n "
" Content-Type: text/html \r \n " ;
body = va ( " File \" %s \" may not be downloaded "
, name ) ;
}
else if ( ! Q_strncasecmp ( name , " package/ " , 8 ) )
{
if ( FS_GetPackageDownloadable ( name + 8 ) )
st - > dlfile = FS_OpenVFS ( name + 8 , " rb " , FS_ROOT ) ;
else
{
Con_Printf ( " Unable to download %s to %s (copyrighted) \n " , arg [ WCATTR_URL ] , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
resp = " HTTP/1.1 403 Forbidden \r \n "
" Content-Type: text/html \r \n " ;
body = " File is flagged as copyrighted " ;
}
}
else
{
flocation_t gzloc ;
flocation_t rawloc ;
2018-09-01 04:18:08 +00:00
# ifdef MVD_RECORDING
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
if ( ! Q_strncasecmp ( name , " demos/ " , 6 ) )
name = va ( " %s/%s " , sv_demoDir . string , name + 6 ) ;
2018-09-01 04:18:08 +00:00
# endif
2005-11-30 01:20:53 +00:00
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
if ( FS_FLocateFile ( name , FSLF_IFFOUND , & rawloc ) )
2012-04-09 19:12:12 +00:00
{
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
char gzname [ MAX_QPATH ] ;
time_t rt ;
FS_GetLocMTime ( & rawloc , & rt ) ;
Q_snprintfz ( gzname , sizeof ( gzname ) , " %s.gz " , name ) ;
if ( allowgzip & & FS_FLocateFile ( gzname , FSLF_IFFOUND , & gzloc ) )
2012-04-09 19:12:12 +00:00
{
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
time_t gt ;
if ( rawloc . search = = gzloc . search & & FS_GetLocMTime ( & gzloc , & gt ) & & gt > = rt )
{ //must be in the same gamedir, and not older
extraheaders = " Content-Encoding: gzip \r \n " ;
rawloc = gzloc ;
rt = gt ;
Con_DPrintf ( " HTTP: Serving %s instead \n " , gzname ) ;
}
else
Con_DPrintf ( " HTTP: Ignoring %s, outdated \n " , gzname ) ;
2012-04-09 19:12:12 +00:00
}
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
modificationtime = rt ;
if ( rawloc . search - > flags & SPF_COPYPROTECTED )
{
Con_Printf ( " Unable to download %s to %s (copyrighted) \n " , arg [ WCATTR_URL ] , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
resp = " HTTP/1.1 403 Forbidden \r \n "
" Content-Type: text/html \r \n " ;
body = va ( " File %s inside a package<br/><a href= \" /package/%s \" >Download</a> "
, name , FS_GetPackageDownloadFilename ( & rawloc ) ) ;
}
else
st - > dlfile = rawloc . search - > handle - > OpenVFS ( rawloc . search - > handle , & rawloc , " rb " ) ;
2012-04-09 19:12:12 +00:00
}
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
else
st - > dlfile = NULL ;
}
2018-12-28 00:04:36 +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
if ( st - > dlfile )
{
char etag [ 64 ] ;
if ( ! filetype )
2012-04-09 19:12:12 +00:00
{
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
char ext [ 64 ] ;
int i ;
static const char * mimes [ ] =
2012-04-09 19:12:12 +00:00
{
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
" html " , " text/html " ,
" htm " , " text/html " ,
" png " , " image/png " ,
" jpeg " , " image/jpeg " ,
" jpg " , " image/jpeg " ,
" ico " , " image/vnd.microsoft.icon " ,
" pk3 " , " application/zip " ,
" fmf " , " application/x-ftemanifest " ,
" qtv " , " application/x-qtv " ,
" mvd " , " application/x-multiviewdemo " ,
" mvd.gz " , " application/x-multiviewdemo " ,
" qwd " , " application/x-multiviewdemo " ,
" qwd.gz " , " application/x-multiviewdemo " ,
" dem " , " application/x-multiviewdemo " ,
" dem.gz " , " application/x-multiviewdemo " ,
2012-04-09 19:12:12 +00:00
} ;
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
COM_FileExtension ( name , ext , sizeof ( ext ) ) ;
for ( i = 0 ; i < countof ( mimes ) ; i + = 2 )
2012-04-09 19:12:12 +00:00
{
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
if ( ! Q_strcasecmp ( ext , mimes [ i ] ) )
2012-04-09 19:12:12 +00:00
{
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
filetype = mimes [ i + 1 ] ;
2012-04-09 19:12:12 +00:00
break ;
}
}
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
}
if ( modificationtime )
{
Q_snprintfz ( etag , sizeof ( etag ) , " W/ \" %0 " PRIxQOFS " \" " , ( qofs_t ) modificationtime ) ;
if ( ! strcmp ( arg [ WCATTR_IFNONEMATCH ] , etag ) )
{
resp = " HTTP/1.1 304 Not Modified \r \n " ;
body = NULL ;
}
Q_snprintfz ( etag , sizeof ( etag ) , " ETag: W/ \" %0 " PRIxQOFS " \" \r \n " , ( qofs_t ) modificationtime ) ;
}
if ( resp )
{
VFS_CLOSE ( st - > dlfile ) ;
st - > dlfile = NULL ;
}
else
{
Con_Printf ( " Downloading %s to %s \n " , arg [ WCATTR_URL ] , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
if ( filetype )
{
resp = va ( " HTTP/1.1 200 Ok \r \n "
" Content-Type: %s \r \n "
" %s%s " ,
filetype ,
etag , extraheaders ) ;
}
else
resp = va ( " HTTP/1.1 200 Ok \r \n "
" %s%s " ,
etag , extraheaders ) ;
body = NULL ;
}
}
else if ( ! resp )
{
Con_Printf ( " Unable to download %s to %s \n " , arg [ WCATTR_URL ] , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
resp = " HTTP/1.1 404 File Not Found \r \n "
" Content-Type: text/html \r \n " ;
body = " File not found " ;
}
}
if ( ! resp )
{
Con_Printf ( " Invalid download request %s to %s \n " , arg [ WCATTR_URL ] , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
resp = " HTTP/1.1 404 File Not Found \r \n "
" Content-Type: text/html \r \n " ;
body = " This is a Quake WebSocket server, not an http server.<br/> \r \n "
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
//"<a href='"ENGINEWEBSITE"'>"FULLENGINENAME"</a>"
;
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
}
st - > clienttype = TCPC_HTTPCLIENT ;
i = strlen ( resp ) ;
if ( st - > outlen + i > sizeof ( st - > outbuffer ) )
return false ;
memcpy ( st - > outbuffer + st - > outlen , resp , i ) ;
st - > outlen + = i ;
resp = " Access-Control-Allow-Origin: * \r \n " ;
i = strlen ( resp ) ;
if ( st - > outlen + i > sizeof ( st - > outbuffer ) )
return false ;
memcpy ( st - > outbuffer + st - > outlen , resp , i ) ;
st - > outlen + = i ;
if ( st - > dlfile | | body )
{
qofs_t size ;
if ( body )
size = strlen ( body ) ;
else
size = VFS_GETLEN ( st - > dlfile ) ;
resp = adr ;
Q_snprintfz ( adr , sizeof ( adr ) , " Content-Length: % " PRIuQOFS " \r \n " , size ) ;
}
else
resp = " Content-Length: 0 \r \n " ;
i = strlen ( resp ) ;
if ( st - > outlen + i > sizeof ( st - > outbuffer ) )
return false ;
memcpy ( st - > outbuffer + st - > outlen , resp , i ) ;
st - > outlen + = i ;
if ( st - > outlen + 2 > sizeof ( st - > outbuffer ) )
return false ;
memcpy ( st - > outbuffer + st - > outlen , " \r \n " , 2 ) ;
st - > outlen + = 2 ;
if ( method = = 1 )
{ //body is not included in HEAD responses
body = NULL ;
if ( st - > dlfile )
VFS_CLOSE ( st - > dlfile ) ;
st - > dlfile = NULL ;
}
else if ( body )
{
i = strlen ( body ) ;
if ( st - > outlen + i > sizeof ( st - > outbuffer ) )
return false ;
memcpy ( st - > outbuffer + st - > outlen , body , i ) ;
st - > outlen + = i ;
}
return true ;
}
void FTENET_TCPConnect_WebRTCServerAssigned ( ftenet_tcpconnect_stream_t * list , ftenet_tcpconnect_stream_t * client , ftenet_tcpconnect_stream_t * server )
{
qbyte buffer [ 5 ] ;
int trynext = 0 ;
ftenet_tcpconnect_stream_t * o ;
if ( client - > webrtc . clientnum < 0 )
client - > webrtc . clientnum = 0 ;
for ( ; ; )
{
for ( o = list ; o ; o = o - > next )
{
if ( o ! = client & & o - > clienttype = = TCPC_WEBRTC_CLIENT & & ! strcmp ( o - > webrtc . resource , client - > webrtc . resource ) & & client - > webrtc . clientnum = = o - > webrtc . clientnum )
break ;
}
if ( ! o )
break ;
client - > webrtc . clientnum = trynext + + ;
}
if ( server )
{ //and tell them both, if the server is actually up
buffer [ 0 ] = 2 ;
buffer [ 1 ] = ( client - > webrtc . clientnum > > 0 ) & 0xff ;
buffer [ 2 ] = ( client - > webrtc . clientnum > > 8 ) & 0xff ;
buffer [ 3 ] = ( client - > webrtc . clientnum > > 16 ) & 0xff ;
buffer [ 4 ] = ( client - > webrtc . clientnum > > 24 ) & 0xff ;
FTENET_TCPConnect_WebSocket_Splurge ( server , 2 , buffer , 5 ) ;
FTENET_TCPConnect_WebSocket_Splurge ( client , 2 , " \x02 \xff \xff \xff \xff " , 5 ) ;
}
}
qboolean FTENET_TCP_ParseHTTPRequest ( ftenet_tcpconnect_connection_t * con , ftenet_tcpconnect_stream_t * st )
{
char * resp ;
char adr [ 256 ] ;
int i , j ;
int attr = 0 ;
int alen = 0 ;
qboolean headerscomplete = false ;
int contentlen = 0 ;
int websocketver = 0 ;
qboolean acceptsgzip = false ;
qboolean sendingweirdness = false ;
char arg [ WCATTR_COUNT ] [ 64 ] ;
if ( ! net_enable_http . ival & & ! net_enable_websockets . ival & & ! net_enable_webrtcbroker . ival )
{
//we need to respond, firefox will create 10 different connections if we just close it
resp = va ( " HTTP/1.1 403 Forbidden \r \n "
" Connection: close \r \n " //let the client know that any pipelining it was doing will have been ignored
" \r \n " ) ;
VFS_WRITE ( st - > clientstream , resp , strlen ( resp ) ) ;
return false ;
}
for ( i = 0 ; i < WCATTR_COUNT ; i + + )
arg [ i ] [ 0 ] = 0 ;
for ( i = 0 ; i < st - > inlen ; i + + )
{
if ( alen = = 63 )
{
Con_Printf ( " http request overflow from %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
//we need to respond, firefox will create 10 different connections if we just close it
resp = va ( " HTTP/1.1 414 URI Too Long \r \n "
" Connection: close \r \n " //let the client know that any pipelining it was doing will have been ignored
" \r \n " ) ;
VFS_WRITE ( st - > clientstream , resp , strlen ( resp ) ) ;
return false ; //overflow...
}
if ( st - > inbuffer [ i ] = = ' ' | | st - > inbuffer [ i ] = = ' \t ' | | st - > inbuffer [ i ] = = ' \r ' )
{
arg [ attr ] [ alen + + ] = 0 ;
alen = 0 ;
if ( attr + + = = WCATTR_HTTP )
break ;
for ( ; i < st - > inlen & & ( st - > inbuffer [ i ] = = ' ' | | st - > inbuffer [ i ] = = ' \t ' | | st - > inbuffer [ i ] = = ' \r ' ) ; i + + )
;
if ( i = = st - > inlen )
break ;
}
if ( st - > inbuffer [ i ] = = ' \n ' )
{
arg [ attr ] [ alen + + ] = 0 ;
alen = 0 ;
break ;
}
if ( st - > inbuffer [ i ] < ' ' & & st - > inbuffer [ i ] ! = ' \t ' )
{
Con_Printf ( " http request contained control codes \n " ) ;
return false ;
}
arg [ attr ] [ alen + + ] = st - > inbuffer [ i ] ;
}
if ( ! * arg [ WCATTR_URL ] ) //don't bug out if it was truncated.
strcpy ( arg [ WCATTR_URL ] , " / " ) ;
if ( st - > inbuffer [ i ] = = ' \r ' )
i + + ;
if ( st - > inbuffer [ i ] = = ' \n ' )
{ //okay, we have at least a line... try scanning the rest of the header for known key:value pairs, and see if we can reach the end
i + + ;
attr = 0 ;
j = i ;
for ( ; i < st - > inlen ; i + + )
{
if ( ( i + 1 < st - > inlen & & st - > inbuffer [ i ] = = ' \r ' & & st - > inbuffer [ i + 1 ] = = ' \n ' ) | |
( i < st - > inlen & & st - > inbuffer [ i ] = = ' \n ' ) )
{
if ( st - > inbuffer [ i ] = = ' \n ' )
i + + ;
else
i + = 2 ;
headerscomplete = true ;
break ;
}
for ( ; i < st - > inlen & & ( st - > inbuffer [ i ] = = ' ' | | st - > inbuffer [ i ] = = ' \t ' ) ; i + + )
;
if ( i = = st - > inlen )
break ;
for ( j = i ; j < st - > inlen ; j + + )
{
if ( st - > inbuffer [ j ] = = ' : ' | | st - > inbuffer [ j ] = = ' \n ' )
{
/*set j to the end of the word, going back past whitespace*/
while ( j > i & & ( st - > inbuffer [ j - 1 ] = = ' ' | | st - > inbuffer [ i - 1 ] = = ' \t ' ) )
j - - ;
break ;
}
}
if ( j - i = = 4 & & ! strnicmp ( & st - > inbuffer [ i ] , " Host " , 4 ) )
attr = WCATTR_HOST ;
else if ( j - i = = 7 & & ! strnicmp ( & st - > inbuffer [ i ] , " Upgrade " , 7 ) )
attr = WCATTR_UPGRADE ;
else if ( j - i = = 10 & & ! strnicmp ( & st - > inbuffer [ i ] , " Connection " , 10 ) )
attr = WCATTR_CONNECTION ;
//websocket stuff
else if ( j - i = = 17 & & ! strnicmp ( & st - > inbuffer [ i ] , " Sec-WebSocket-Key " , 17 ) )
attr = WCATTR_WSKEY ;
else if ( j - i = = 21 & & ! strnicmp ( & st - > inbuffer [ i ] , " Sec-WebSocket-Version " , 21 ) )
attr = WCATTR_WSVER ;
2018-09-23 19:35:24 +00:00
// else if (j-i == 6 && !strnicmp(&st->inbuffer[i], "Origin", j-i))
// attr = WCATTR_ORIGIN;
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
else if ( j - i = = 22 & & ! strnicmp ( & st - > inbuffer [ i ] , " Sec-WebSocket-Protocol " , 22 ) )
attr = WCATTR_WSPROTO ;
2018-09-23 19:35:24 +00:00
// else if (j-i == 24 && !strnicmp(&st->inbuffer[i], "Sec-WebSocket-Extensions", 24))
// attr = WCATTR_WSEXT;
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
//http stuff
else if ( j - i = = 14 & & ! strnicmp ( & st - > inbuffer [ i ] , " Content-Length " , 14 ) )
attr = WCATTR_CONTENT_LENGTH ; //in case they're trying to post/put stuff
else if ( j - i = = 15 & & ! strnicmp ( & st - > inbuffer [ i ] , " Accept-Encoding " , 15 ) )
attr = WCATTR_ACCEPT_ENCODING ; //for gzip
else if ( j - i = = 17 & & ! strnicmp ( & st - > inbuffer [ i ] , " Transfer-Encoding " , 17 ) )
attr = WCATTR_TRANSFER_ENCODING ; //in case they're trying to post/put complex stuff
else if ( j - i = = 13 & & ! strnicmp ( & st - > inbuffer [ i ] , " If-None-Match " , 13 ) )
attr = WCATTR_IFNONEMATCH ; //for clientside caches
else
2012-04-09 19:12:12 +00:00
attr = 0 ;
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
i = j ;
/*skip over the whitespace at the end*/
for ( ; i < st - > inlen & & ( st - > inbuffer [ i ] = = ' ' | | st - > inbuffer [ i ] = = ' \t ' ) ; i + + )
;
if ( i < st - > inlen & & st - > inbuffer [ i ] = = ' : ' )
{
i + + ;
for ( ; i < st - > inlen & & ( st - > inbuffer [ i ] = = ' ' | | st - > inbuffer [ i ] = = ' \t ' ) ; i + + )
;
2012-04-09 19:12:12 +00:00
j = i ;
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
//FIXME: check for control codes. although probably not a problem in this part
for ( ; i < st - > inlen & & st - > inbuffer [ i ] ! = ' \n ' ; i + + )
;
if ( i > j & & st - > inbuffer [ i - 1 ] = = ' \r ' )
i - - ;
if ( attr )
2012-04-09 19:12:12 +00:00
{
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
switch ( attr )
2012-04-09 19:12:12 +00:00
{
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
case WCATTR_CONTENT_LENGTH :
contentlen = atoi ( & st - > inbuffer [ j ] ) ;
break ;
case WCATTR_ACCEPT_ENCODING :
while ( j < i )
{
if ( st - > inbuffer [ j ] = = ' ' | | st - > inbuffer [ j ] = = ' \t ' )
{
j + + ;
continue ;
}
else if ( j + 4 < = i & & ! strncmp ( & st - > inbuffer [ j ] , " gzip " , 4 ) & & ( j + 4 = = i | | st - > inbuffer [ j + 4 ] = = ' ; ' | | st - > inbuffer [ j + 4 ] = = ' , ' ) )
acceptsgzip = true ;
2018-06-18 16:44:29 +00:00
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
while ( j < i & & st - > inbuffer [ j ] ! = ' , ' )
j + + ;
if ( j < i & & st - > inbuffer [ j ] = = ' , ' )
j + + ;
}
break ;
case WCATTR_TRANSFER_ENCODING :
sendingweirdness = true ; //doesn't matter what it is, we can't handle it.
break ;
case WCATTR_WSVER :
websocketver = atoi ( & st - > inbuffer [ j ] ) ;
break ;
default :
Q_strncpyz ( arg [ attr ] , & st - > inbuffer [ j ] , ( i - j > 63 ) ? 64 : ( i - j + 1 ) ) ;
2012-04-09 19:12:12 +00:00
break ;
}
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
}
if ( i < st - > inlen & & st - > inbuffer [ i ] = = ' \r ' )
i + + ;
}
else
{
/*just a word on the line on its own. that would be invalid in http*/
return false ;
}
}
}
2012-04-09 19:12:12 +00:00
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
if ( ! headerscomplete )
{
Con_Printf ( " http header parsing failed \n " ) ;
return false ; //the caller said it was complete! something's fucked if we're here
}
//okay, the above code parsed all the headers that we care about.
2012-04-09 19:12:12 +00:00
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
if ( contentlen & & i + contentlen > st - > inlen )
{ //request isn't complete yet
if ( i + contentlen > sizeof ( st - > inbuffer ) - 1 )
{
resp = va ( " HTTP/1.1 413 Payload Too Large \r \n "
" Connection: close \r \n " //let the client know that any pipelining it was doing will have been ignored
" \r \n " ) ;
VFS_WRITE ( st - > clientstream , resp , strlen ( resp ) ) ;
Con_Printf ( " http oversize request \n " ) ;
return false ; //can never be completed.
}
return true ;
}
//clients uploading chunked stuff is bad/unsupported.
if ( sendingweirdness )
{
resp = va ( " HTTP/1.1 413 Payload Too Large \r \n "
" Connection: close \r \n " //let the client know that any pipelining it was doing will have been ignored
" \r \n " ) ;
VFS_WRITE ( st - > clientstream , resp , strlen ( resp ) ) ;
Con_Printf ( " http encoded request \n " ) ;
return false ; //can't handle the request, so discard the connection
}
memmove ( st - > inbuffer , st - > inbuffer + i , st - > inlen - ( i ) ) ;
st - > inlen - = i ;
//for websocket connections:
//must be a Host, Upgrade=websocket, Connection=Upgrade, Sec-WebSocket-Key=base64(randbytes(16)), Sec-WebSocket-Version=13
//optionally will be Origin=url, Sec-WebSocket-Protocol=FTEWebSocket, Sec-WebSocket-Extensions
//other fields will be ignored.
if ( ! stricmp ( arg [ WCATTR_UPGRADE ] , " websocket " ) & & ( ! stricmp ( arg [ WCATTR_CONNECTION ] , " Upgrade " ) | | ! stricmp ( arg [ WCATTR_CONNECTION ] , " keep-alive, Upgrade " ) ) )
{
if ( ! net_enable_websockets . ival & & ! net_enable_webrtcbroker . ival )
return false ;
if ( websocketver ! = 13 )
{
Con_Printf ( " Outdated websocket request for \" %s \" from \" %s \" . got version %i, expected version 13 \n " , arg [ WCATTR_URL ] , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) , websocketver ) ;
resp = va ( " HTTP/1.1 426 Upgrade Required \r \n "
" Sec-WebSocket-Version: 13 \r \n "
" Connection: close \r \n " //let the client know that any pipelining it was doing will have been ignored
" \r \n " ) ;
VFS_WRITE ( st - > clientstream , resp , strlen ( resp ) ) ;
return false ;
}
else
{
2017-05-10 04:49:12 +00:00
qboolean fail = false ;
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
char acceptkey [ 20 * 2 ] ;
unsigned char sha1digest [ 20 ] ;
char * blurgh ;
char * protoname = " " ;
blurgh = va ( " %s258EAFA5-E914-47DA-95CA-C5AB0DC85B11 " , arg [ WCATTR_WSKEY ] ) ;
tobase64 ( acceptkey , sizeof ( acceptkey ) , sha1digest , SHA1 ( sha1digest , sizeof ( sha1digest ) , blurgh , strlen ( blurgh ) ) ) ;
if ( st - > remoteaddr . prot = = NP_TLS )
st - > remoteaddr . prot = NP_WSS ;
else
st - > remoteaddr . prot = NP_WS ;
Con_Printf ( " Websocket request for %s from %s (%s) \n " , arg [ WCATTR_URL ] , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) , arg [ WCATTR_WSPROTO ] ) ;
protoname = va ( " Sec-WebSocket-Protocol: %s \r \n " , arg [ WCATTR_WSPROTO ] ) ;
//the choice of protocol affects the type of response that we give rather than anything mystic
if ( ! strcmp ( arg [ WCATTR_WSPROTO ] , " quake " ) )
st - > clienttype = TCPC_WEBSOCKETNQ ; //raw nq data, all reliable, for compat with webquake
else if ( ! strcmp ( arg [ WCATTR_WSPROTO ] , " rtc_client " ) )
st - > clienttype = TCPC_WEBRTC_CLIENT ; //not a real client.
else if ( ! strcmp ( arg [ WCATTR_WSPROTO ] , " rtc_host " ) )
st - > clienttype = TCPC_WEBRTC_HOST ; //not a real client, but a competing server! oh noes!
else if ( ! strcmp ( arg [ WCATTR_WSPROTO ] , " binary " ) )
st - > clienttype = TCPC_WEBSOCKETB ; //emscripten's networking libraries insists on 'binary', but we stopped using that a while back because its hostname->ip stuff was flawed.
else if ( ! strcmp ( arg [ WCATTR_WSPROTO ] , " fteqw " ) )
st - > clienttype = TCPC_WEBSOCKETB ; //specific custom protocol name to avoid ambiguities.
else
{
st - > clienttype = TCPC_WEBSOCKETU ; //nacl supports only utf-8 encoded data, at least at the time I implemented it.
protoname = " " ;
}
switch ( st - > clienttype )
{
case TCPC_WEBSOCKETNQ :
case TCPC_WEBSOCKETU :
case TCPC_WEBSOCKETB :
if ( ! net_enable_websockets . ival )
2017-05-10 04:49:12 +00:00
fail = true ;
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
break ;
case TCPC_WEBRTC_HOST :
case TCPC_WEBRTC_CLIENT :
if ( ! net_enable_webrtcbroker . ival )
2017-05-10 04:49:12 +00:00
fail = true ;
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
break ;
2017-05-10 04:32:49 +00:00
default :
return false ;
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
}
if ( * arg [ WCATTR_URL ] = = ' / ' )
Q_strncpyz ( st - > webrtc . resource , arg [ WCATTR_URL ] + 1 , sizeof ( st - > webrtc . resource ) ) ;
else
Q_strncpyz ( st - > webrtc . resource , arg [ WCATTR_URL ] , sizeof ( st - > webrtc . resource ) ) ;
st - > webrtc . clientnum = - 1 ;
# ifndef SUPPORT_RTC_ICE
if ( st - > clienttype = = TCPC_WEBRTC_CLIENT & & ! * st - > webrtc . resource )
fail = true ;
# endif
2017-05-10 04:49:12 +00:00
if ( fail )
return false ;
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
resp = va ( " HTTP/1.1 101 WebSocket Protocol Handshake \r \n "
" Upgrade: websocket \r \n "
" Connection: Upgrade \r \n "
" Access-Control-Allow-Origin: * \r \n " //allow cross-origin requests. this means you can use any domain to play on any public server.
" Sec-WebSocket-Accept: %s \r \n "
" %s "
" \r \n " , acceptkey , protoname ) ;
//send the websocket handshake response.
VFS_WRITE ( st - > clientstream , resp , strlen ( resp ) ) ;
if ( st - > clienttype = = TCPC_WEBRTC_CLIENT & & ! * st - > webrtc . resource )
{ //client should be connected to us rather than any impostors. tell it to start its ICE handshake.
FTENET_TCPConnect_WebSocket_Splurge ( st , 2 , " \x02 \xff \xff \xff \xff " , 5 ) ;
}
else if ( st - > clienttype = = TCPC_WEBRTC_HOST | | st - > clienttype = = TCPC_WEBRTC_CLIENT )
{
ftenet_tcpconnect_stream_t * o ;
if ( st - > clienttype = = TCPC_WEBRTC_HOST )
{ //if its a server, then let it know its final resource name
if ( ! * st - > webrtc . resource )
{ //webrtc servers need some unique resource address. lets use their ip+port for now. we should probably be randomising this
Q_snprintfz ( st - > webrtc . resource , sizeof ( st - > webrtc . resource ) , " %s " , adr ) ;
}
for ( o = con - > tcpstreams ; o ; o = o - > next )
2012-04-09 19:12:12 +00:00
{
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
if ( o ! = st & & o - > clienttype = = TCPC_WEBRTC_HOST & & ! strcmp ( st - > webrtc . resource , o - > webrtc . resource ) )
return false ; //conflict! can't have two servers listening on the same url
2012-04-09 19:12:12 +00:00
}
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
net_message_buffer [ 0 ] = 1 ;
net_message_buffer [ 1 ] = 0xff ;
net_message_buffer [ 2 ] = 0xff ;
strcpy ( net_message_buffer + 3 , st - > webrtc . resource ) ;
FTENET_TCPConnect_WebSocket_Splurge ( st , 2 , net_message_buffer , strlen ( net_message_buffer ) ) ;
//if we have (inactive) clients connected, assign them (and let them know that they need to start handshaking)
for ( o = con - > tcpstreams ; o ; o = o - > next )
2012-04-09 19:12:12 +00:00
{
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
if ( o - > clienttype = = TCPC_WEBRTC_CLIENT & & ! strcmp ( st - > webrtc . resource , o - > webrtc . resource ) )
FTENET_TCPConnect_WebRTCServerAssigned ( con - > tcpstreams , o , st ) ;
2012-04-09 19:12:12 +00:00
}
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
}
else
{ //find its server, if we can
for ( o = con - > tcpstreams ; o ; o = o - > next )
2012-04-09 19:12:12 +00:00
{
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
if ( o - > clienttype = = TCPC_WEBRTC_HOST & & ! strcmp ( st - > webrtc . resource , o - > webrtc . resource ) )
break ;
2012-04-09 19:12:12 +00:00
}
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
//and assign it to this client
FTENET_TCPConnect_WebRTCServerAssigned ( con - > tcpstreams , st , o ) ;
2012-04-09 19:12:12 +00:00
}
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
}
2012-04-09 19:12:12 +00:00
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
//and the connection is okay
2012-04-09 19:12:12 +00:00
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
if ( st - > clienttype = = TCPC_WEBSOCKETNQ )
{
//inject a connection request so that our server actually accepts them...
net_message . cursize = 0 ;
net_message . packing = SZ_RAWBYTES ;
net_message . currentbit = 0 ;
net_from = st - > remoteaddr ;
MSG_WriteLong ( & net_message , LongSwap ( NETFLAG_CTL | ( strlen ( NQ_NETCHAN_GAMENAME ) + 7 ) ) ) ;
MSG_WriteByte ( & net_message , CCREQ_CONNECT ) ;
MSG_WriteString ( & net_message , NQ_NETCHAN_GAMENAME ) ;
MSG_WriteByte ( & net_message , NQ_NETCHAN_VERSION ) ;
}
return true ;
}
}
else
{
if ( ! net_enable_http . ival )
return false ;
return FTENET_TCPConnect_HTTPResponse ( st , arg , acceptsgzip ) ;
}
}
2019-05-23 15:11:32 +00:00
# endif
# if defined(HAVE_SSL) && (defined(HAVE_SERVER) || defined(HAVE_HTTPSV))
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
static int QDECL TLSPromoteRead ( struct vfsfile_s * file , void * buffer , int bytestoread )
{
if ( bytestoread > net_message . cursize )
bytestoread = net_message . cursize ;
memcpy ( buffer , net_message_buffer , bytestoread ) ;
2017-05-18 10:24:09 +00:00
net_message . cursize - = bytestoread ;
memmove ( net_message_buffer , net_message_buffer + bytestoread , net_message . cursize ) ;
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
return bytestoread ;
}
# endif
void FTENET_TCPConnect_PrintStatus ( ftenet_generic_connection_t * gcon )
{
ftenet_tcpconnect_connection_t * con = ( ftenet_tcpconnect_connection_t * ) gcon ;
ftenet_tcpconnect_stream_t * st ;
char adr [ MAX_QPATH ] ;
if ( ! con - > tcpstreams )
return ;
for ( st = con - > tcpstreams ; st ; st = st - > next )
{
NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ;
switch ( st - > clienttype )
{
case TCPC_UNKNOWN : //note: this is often a pending http client that's waiting on the off-chance of having more requests to send
Con_Printf ( " handshaking %s \n " , adr ) ;
break ;
case TCPC_QIZMO :
Con_Printf ( " qizmo %s \n " , adr ) ;
break ;
2019-05-23 15:11:32 +00:00
# ifdef HAVE_HTTPSV
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
case TCPC_WEBSOCKETU :
case TCPC_WEBSOCKETB :
case TCPC_WEBSOCKETNQ :
Con_Printf ( " websocket %s \n " , adr ) ;
break ;
case TCPC_HTTPCLIENT :
Con_Printf ( " http %s \n " , adr ) ;
break ;
case TCPC_WEBRTC_CLIENT :
Con_Printf ( " webrtc client %s/%s \n " , adr , st - > webrtc . resource ) ;
break ;
case TCPC_WEBRTC_HOST :
Con_Printf ( " webrtc host %s/%s \n " , adr , st - > webrtc . resource ) ;
break ;
# endif
}
}
}
qboolean FTENET_TCPConnect_GetPacket ( ftenet_generic_connection_t * gcon )
{
ftenet_tcpconnect_connection_t * con = ( ftenet_tcpconnect_connection_t * ) gcon ;
int ret ;
char adr [ MAX_ADR_SIZE ] ;
struct sockaddr_qstorage from ;
int fromlen ;
2012-04-09 19:12:12 +00:00
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
float timeval = Sys_DoubleTime ( ) ;
ftenet_tcpconnect_stream_t * st ;
st = con - > tcpstreams ;
2012-04-09 19:12:12 +00:00
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
//remove any stale ones
while ( con - > tcpstreams & & con - > tcpstreams - > clientstream = = NULL )
{
st = con - > tcpstreams ;
con - > tcpstreams = con - > tcpstreams - > next ;
BZ_Free ( st ) ;
}
2012-04-09 19:12:12 +00:00
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
for ( st = con - > tcpstreams ; st ; st = st - > next )
{ //client receiving only via tcp
2013-04-06 03:36:00 +00:00
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
while ( st - > next & & st - > next - > clientstream = = NULL )
{
ftenet_tcpconnect_stream_t * temp ;
temp = st - > next ;
st - > next = st - > next - > next ;
BZ_Free ( temp ) ;
con - > active - - ;
}
2013-12-09 01:18:27 +00:00
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
//due to the above checks about invalid sockets, the socket is always open for st below.
2012-04-09 19:12:12 +00:00
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
if ( st - > timeouttime < timeval )
{
2018-12-28 00:04:36 +00:00
# ifdef HAVE_HTTPSV
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
if ( ! st - > pinging & & ( st - > clienttype = = TCPC_WEBRTC_CLIENT | | st - > clienttype = = TCPC_WEBRTC_HOST ) & & * st - > webrtc . resource )
{ //ping broker clients. there usually shouldn't be any data flow to keep it active otherwise.
st - > timeouttime = timeval + 30 ;
st - > pinging = true ;
2013-12-09 01:18:27 +00:00
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
FTENET_TCPConnect_WebSocket_Splurge ( st , 0x9 , " ping " , 4 ) ;
}
else
# endif
{
2018-12-28 00:04:36 +00:00
Con_DPrintf ( " tcp peer %s timed out \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
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
goto closesvstream ;
}
}
ret = VFS_READ ( st - > clientstream , st - > inbuffer + st - > inlen , sizeof ( st - > inbuffer ) - 1 - st - > inlen ) ;
if ( ret < 0 )
{
Con_Printf ( " tcp peer %s closed connection \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
closesvstream :
2017-05-18 10:24:09 +00:00
if ( st - > clientstream )
VFS_CLOSE ( st - > clientstream ) ;
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
st - > clientstream = NULL ;
continue ;
}
st - > inlen + = ret ;
switch ( st - > clienttype )
{
case TCPC_UNKNOWN :
if ( st - > inlen < 6 )
continue ;
2018-12-28 00:04:36 +00:00
# if defined(HAVE_SSL) && (defined(HAVE_SERVER) || defined(HAVE_HTTPSV)) //if its non-ascii, then try and upgrade the connection to tls
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
if ( net_enable_tls . ival & & con - > generic . islisten & & st - > remoteaddr . prot = = NP_STREAM & & st - > clientstream & & ! ( ( st - > inbuffer [ 0 ] > = ' a ' & & st - > inbuffer [ 0 ] < = ' z ' ) | | ( st - > inbuffer [ 0 ] > = ' A ' & & st - > inbuffer [ 0 ] < = ' Z ' ) ) )
{
//copy off our buffer so we can read it into the tls stream's buffer instead.
2018-12-28 00:04:36 +00:00
char tmpbuf [ 256 ] ;
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
vfsfile_t * stream = st - > clientstream ;
int ( QDECL * realread ) ( struct vfsfile_s * file , void * buffer , int bytestoread ) ;
realread = stream - > ReadBytes ;
stream - > ReadBytes = TLSPromoteRead ;
memcpy ( net_message_buffer , st - > inbuffer , st - > inlen ) ;
net_message . cursize = st - > inlen ;
//wrap the stream now
2017-05-18 10:24:09 +00:00
st - > clientstream = FS_OpenSSL ( NULL , st - > clientstream , true ) ;
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
st - > remoteaddr . prot = NP_TLS ;
2017-05-18 10:24:09 +00:00
if ( st - > clientstream )
{
//try and reclaim it all
st - > inlen = VFS_READ ( st - > clientstream , st - > inbuffer , sizeof ( st - > inbuffer ) - 1 ) ;
//make sure we actually read from the proper stream again
stream - > ReadBytes = realread ;
}
if ( ! st - > clientstream | | net_message . cursize )
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
goto closesvstream ; //something cocked up. we didn't give the tls stream all the data.
2018-12-28 00:04:36 +00:00
if ( developer . ival )
Con_Printf ( " promoted peer to tls: %s \n " , NET_AdrToString ( tmpbuf , sizeof ( tmpbuf ) , & st - > remoteaddr ) ) ;
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
net_message . cursize = 0 ;
continue ;
}
# endif
if ( ! strncmp ( st - > inbuffer , " qizmo \n " , 6 ) )
{
2018-12-28 00:04:36 +00:00
if (
# ifdef HAVE_SERVER
net_enable_qizmo . ival | |
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
# endif
2018-12-28 00:04:36 +00:00
! con - > generic . islisten )
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
{
memmove ( st - > inbuffer , st - > inbuffer + 6 , st - > inlen - ( 6 ) ) ;
st - > inlen - = 6 ;
st - > clienttype = TCPC_QIZMO ;
if ( con - > generic . islisten )
{
//send the qizmo handshake response.
VFS_WRITE ( st - > clientstream , " qizmo \n " , 6 ) ;
2012-04-09 19:12:12 +00:00
}
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
}
else
goto closesvstream ;
2018-12-28 00:04:36 +00:00
} else
# ifdef HAVE_HTTPSV
if ( con - > generic . islisten ) // && !strncmp(st->inbuffer, "GET ", 4))
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
{
//qtv or http request header. these terminate with a blank line.
int i = 0 ;
qboolean headerscomplete = false ;
for ( ; i < st - > inlen ; i + + )
{
//we're at the start of a line, so if its a \r\n or a \n then its a blank line, and the headers are complete
if ( ( i + 1 < st - > inlen & & st - > inbuffer [ i ] = = ' \r ' & & st - > inbuffer [ i + 1 ] = = ' \n ' ) | |
( i < st - > inlen & & st - > inbuffer [ i ] = = ' \n ' ) )
{
if ( st - > inbuffer [ i ] = = ' \n ' )
i + + ;
else
i + = 2 ;
headerscomplete = true ;
break ;
}
for ( ; i < st - > inlen & & st - > inbuffer [ i ] ! = ' \n ' ; i + + )
;
}
if ( headerscomplete )
{
2018-09-01 04:18:08 +00:00
# ifdef MVD_RECORDING
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
//for QTV connections, we just need the method and a blank line. our qtv parser will parse the actual headers.
if ( ! Q_strncasecmp ( st - > inbuffer , " QTV " , 3 ) )
2012-04-09 19:12:12 +00:00
{
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 r = net_enable_qtv . ival ? SV_MVD_GotQTVRequest ( st - > clientstream , st - > inbuffer , st - > inbuffer + st - > inlen , & st - > qtvstate ) : - 1 ;
i = st - > inlen ;
2012-04-09 19:12:12 +00:00
memmove ( st - > inbuffer , st - > inbuffer + i , st - > inlen - ( i ) ) ;
st - > inlen - = i ;
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
switch ( r )
2013-03-12 23:09:25 +00:00
{
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
case - 1 :
goto closesvstream ;
case 0 :
continue ;
case 1 :
st - > clientstream = NULL ;
2013-04-06 03:36:00 +00:00
continue ;
}
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
}
else
2018-09-01 04:18:08 +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
{
net_message . cursize = 0 ;
if ( ! FTENET_TCP_ParseHTTPRequest ( con , st ) )
goto closesvstream ;
2012-04-09 19:12:12 +00:00
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
if ( net_message . cursize > 0 )
return true ;
2012-04-09 19:12:12 +00:00
}
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
continue ;
2012-04-09 19:12:12 +00:00
}
2018-12-28 00:04:36 +00:00
} else
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
# endif
2012-04-09 19:12:12 +00:00
{
2018-12-28 00:04:36 +00:00
Con_DPrintf ( " Unknown TCP handshake from %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
2012-04-09 19:12:12 +00:00
goto closesvstream ;
}
break ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_HTTPSV
2013-04-06 03:36:00 +00:00
case TCPC_HTTPCLIENT :
if ( st - > outlen )
{ /*try and flush the old data*/
int done ;
2014-03-30 08:55:06 +00:00
done = VFS_WRITE ( st - > clientstream , st - > outbuffer , st - > outlen ) ;
2013-04-06 03:36:00 +00:00
if ( done > 0 )
{
memmove ( st - > outbuffer , st - > outbuffer + done , st - > outlen - done ) ;
st - > outlen - = done ;
st - > timeouttime = timeval + 30 ;
}
}
if ( ! st - > outlen )
{
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
if ( st - > dlfile )
st - > outlen = VFS_READ ( st - > dlfile , st - > outbuffer , sizeof ( st - > outbuffer ) ) ;
else
st - > outlen = 0 ;
2013-04-06 03:36:00 +00:00
if ( st - > outlen < = 0 )
{
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
if ( st - > dlfile )
VFS_CLOSE ( st - > dlfile ) ;
2014-03-30 08:55:06 +00:00
st - > dlfile = NULL ;
2013-04-06 03:36:00 +00:00
st - > clienttype = TCPC_UNKNOWN ;
2018-12-28 00:04:36 +00:00
Con_DPrintf ( " Outgoing file transfer complete \n " ) ;
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
if ( st - > httpstate . connection_close )
goto closesvstream ;
2013-04-06 03:36:00 +00:00
}
}
continue ;
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
# endif
2012-04-09 19:12:12 +00:00
case TCPC_QIZMO :
if ( st - > inlen < 2 )
continue ;
net_message . cursize = BigShort ( * ( short * ) st - > inbuffer ) ;
if ( net_message . cursize > = sizeof ( net_message_buffer ) )
2005-11-30 01:20:53 +00:00
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Warning: Oversize packet from %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
2005-11-30 01:20:53 +00:00
goto closesvstream ;
}
2012-04-09 19:12:12 +00:00
if ( net_message . cursize + 2 > st - > inlen )
{ //not enough buffered to read a packet out of it.
continue ;
}
2008-11-09 22:29:28 +00:00
2012-04-09 19:12:12 +00:00
memcpy ( net_message_buffer , st - > inbuffer + 2 , net_message . cursize ) ;
memmove ( st - > inbuffer , st - > inbuffer + net_message . cursize + 2 , st - > inlen - ( net_message . cursize + 2 ) ) ;
st - > inlen - = net_message . cursize + 2 ;
2008-11-09 22:29:28 +00:00
2012-04-09 19:12:12 +00:00
net_message . packing = SZ_RAWBYTES ;
net_message . currentbit = 0 ;
net_from = st - > remoteaddr ;
2008-11-09 22:29:28 +00:00
2012-04-09 19:12:12 +00:00
return true ;
2019-05-23 15:11:32 +00:00
# ifdef HAVE_HTTPSV
2013-04-06 03:36:00 +00:00
case TCPC_WEBSOCKETU :
case TCPC_WEBSOCKETB :
2013-12-09 01:18:27 +00:00
case TCPC_WEBSOCKETNQ :
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
case TCPC_WEBRTC_HOST :
case TCPC_WEBRTC_CLIENT :
2012-04-09 19:12:12 +00:00
while ( st - > inlen > = 2 )
{
unsigned short ctrl = ( ( unsigned char * ) st - > inbuffer ) [ 0 ] < < 8 | ( ( unsigned char * ) st - > inbuffer ) [ 1 ] ;
unsigned long paylen ;
unsigned int payoffs = 2 ;
unsigned int mask = 0 ;
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
// st->inbuffer[st->inlen]=0;
2015-04-14 23:12:17 +00:00
if ( ctrl & 0x7000 )
{
Con_Printf ( " %s: reserved bits set \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
2018-06-18 16:44:29 +00:00
goto closesvstream ;
2015-04-14 23:12:17 +00:00
}
2012-04-09 19:12:12 +00:00
if ( ( ctrl & 0x7f ) = = 127 )
{
2016-02-15 06:01:17 +00:00
quint64_t ullpaylen ;
2012-04-09 19:12:12 +00:00
//as a payload is not allowed to be encoded as too large a type, and quakeworld never used packets larger than 1450 bytes anyway, this code isn't needed (65k is the max even without this)
2015-04-14 23:12:17 +00:00
if ( sizeof ( ullpaylen ) < 8 )
2012-04-09 19:12:12 +00:00
{
2013-05-03 04:28:08 +00:00
Con_Printf ( " %s: payload frame too large \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
2018-06-18 16:44:29 +00:00
goto closesvstream ;
2012-04-09 19:12:12 +00:00
}
2015-04-14 23:12:17 +00:00
else
2012-04-09 19:12:12 +00:00
{
if ( payoffs + 8 > st - > inlen )
break ;
2018-06-18 16:44:29 +00:00
ullpaylen =
2016-08-25 00:12:14 +00:00
( quint64_t ) ( ( unsigned char * ) st - > inbuffer ) [ payoffs + 0 ] < < 56u |
( quint64_t ) ( ( unsigned char * ) st - > inbuffer ) [ payoffs + 1 ] < < 48u |
( quint64_t ) ( ( unsigned char * ) st - > inbuffer ) [ payoffs + 2 ] < < 40u |
( quint64_t ) ( ( unsigned char * ) st - > inbuffer ) [ payoffs + 3 ] < < 32u |
( quint64_t ) ( ( unsigned char * ) st - > inbuffer ) [ payoffs + 4 ] < < 24u |
( quint64_t ) ( ( unsigned char * ) st - > inbuffer ) [ payoffs + 5 ] < < 16u |
( quint64_t ) ( ( unsigned char * ) st - > inbuffer ) [ payoffs + 6 ] < < 8u |
( quint64_t ) ( ( unsigned char * ) st - > inbuffer ) [ payoffs + 7 ] < < 0u ;
2015-04-14 23:12:17 +00:00
if ( ullpaylen < 0x10000 )
2012-04-09 19:12:12 +00:00
{
2016-02-10 23:23:43 +00:00
Con_Printf ( " %s: payload size (% " PRIu64 " ) encoded badly \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) , ullpaylen ) ;
2018-06-18 16:44:29 +00:00
goto closesvstream ;
2012-04-09 19:12:12 +00:00
}
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
if ( ullpaylen > 0x40000 )
2015-04-14 23:12:17 +00:00
{
2016-02-10 23:23:43 +00:00
Con_Printf ( " %s: payload size (% " PRIu64 " ) is abusive \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) , ullpaylen ) ;
2018-06-18 16:44:29 +00:00
goto closesvstream ;
2015-04-14 23:12:17 +00:00
}
paylen = ullpaylen ;
2012-04-09 19:12:12 +00:00
payoffs + = 8 ;
}
2015-04-14 23:12:17 +00:00
}
2012-04-09 19:12:12 +00:00
else if ( ( ctrl & 0x7f ) = = 126 )
{
if ( payoffs + 2 > st - > inlen )
break ;
2018-06-18 16:44:29 +00:00
paylen =
2012-04-09 19:12:12 +00:00
( ( unsigned char * ) st - > inbuffer ) [ payoffs + 0 ] < < 8 |
( ( unsigned char * ) st - > inbuffer ) [ payoffs + 1 ] < < 0 ;
if ( paylen < 126 )
{
2013-05-03 04:28:08 +00:00
Con_Printf ( " %s: payload size encoded badly \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
2018-06-18 16:44:29 +00:00
goto closesvstream ;
2012-04-09 19:12:12 +00:00
}
payoffs + = 2 ;
}
else
{
paylen = ctrl & 0x7f ;
}
if ( ctrl & 0x80 )
{
if ( payoffs + 4 > st - > inlen )
break ;
/*this might read data that isn't set yet, but should be safe*/
( ( unsigned char * ) & mask ) [ 0 ] = ( ( unsigned char * ) st - > inbuffer ) [ payoffs + 0 ] ;
( ( unsigned char * ) & mask ) [ 1 ] = ( ( unsigned char * ) st - > inbuffer ) [ payoffs + 1 ] ;
( ( unsigned char * ) & mask ) [ 2 ] = ( ( unsigned char * ) st - > inbuffer ) [ payoffs + 2 ] ;
( ( unsigned char * ) & mask ) [ 3 ] = ( ( unsigned char * ) st - > inbuffer ) [ payoffs + 3 ] ;
payoffs + = 4 ;
}
/*if there isn't space, try again next time around*/
if ( payoffs + paylen > st - > inlen )
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
{
if ( payoffs + paylen > = sizeof ( st - > inbuffer ) - 1 )
{
Con_TPrintf ( " Warning: Oversize packet from %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
goto closesvstream ; //can't ever complete
}
2012-04-09 19:12:12 +00:00
break ;
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
}
2008-11-09 22:29:28 +00:00
2012-04-09 19:12:12 +00:00
if ( mask )
{
int i ;
for ( i = 0 ; i < paylen ; i + + )
{
( ( unsigned char * ) st - > inbuffer ) [ i + payoffs ] ^ = ( ( unsigned char * ) & mask ) [ i & 3 ] ;
}
}
2008-11-09 22:29:28 +00:00
2012-04-09 19:12:12 +00:00
net_message . cursize = 0 ;
2008-11-09 22:29:28 +00:00
2012-04-09 19:12:12 +00:00
switch ( ( ctrl > > 8 ) & 0xf )
{
2015-04-14 23:12:17 +00:00
case 0x0 : /*continuation*/
2013-05-03 04:28:08 +00:00
Con_Printf ( " websocket continuation frame from %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
2012-04-09 19:12:12 +00:00
goto closesvstream ;
2015-04-14 23:12:17 +00:00
case 0x1 : /*text frame*/
2012-04-09 19:12:12 +00:00
// Con_Printf ("websocket text frame from %s\n", NET_AdrToString (adr, sizeof(adr), st->remoteaddr));
{
/*text frames are pure utf-8 chars, no dodgy encodings or anything, all pre-checked...
except we ' re trying to send binary data .
so we need to unmask things ( char 0 is encoded as 0x100 - truncate it )
*/
unsigned char * in = st - > inbuffer + payoffs , * out = net_message_buffer ;
int len = paylen ;
while ( len & & out < net_message_buffer + sizeof ( net_message_buffer ) )
{
if ( ( * in & 0xe0 ) = = 0xc0 & & len > 1 )
{
* out = ( ( in [ 0 ] & 0x1f ) < < 6 ) | ( ( in [ 1 ] & 0x3f ) < < 0 ) ;
in + = 2 ;
len - = 2 ;
}
else if ( * in & 0x80 )
{
* out = ' ? ' ;
in + + ;
len - = 1 ;
}
else
{
* out = in [ 0 ] ;
in + + ;
len - = 1 ;
}
out + + ;
}
net_message . cursize = out - net_message_buffer ;
}
break ;
2015-04-14 23:12:17 +00:00
case 0x2 : /*binary frame*/
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
// Con_Printf ("websocket binary frame from %s\n", NET_AdrToString (adr, sizeof(adr), &st->remoteaddr));
2012-04-09 19:12:12 +00:00
net_message . cursize = paylen ;
2013-12-09 01:18:27 +00:00
if ( net_message . cursize + 8 > = sizeof ( net_message_buffer ) )
2012-04-09 19:12:12 +00:00
{
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
Con_TPrintf ( " Warning: Oversize packet from %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
2012-04-09 19:12:12 +00:00
goto closesvstream ;
}
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
# ifdef SUPPORT_RTC_ICE
if ( st - > clienttype = = TCPC_WEBRTC_CLIENT & & ! * st - > webrtc . resource )
{ //this is a client that's corrected directly to us via webrtc.
//FIXME: we don't support dtls, so browers will bitch about our sdp.
if ( paylen + 1 < sizeof ( net_message_buffer ) )
{
net_message_buffer [ paylen ] = 0 ;
memcpy ( net_message_buffer , st - > inbuffer + payoffs , paylen ) ;
if ( ! st - > webrtc . ice ) //if the ice state isn't established yet, do that now.
st - > webrtc . ice = iceapi . ICE_Create ( NULL , " test " , " rtc://foo " , ICEM_ICE , ICEP_QWSERVER ) ;
iceapi . ICE_Set ( st - > webrtc . ice , " sdp " , net_message_buffer ) ;
if ( iceapi . ICE_Get ( st - > webrtc . ice , " sdp " , net_message_buffer , sizeof ( net_message_buffer ) ) )
FTENET_TCPConnect_WebSocket_Splurge ( st , 2 , net_message_buffer , strlen ( net_message_buffer ) ) ;
}
net_message . cursize = 0 ;
}
else
# endif
if ( ( st - > clienttype = = TCPC_WEBRTC_CLIENT | | st - > clienttype = = TCPC_WEBRTC_HOST ) & & paylen > = 3 )
{ //we're brokering a client+server. all messages should be unicasts between a client and its host, matched by resource.
ftenet_tcpconnect_stream_t * o ;
int clnum = ( st - > inbuffer [ payoffs + 1 ] < < 0 ) | ( st - > inbuffer [ payoffs + 2 ] < < 8 ) ;
int type = ( st - > clienttype ! = TCPC_WEBRTC_CLIENT ) ? TCPC_WEBRTC_CLIENT : TCPC_WEBRTC_HOST ;
for ( o = con - > tcpstreams ; o ; o = o - > next )
{
if ( o - > clienttype = = type & & clnum = = o - > webrtc . clientnum & & ! strcmp ( o - > webrtc . resource , st - > webrtc . resource ) )
{
st - > inbuffer [ payoffs + 1 ] = ( st - > webrtc . clientnum > > 0 ) & 0xff ;
st - > inbuffer [ payoffs + 2 ] = ( st - > webrtc . clientnum > > 8 ) & 0xff ;
FTENET_TCPConnect_WebSocket_Splurge ( o , 2 , st - > inbuffer + payoffs , paylen ) ;
break ;
}
}
net_message . cursize = 0 ;
}
else
# ifdef NQPROT
if ( st - > clienttype = = TCPC_WEBSOCKETNQ )
{ //hack in an 8-byte header
2013-12-09 01:18:27 +00:00
payoffs + = 1 ;
paylen - = 1 ;
memcpy ( net_message_buffer + 8 , st - > inbuffer + payoffs , paylen ) ;
net_message . cursize = paylen + 8 ;
( ( int * ) net_message_buffer ) [ 0 ] = BigLong ( NETFLAG_UNRELIABLE | net_message . cursize ) ;
( ( int * ) net_message_buffer ) [ 1 ] = LongSwap ( + + st - > fakesequence ) ;
}
else
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
# endif
2013-12-09 01:18:27 +00:00
memcpy ( net_message_buffer , st - > inbuffer + payoffs , paylen ) ;
2012-04-09 19:12:12 +00:00
break ;
2015-04-14 23:12:17 +00:00
case 0x8 : /*connection close*/
2013-05-03 04:28:08 +00:00
Con_Printf ( " websocket closure %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
2012-04-09 19:12:12 +00:00
goto closesvstream ;
2015-04-14 23:12:17 +00:00
case 0x9 : /*ping*/
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
// Con_Printf ("websocket ping from %s\n", NET_AdrToString (adr, sizeof(adr), &st->remoteaddr));
2016-07-12 00:40:13 +00:00
if ( FTENET_TCPConnect_WebSocket_Splurge ( st , 0xa , st - > inbuffer + payoffs , paylen ) ! = NETERR_SENT )
2015-04-14 23:12:17 +00:00
goto closesvstream ;
break ;
case 0xa : /*pong*/
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
st - > timeouttime = Sys_DoubleTime ( ) + 30 ;
st - > pinging = false ;
// Con_Printf ("websocket pong from %s\n", NET_AdrToString (adr, sizeof(adr), &st->remoteaddr));
break ;
2012-04-09 19:12:12 +00:00
default :
2013-05-03 04:28:08 +00:00
Con_Printf ( " Unsupported websocket opcode (%i) from %s \n " , ( ctrl > > 8 ) & 0xf , NET_AdrToString ( adr , sizeof ( adr ) , & st - > remoteaddr ) ) ;
2012-04-09 19:12:12 +00:00
goto closesvstream ;
}
memmove ( st - > inbuffer , st - > inbuffer + payoffs + paylen , st - > inlen - ( payoffs + paylen ) ) ;
st - > inlen - = payoffs + paylen ;
if ( net_message . cursize )
{
net_message . packing = SZ_RAWBYTES ;
net_message . currentbit = 0 ;
net_from = st - > remoteaddr ;
return true ;
}
}
break ;
2019-05-23 15:11:32 +00:00
# endif
2012-04-09 19:12:12 +00:00
}
2008-11-09 22:29:28 +00:00
}
if ( con - > generic . thesocket ! = INVALID_SOCKET & & con - > active < 256 )
{
int newsock ;
2012-01-17 07:57:46 +00:00
fromlen = sizeof ( from ) ;
2008-11-09 22:29:28 +00:00
newsock = accept ( con - > generic . thesocket , ( struct sockaddr * ) & from , & fromlen ) ;
if ( newsock ! = INVALID_SOCKET )
{
2014-03-30 08:55:06 +00:00
char tmpbuf [ 256 ] ;
2008-11-09 22:29:28 +00:00
int _true = true ;
2011-05-19 13:34:07 +00:00
ioctlsocket ( newsock , FIONBIO , ( u_long * ) & _true ) ;
2008-11-09 22:29:28 +00:00
setsockopt ( newsock , IPPROTO_TCP , TCP_NODELAY , ( char * ) & _true , sizeof ( _true ) ) ;
con - > active + + ;
st = Z_Malloc ( sizeof ( * con - > tcpstreams ) ) ;
2014-03-30 08:55:06 +00:00
/*grab the net address*/
2018-09-23 19:35:24 +00:00
SockadrToNetadr ( & from , fromlen , & st - > remoteaddr ) ;
2018-12-28 00:04:36 +00:00
if ( developer . ival )
Con_Printf ( " new TCP connection from %s \n " , NET_AdrToString ( tmpbuf , sizeof ( tmpbuf ) , & st - > remoteaddr ) ) ;
2012-04-09 19:12:12 +00:00
st - > clienttype = TCPC_UNKNOWN ;
2008-11-09 22:29:28 +00:00
st - > next = con - > tcpstreams ;
con - > tcpstreams = st ;
st - > socketnum = newsock ;
2014-03-30 08:55:06 +00:00
st - > clientstream = FS_OpenTCPSocket ( newsock , false , NET_AdrToString ( tmpbuf , sizeof ( tmpbuf ) , & st - > remoteaddr ) ) ;
2008-11-09 22:29:28 +00:00
st - > inlen = 0 ;
2009-06-10 22:36:53 +00:00
2014-03-30 08:55:06 +00:00
# ifdef HAVE_SSL
2016-11-02 08:01:21 +00:00
if ( con - > tls & & st - > clientstream ) //if we're meant to be using tls, wrap the stream in a tls connection
2014-03-30 08:55:06 +00:00
{
2017-05-18 10:24:09 +00:00
st - > clientstream = FS_OpenSSL ( NULL , st - > clientstream , true ) ;
2014-03-30 08:55:06 +00:00
/*sockadr doesn't contain transport info, so fix that up here*/
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
st - > remoteaddr . prot = NP_TLS ;
2014-03-30 08:55:06 +00:00
}
else
# endif
{
/*sockadr doesn't contain transport info, so fix that up here*/
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
st - > remoteaddr . prot = NP_STREAM ;
2014-03-30 08:55:06 +00:00
}
2008-11-09 22:29:28 +00:00
st - > timeouttime = timeval + 30 ;
}
}
return false ;
}
2016-07-12 00:40:13 +00:00
neterr_t FTENET_TCPConnect_SendPacket ( ftenet_generic_connection_t * gcon , int length , const void * data , netadr_t * to )
2008-11-09 22:29:28 +00:00
{
ftenet_tcpconnect_connection_t * con = ( ftenet_tcpconnect_connection_t * ) gcon ;
ftenet_tcpconnect_stream_t * st ;
for ( st = con - > tcpstreams ; st ; st = st - > next )
{
2014-03-30 08:55:06 +00:00
if ( st - > clientstream = = NULL )
2008-11-09 22:29:28 +00:00
continue ;
2013-05-03 04:28:08 +00:00
if ( NET_CompareAdr ( to , & st - > remoteaddr ) )
2008-11-09 22:29:28 +00:00
{
2012-04-09 19:12:12 +00:00
if ( ! st - > outlen )
{
switch ( st - > clienttype )
{
case TCPC_QIZMO :
{
unsigned short slen = BigShort ( ( unsigned short ) length ) ;
2016-07-12 00:40:13 +00:00
if ( length > 0xffff )
return NETERR_MTU ;
2012-09-30 05:52:03 +00:00
if ( st - > outlen + sizeof ( slen ) + length > sizeof ( st - > outbuffer ) )
{
2016-07-12 00:40:13 +00:00
if ( length + sizeof ( slen ) > sizeof ( st - > outbuffer ) )
return NETERR_MTU ;
2012-09-30 05:52:03 +00:00
Con_DPrintf ( " FTENET_TCPConnect_SendPacket: outgoing overflow \n " ) ;
2016-07-12 00:40:13 +00:00
return NETERR_CLOGGED ;
2012-09-30 05:52:03 +00:00
}
else
{
memcpy ( st - > outbuffer + st - > outlen , & slen , sizeof ( slen ) ) ;
memcpy ( st - > outbuffer + st - > outlen + sizeof ( slen ) , data , length ) ;
st - > outlen + = sizeof ( slen ) + length ;
}
2012-04-09 19:12:12 +00:00
}
break ;
2019-05-23 15:11:32 +00:00
# ifdef HAVE_HTTPSV
2013-12-09 01:18:27 +00:00
case TCPC_WEBSOCKETNQ :
if ( length < 8 | | ( ( char * ) data ) [ 0 ] & 0x80 )
break ;
// length = 2;
// data = "\1\1";
length - = 7 ;
data = ( char * ) data + 7 ;
* ( char * ) data = 1 ; //for compat with webquake, we add an extra byte at the start. 1 for reliable, 2 for unreliable.
//fallthrough
2013-04-06 03:36:00 +00:00
case TCPC_WEBSOCKETU :
case TCPC_WEBSOCKETB :
2019-05-23 15:11:32 +00:00
{
neterr_t e = FTENET_TCPConnect_WebSocket_Splurge ( st , ( st - > clienttype = = TCPC_WEBSOCKETU ) ? 1 : 2 , data , length ) ;
if ( e ! = NETERR_SENT )
return e ;
}
2012-04-09 19:12:12 +00:00
break ;
2019-05-23 15:11:32 +00:00
# endif
2012-04-09 19:12:12 +00:00
default :
break ;
}
}
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
if ( st - > outlen )
{ /*try and flush the old data*/
int done ;
done = VFS_WRITE ( st - > clientstream , st - > outbuffer , st - > outlen ) ;
if ( done > 0 )
{
memmove ( st - > outbuffer , st - > outbuffer + done , st - > outlen - done ) ;
st - > outlen - = done ;
}
}
st - > timeouttime = Sys_DoubleTime ( ) + 20 ;
return NETERR_SENT ;
}
}
return NETERR_NOROUTE ;
}
2018-10-11 10:31:23 +00:00
static int FTENET_TCPConnect_GetLocalAddresses ( struct ftenet_generic_connection_s * gcon , unsigned int * adrflags , netadr_t * addresses , int maxaddresses )
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
{
ftenet_tcpconnect_connection_t * con = ( ftenet_tcpconnect_connection_t * ) gcon ;
netproto_t prot = con - > tls ? NP_TLS : NP_STREAM ;
int i , r = FTENET_Generic_GetLocalAddresses ( gcon , adrflags , addresses , maxaddresses ) ;
for ( i = 0 ; i < r ; i + + )
{
addresses [ i ] . prot = prot ;
}
return r ;
}
2018-10-11 10:31:23 +00:00
static qboolean FTENET_TCPConnect_ChangeLocalAddress ( struct ftenet_generic_connection_s * con , netadr_t * adr )
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
{
//if we're a server, we want to try switching listening tcp port without shutting down all other connections.
//yes, this might mean we leave a connection active on the old port, but oh well.
int addrsize , addrsize2 ;
int family ;
struct sockaddr_qstorage qs ;
struct sockaddr_qstorage cur ;
netadr_t n ;
SOCKET newsocket ;
unsigned long _true = true ;
2018-09-23 19:35:24 +00:00
int sysprot ;
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
addrsize = NetadrToSockadr ( adr , & qs ) ;
family = ( ( struct sockaddr * ) & qs ) - > sa_family ;
2018-09-23 19:35:24 +00:00
switch ( adr - > type )
{
# if defined(HAVE_IPV4) || defined(HAVE_IPV6)
case NA_IP :
case NA_IPV6 :
sysprot = IPPROTO_TCP ;
break ;
# endif
# ifdef HAVE_IPX
case NA_IPX :
sysprot = NSPROTO_IPX ;
break ;
# endif
default :
sysprot = 0 ;
break ;
}
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
if ( con - > thesocket ! = INVALID_SOCKET )
{
addrsize2 = sizeof ( cur ) ;
getsockname ( con - > thesocket , ( struct sockaddr * ) & cur , & addrsize2 ) ;
if ( addrsize = = addrsize2 )
{
2018-09-23 19:35:24 +00:00
SockadrToNetadr ( & cur , addrsize2 , & n ) ;
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
if ( NET_CompareAdr ( adr , & n ) ) //the address+port we're trying is already current, apparently.
return true ;
}
closesocket ( con - > thesocket ) ;
con - > thesocket = INVALID_SOCKET ;
}
2018-09-23 19:35:24 +00:00
# if defined(HAVE_IPV6) && defined(IPV6_V6ONLY)
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
if ( family = = AF_INET & & net_hybriddualstack . ival & & ! ( ( struct sockaddr_in * ) & qs ) - > sin_addr . s_addr )
{ //hybrid sockets pathway takes over when INADDR_ANY
unsigned long _false = false ;
2018-09-23 19:35:24 +00:00
if ( ( newsocket = socket ( AF_INET6 , SOCK_STREAM , sysprot ) ) ! = INVALID_SOCKET )
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
{
if ( 0 = = setsockopt ( newsocket , IPPROTO_IPV6 , IPV6_V6ONLY , ( char * ) & _false , sizeof ( _false ) ) )
{
memset ( & n , 0 , sizeof ( n ) ) ;
n . type = NA_IPV6 ;
n . port = adr - > port ;
n . scopeid = adr - > scopeid ;
addrsize2 = NetadrToSockadr ( & n , & cur ) ;
if ( ( bind ( newsocket , ( struct sockaddr * ) & cur , addrsize2 ) ! = INVALID_SOCKET ) & &
( listen ( newsocket , 2 ) ! = INVALID_SOCKET ) )
2012-04-09 19:12:12 +00:00
{
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
if ( ioctlsocket ( newsocket , FIONBIO , & _true ) ! = - 1 )
{
setsockopt ( newsocket , IPPROTO_TCP , TCP_NODELAY , ( char * ) & _true , sizeof ( _true ) ) ;
con - > addrtype [ 0 ] = NA_IP ;
con - > addrtype [ 1 ] = NA_IPV6 ;
con - > thesocket = newsocket ;
return true ;
}
2012-04-09 19:12:12 +00:00
}
}
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
closesocket ( newsocket ) ;
}
}
# endif
2008-11-09 22:29:28 +00:00
2018-09-23 19:35:24 +00:00
if ( ( newsocket = socket ( family , SOCK_STREAM , sysprot ) ) ! = INVALID_SOCKET )
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
{
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
if ( family = = AF_UNIX )
{
struct sockaddr_un * un = ( struct sockaddr_un * ) & qs ;
struct stat s ;
if ( * un - > sun_path )
{ //non-abstract sockets don't clean up the filesystem when the socket is closed
//and we can't re-bind to it while it still exists.
//so standard practise is to delete it before the bind.
//we do want to make sure the file is actually a socket before we remove it (so people can't abuse stuffcmds)
if ( stat ( un - > sun_path , & s ) ! = - 1 )
{
if ( ( s . st_mode & S_IFMT ) = = S_IFSOCK )
unlink ( un - > sun_path ) ;
}
}
}
# 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
if ( ( bind ( newsocket , ( struct sockaddr * ) & qs , addrsize ) ! = INVALID_SOCKET ) & &
( listen ( newsocket , 2 ) ! = INVALID_SOCKET ) )
{
if ( ioctlsocket ( newsocket , FIONBIO , & _true ) ! = - 1 )
{
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
if ( family ! = NA_UNIX )
# endif
setsockopt ( newsocket , IPPROTO_TCP , TCP_NODELAY , ( char * ) & _true , sizeof ( _true ) ) ;
2008-11-09 22:29:28 +00:00
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
con - > thesocket = newsocket ;
return true ;
}
2008-11-09 22:29:28 +00:00
}
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
closesocket ( newsocket ) ;
2008-11-09 22:29:28 +00:00
}
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
return false ;
2008-11-09 22:29:28 +00:00
}
2018-10-11 10:31:23 +00:00
static void FTENET_TCPConnect_Close ( ftenet_generic_connection_t * gcon )
2008-11-09 22:29:28 +00:00
{
ftenet_tcpconnect_connection_t * con = ( ftenet_tcpconnect_connection_t * ) gcon ;
ftenet_tcpconnect_stream_t * st ;
st = con - > tcpstreams ;
while ( con - > tcpstreams )
{
st = con - > tcpstreams ;
con - > tcpstreams = st - > next ;
2014-03-30 08:55:06 +00:00
if ( st - > clientstream ! = NULL )
VFS_CLOSE ( st - > clientstream ) ;
2008-11-09 22:29:28 +00:00
BZ_Free ( st ) ;
}
FTENET_Generic_Close ( gcon ) ;
}
2013-04-04 08:08:49 +00:00
# ifdef HAVE_PACKET
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 FTENET_TCPConnect_SetFDSets ( ftenet_generic_connection_t * gcon , fd_set * readfdset , fd_set * writefdset )
2012-04-09 19:12:12 +00:00
{
int maxfd = 0 ;
ftenet_tcpconnect_connection_t * con = ( ftenet_tcpconnect_connection_t * ) gcon ;
ftenet_tcpconnect_stream_t * st ;
for ( st = con - > tcpstreams ; st ; st = st - > next )
{
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
# ifdef SUPPORT_RTC_ICE
if ( st - > webrtc . ice )
{
while ( iceapi . ICE_GetLCandidateSDP ( st - > webrtc . ice , net_message_buffer , sizeof ( net_message_buffer ) ) )
{
FTENET_TCPConnect_WebSocket_Splurge ( st , 2 , net_message_buffer , strlen ( net_message_buffer ) ) ;
}
continue ;
}
# endif
2014-03-30 08:55:06 +00:00
if ( st - > clientstream = = NULL | | st - > socketnum = = INVALID_SOCKET )
2012-04-09 19:12:12 +00:00
continue ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_HTTPSV
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
if ( st - > clienttype = = TCPC_HTTPCLIENT )
FD_SET ( st - > socketnum , writefdset ) ; // network socket
# endif
FD_SET ( st - > socketnum , readfdset ) ; // network socket
2012-04-09 19:12:12 +00:00
if ( maxfd < st - > socketnum )
maxfd = st - > socketnum ;
}
if ( con - > generic . thesocket ! = INVALID_SOCKET )
{
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
FD_SET ( con - > generic . thesocket , readfdset ) ; // network socket
2012-04-09 19:12:12 +00:00
if ( maxfd < con - > generic . thesocket )
maxfd = con - > generic . thesocket ;
}
return maxfd ;
}
2013-04-04 08:08:49 +00:00
# endif
2012-04-09 19:12:12 +00:00
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
ftenet_generic_connection_t * FTENET_TCPConnect_EstablishConnection ( qboolean isserver , const char * address , netadr_t adr )
2008-11-09 22:29:28 +00:00
{
//this is written to support either ipv4 or ipv6, depending on the remote addr.
ftenet_tcpconnect_connection_t * newcon ;
unsigned long _true = true ;
2017-09-20 11:27:13 +00:00
SOCKET newsocket ;
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 tls = ( adr . prot = = NP_TLS | | adr . prot = = NP_WSS ) ;
2014-03-30 08:55:06 +00:00
# ifndef HAVE_SSL
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
if ( tls )
2014-03-30 08:55:06 +00:00
{
Con_Printf ( " tls not supported in this build \n " ) ;
return NULL ;
}
# endif
2008-11-09 22:29:28 +00:00
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
newcon = Z_Malloc ( sizeof ( * newcon ) ) ;
newcon - > generic . thesocket = INVALID_SOCKET ;
newsocket = INVALID_SOCKET ;
2008-11-09 22:29:28 +00:00
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
newcon - > generic . addrtype [ 0 ] = adr . type ;
newcon - > generic . addrtype [ 1 ] = NA_INVALID ;
2008-11-09 22:29:28 +00:00
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
if ( isserver )
{
# ifdef HAVE_PACKET //unable to listen on tcp if we have no packet interface
if ( ! FTENET_TCPConnect_ChangeLocalAddress ( & newcon - > generic , & adr ) )
2008-11-09 22:29:28 +00:00
{
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
Z_Free ( newcon ) ;
2008-11-09 22:29:28 +00:00
return NULL ;
}
2013-04-04 08:08:49 +00:00
# endif
2008-11-09 22:29:28 +00:00
}
else
{
2013-05-03 04:28:08 +00:00
newsocket = TCP_OpenStream ( & adr ) ;
2009-07-05 18:45:53 +00:00
if ( newsocket = = INVALID_SOCKET )
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
{
Z_Free ( newcon ) ;
2008-11-09 22:29:28 +00:00
return NULL ;
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
}
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
if ( adr . type ! = NA_UNIX )
# endif
{
//this isn't fatal
setsockopt ( newsocket , IPPROTO_TCP , TCP_NODELAY , ( char * ) & _true , sizeof ( _true ) ) ;
}
2008-11-09 22:29:28 +00:00
}
if ( newcon )
{
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
newcon - > tls = tls ;
2008-11-09 22:29:28 +00:00
if ( isserver )
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
{
newcon - > generic . GetLocalAddresses = FTENET_TCPConnect_GetLocalAddresses ;
newcon - > generic . ChangeLocalAddress = FTENET_TCPConnect_ChangeLocalAddress ;
}
2008-11-09 22:29:28 +00:00
newcon - > generic . GetPacket = FTENET_TCPConnect_GetPacket ;
newcon - > generic . SendPacket = FTENET_TCPConnect_SendPacket ;
newcon - > generic . Close = FTENET_TCPConnect_Close ;
2013-04-04 08:08:49 +00:00
# ifdef HAVE_PACKET
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
newcon - > generic . SetFDSets = FTENET_TCPConnect_SetFDSets ;
2013-04-04 08:08:49 +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
newcon - > generic . PrintStatus = FTENET_TCPConnect_PrintStatus ;
2008-11-09 22:29:28 +00:00
2012-01-17 07:57:46 +00:00
newcon - > generic . islisten = isserver ;
2008-11-09 22:29:28 +00:00
newcon - > active = 0 ;
if ( ! isserver )
{
newcon - > active + + ;
newcon - > tcpstreams = Z_Malloc ( sizeof ( * newcon - > tcpstreams ) ) ;
newcon - > tcpstreams - > next = NULL ;
newcon - > tcpstreams - > socketnum = newsocket ;
2014-03-30 08:55:06 +00:00
newcon - > tcpstreams - > clientstream = FS_OpenTCPSocket ( newsocket , true , address ) ;
2008-11-09 22:29:28 +00:00
newcon - > tcpstreams - > inlen = 0 ;
2009-06-10 22:36:53 +00:00
newcon - > tcpstreams - > remoteaddr = adr ;
2008-11-09 22:29:28 +00:00
2014-03-30 08:55:06 +00:00
# ifdef HAVE_SSL
if ( newcon - > tls ) //if we're meant to be using tls, wrap the stream in a tls connection
2017-05-18 10:24:09 +00:00
newcon - > tcpstreams - > clientstream = FS_OpenSSL ( address , newcon - > tcpstreams - > clientstream , false ) ;
2014-03-30 08:55:06 +00:00
# endif
2008-11-09 22:29:28 +00:00
//send the qizmo greeting.
2013-04-04 08:08:49 +00:00
newcon - > tcpstreams - > clienttype = TCPC_UNKNOWN ;
2014-03-30 08:55:06 +00:00
VFS_WRITE ( newcon - > tcpstreams - > clientstream , " qizmo \n " , 6 ) ;
2008-11-09 22:29:28 +00:00
newcon - > tcpstreams - > timeouttime = Sys_DoubleTime ( ) + 30 ;
}
else
{
newcon - > tcpstreams = NULL ;
}
return & newcon - > generic ;
}
else
{
closesocket ( newsocket ) ;
return NULL ;
}
}
# endif
# ifdef IRCCONNECT
typedef struct ftenet_ircconnect_stream_s {
char theiruser [ 16 ] ;
int inlen ;
char inbuffer [ 1500 ] ;
float timeouttime ;
netadr_t remoteaddr ;
struct ftenet_ircconnect_stream_s * next ;
} ftenet_ircconnect_stream_t ;
typedef struct {
ftenet_generic_connection_t generic ;
netadr_t ircserver ;
char incoming [ 512 + 1 ] ;
int income ;
char ourusername [ 16 ] ;
char usechannel [ 16 ] ;
char outbuf [ 8192 ] ;
unsigned int outbufcount ;
ftenet_ircconnect_stream_t * streams ;
} ftenet_ircconnect_connection_t ;
qboolean FTENET_IRCConnect_GetPacket ( ftenet_generic_connection_t * gcon )
{
unsigned char * s , * start , * end , * endl ;
int read ;
unsigned char * from ;
int fromlen ;
int code ;
char adr [ 128 ] ;
ftenet_ircconnect_connection_t * con = ( ftenet_ircconnect_connection_t * ) gcon ;
if ( con - > generic . thesocket = = INVALID_SOCKET )
{
if ( con - > income = = 0 )
{
2013-05-03 04:28:08 +00:00
netadr_t ip ;
2008-11-09 22:29:28 +00:00
cvar_t * ircuser = Cvar_Get ( " ircuser " , " none " , 0 , " IRC Connect " ) ;
2013-05-03 04:28:08 +00:00
cvar_t * ircnick = Cvar_Get ( " ircnick " , " " , 0 , " IRC Connect " ) ;
2008-11-09 22:29:28 +00:00
cvar_t * ircsomething = Cvar_Get ( " ircsomething " , " moo " , 0 , " IRC Connect " ) ;
cvar_t * ircclientaddr = Cvar_Get ( " ircclientaddr " , " 127.0.0.1 " , 0 , " IRC Connect " ) ;
2016-02-15 06:01:17 +00:00
if ( ! NET_StringToAdr ( con - > ircserver . address . irc . host , 6667 , & ip ) )
return false ;
2013-05-03 04:28:08 +00:00
con - > generic . thesocket = TCP_OpenStream ( & ip ) ;
2008-11-09 22:29:28 +00:00
2013-05-03 04:28:08 +00:00
//when hosting, the specified nick is the name we're using.
//when connecting, the specified nick is the name we're trying to send to, and our own name is inconsequential.
if ( con - > generic . islisten & & * con - > ircserver . address . irc . user )
Q_strncpyz ( con - > ourusername , con - > ircserver . address . irc . user , sizeof ( con - > ourusername ) ) ;
else
Q_strncpyz ( con - > ourusername , ircnick - > string , sizeof ( con - > ourusername ) ) ;
if ( ! * con - > ourusername )
{
Q_snprintfz ( con - > ourusername , sizeof ( con - > ourusername ) , " fte%x \n " , rand ( ) ) ;
}
2008-11-09 22:29:28 +00:00
send ( con - > generic . thesocket , " USER " , 5 , 0 ) ;
send ( con - > generic . thesocket , ircuser - > string , strlen ( ircuser - > string ) , 0 ) ;
send ( con - > generic . thesocket , " " , 1 , 0 ) ;
2013-05-03 04:28:08 +00:00
send ( con - > generic . thesocket , con - > ircserver . address . irc . host , strlen ( con - > ircserver . address . irc . host ) , 0 ) ;
2008-11-09 22:29:28 +00:00
send ( con - > generic . thesocket , " " , 1 , 0 ) ;
send ( con - > generic . thesocket , ircclientaddr - > string , strlen ( ircclientaddr - > string ) , 0 ) ;
send ( con - > generic . thesocket , " : " , 2 , 0 ) ;
send ( con - > generic . thesocket , ircsomething - > string , strlen ( ircsomething - > string ) , 0 ) ;
send ( con - > generic . thesocket , " \r \n " , 2 , 0 ) ;
send ( con - > generic . thesocket , " NICK " , 5 , 0 ) ;
send ( con - > generic . thesocket , con - > ourusername , strlen ( con - > ourusername ) , 0 ) ;
send ( con - > generic . thesocket , " \r \n " , 2 , 0 ) ;
}
}
else
{
read = recv ( con - > generic . thesocket , con - > incoming + con - > income , sizeof ( con - > incoming ) - 1 - con - > income , 0 ) ;
if ( read < 0 )
{
2014-02-07 08:38:40 +00:00
read = neterrno ( ) ;
2008-11-09 22:29:28 +00:00
switch ( read )
{
2014-02-07 08:38:40 +00:00
case NET_ECONNABORTED :
case NET_ECONNRESET :
2008-11-09 22:29:28 +00:00
closesocket ( con - > generic . thesocket ) ;
con - > generic . thesocket = INVALID_SOCKET ;
break ;
default :
break ;
}
read = 0 ; //return false;
}
else if ( read = = 0 ) //they disconnected.
{
closesocket ( con - > generic . thesocket ) ;
con - > generic . thesocket = INVALID_SOCKET ;
}
con - > income + = read ;
con - > incoming [ con - > income ] = 0 ;
}
start = con - > incoming ;
end = start + con - > income ;
while ( start < end )
{
endl = NULL ;
for ( s = start ; s < end ; s + + )
{
if ( * s = = ' \n ' )
{
endl = s ;
break ;
}
}
if ( endl = = NULL )
//not got a complete command.
break ;
s = start ;
while ( * s = = ' ' )
s + + ;
if ( * s = = ' : ' )
{
s + + ;
from = s ;
while ( s < endl & & * s ! = ' ' & & * s ! = ' \n ' )
{
s + + ;
}
fromlen = s - from ;
}
else
{
from = NULL ;
fromlen = 0 ;
}
while ( * s = = ' ' )
s + + ;
if ( ! strncmp ( s , " PRIVMSG " , 8 ) )
{
2008-11-13 05:39:50 +00:00
unsigned char * dest ;
2008-11-09 22:29:28 +00:00
s + = 8 ;
while ( * s = = ' ' )
s + + ;
//cap the length
if ( fromlen > sizeof ( net_from . address . irc . user ) - 1 )
fromlen = sizeof ( net_from . address . irc . user ) - 1 ;
for ( code = 0 ; code < fromlen ; code + + )
if ( from [ code ] = = ' ! ' )
{
fromlen = code ;
break ;
}
net_from . type = NA_IRC ;
memcpy ( net_from . address . irc . user , from , fromlen ) ;
net_from . address . irc . user [ fromlen ] = 0 ;
dest = s ;
//discard the destination name
while ( s < endl & & * s ! = ' ' & & * s ! = ' \n ' )
{
s + + ;
}
if ( s - dest > = sizeof ( net_from . address . irc . channel ) )
{ //no space, just pretend it was direct.
net_from . address . irc . channel [ 0 ] = 0 ;
2005-11-30 01:20:53 +00:00
}
2008-11-09 22:29:28 +00:00
else
{
memcpy ( net_from . address . irc . channel , dest , s - dest ) ;
net_from . address . irc . channel [ s - dest ] = 0 ;
if ( ! strcmp ( net_from . address . irc . channel , con - > ourusername ) )
{ //this was aimed at us. clear the channel.
net_from . address . irc . channel [ 0 ] = 0 ;
}
}
2011-05-15 13:23:13 +00:00
2008-11-09 22:29:28 +00:00
while ( * s = = ' ' )
s + + ;
if ( * s = = ' : ' )
{
s + + ;
if ( * s = = ' ! ' )
{
s + + ;
/*interpret as a connectionless packet*/
net_message . cursize = 4 + endl - s ;
if ( net_message . cursize > = sizeof ( net_message_buffer ) )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Warning: Oversize packet from %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) ) ;
2008-11-09 22:29:28 +00:00
break ;
}
* ( unsigned int * ) net_message_buffer = ~ 0 ;
memcpy ( net_message_buffer + 4 , s , net_message . cursize ) ;
net_message . packing = SZ_RAWBYTES ;
net_message . currentbit = 0 ;
//clean up the incoming data
memmove ( con - > incoming , start , end - ( endl + 1 ) ) ;
con - > income = end - ( endl + 1 ) ;
con - > incoming [ con - > income ] = 0 ;
return true ;
}
if ( * s = = ' $ ' )
{
2008-11-14 16:49:26 +00:00
unsigned char * nstart = s ;
2008-11-09 22:29:28 +00:00
while ( * s ! = ' \r ' & & * s ! = ' \n ' & & * s ! = ' # ' & & * s ! = ' ' & & * s ! = ' : ' )
s + + ;
if ( * s = = ' # ' )
{
if ( strncmp ( nstart , con - > ourusername , strlen ( con - > ourusername ) ) | | strlen ( con - > ourusername ) ! = s - nstart )
while ( * s = = ' # ' )
s + + ;
}
}
if ( * s = = ' # ' )
{
ftenet_ircconnect_stream_t * st ;
int psize ;
for ( st = con - > streams ; st ; st = st - > next )
{
if ( ! strncmp ( st - > remoteaddr . address . irc . user , from , fromlen ) & & st - > remoteaddr . address . irc . user [ fromlen ] = = 0 )
break ;
}
if ( ! st )
{
st = Z_Malloc ( sizeof ( * st ) ) ;
st - > remoteaddr = net_from ;
st - > next = con - > streams ;
con - > streams = st ;
}
//skip over the hash
s + + ;
psize = 0 ;
if ( * s > = ' a ' & & * s < = ' f ' )
psize + = * s - ' a ' + 10 ;
else if ( * s > = ' 0 ' & & * s < = ' 9 ' )
psize + = * s - ' 0 ' ;
s + + ;
2011-05-15 13:23:13 +00:00
2008-11-09 22:29:28 +00:00
psize * = 16 ;
if ( * s > = ' a ' & & * s < = ' f ' )
psize + = * s - ' a ' + 10 ;
else if ( * s > = ' 0 ' & & * s < = ' 9 ' )
psize + = * s - ' 0 ' ;
s + + ;
psize * = 16 ;
if ( * s > = ' a ' & & * s < = ' f ' )
psize + = * s - ' a ' + 10 ;
else if ( * s > = ' 0 ' & & * s < = ' 9 ' )
psize + = * s - ' 0 ' ;
s + + ;
while ( s < endl & & st - > inlen < sizeof ( st - > inbuffer ) )
{
switch ( * s )
{
//handle markup
case ' \\ ' :
s + + ;
if ( s < endl )
{
switch ( * s )
{
case ' \\ ' :
st - > inbuffer [ st - > inlen + + ] = * s ;
break ;
case ' n ' :
st - > inbuffer [ st - > inlen + + ] = ' \n ' ;
break ;
case ' r ' :
st - > inbuffer [ st - > inlen + + ] = ' \r ' ;
break ;
case ' 0 ' :
st - > inbuffer [ st - > inlen + + ] = 0 ;
break ;
default :
st - > inbuffer [ st - > inlen + + ] = ' ? ' ;
break ;
}
}
break ;
//ignore these
2011-05-15 13:23:13 +00:00
case ' \n ' :
2008-11-09 22:29:28 +00:00
case ' \r ' :
case ' \0 ' : //this one doesn't have to be ignored.
break ;
//handle normal char
default :
st - > inbuffer [ st - > inlen + + ] = * s ;
break ;
}
s + + ;
}
2011-05-15 13:23:13 +00:00
2008-11-09 22:29:28 +00:00
if ( st - > inlen > psize | | psize > = sizeof ( net_message_buffer ) )
{
st - > inlen = 0 ;
2013-05-03 04:28:08 +00:00
Con_Printf ( " Corrupt packet from %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) ) ;
2008-11-09 22:29:28 +00:00
}
else if ( st - > inlen = = psize )
{
/*interpret as a connectionless packet*/
net_message . cursize = st - > inlen ;
if ( net_message . cursize > = sizeof ( net_message_buffer ) )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Warning: Oversize packet from %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) ) ;
2008-11-09 22:29:28 +00:00
break ;
}
memcpy ( net_message_buffer , st - > inbuffer , net_message . cursize ) ;
net_message . packing = SZ_RAWBYTES ;
net_message . currentbit = 0 ;
st - > inlen = 0 ;
//clean up the incoming data
memmove ( con - > incoming , start , end - ( endl + 1 ) ) ;
con - > income = end - ( endl + 1 ) ;
con - > incoming [ con - > income ] = 0 ;
return true ;
}
}
}
}
else if ( ! strncmp ( s , " PING " , 5 ) )
{
send ( con - > generic . thesocket , " PONG " , 5 , 0 ) ;
send ( con - > generic . thesocket , s + 5 , endl - s - 5 , 0 ) ;
send ( con - > generic . thesocket , " \r \n " , 2 , 0 ) ;
}
else
{
2011-05-19 13:55:05 +00:00
code = strtoul ( s , ( char * * ) & s , 10 ) ;
2008-11-09 22:29:28 +00:00
switch ( code )
{
2013-11-29 14:36:47 +00:00
case 1 :
2008-11-09 22:29:28 +00:00
{
2013-05-03 04:28:08 +00:00
if ( con - > ircserver . address . irc . channel )
2008-11-09 22:29:28 +00:00
{
send ( con - > generic . thesocket , " JOIN " , 5 , 0 ) ;
2013-05-03 04:28:08 +00:00
send ( con - > generic . thesocket , con - > ircserver . address . irc . channel , strlen ( con - > ircserver . address . irc . channel ) , 0 ) ;
2008-11-09 22:29:28 +00:00
send ( con - > generic . thesocket , " \r \n " , 2 , 0 ) ;
}
}
break ;
case 433 :
//nick already in use
send ( con - > generic . thesocket , " NICK " , 5 , 0 ) ;
{
cvar_t * ircnick2 = Cvar_Get ( " ircnick2 " , " YIBBLE " , 0 , " IRC Connect " ) ;
Q_strncpyz ( con - > ourusername , ircnick2 - > string , sizeof ( con - > ourusername ) ) ;
send ( con - > generic . thesocket , con - > ourusername , strlen ( con - > ourusername ) , 0 ) ;
}
send ( con - > generic . thesocket , " \r \n " , 2 , 0 ) ;
break ;
2011-05-15 13:23:13 +00:00
case 0 :
2008-11-09 22:29:28 +00:00
//non-numerical event.
break ;
}
}
while ( * s = = ' ' )
s + + ;
start = s = endl + 1 ;
}
memmove ( con - > incoming , start , end - start ) ;
con - > income = end - start ;
con - > incoming [ con - > income ] = 0 ;
if ( con - > generic . thesocket = = INVALID_SOCKET )
con - > income = 0 ;
return false ;
}
2016-07-12 00:40:13 +00:00
neterr_t FTENET_IRCConnect_SendPacket ( ftenet_generic_connection_t * gcon , int length , const void * data , netadr_t * to )
2008-11-09 22:29:28 +00:00
{
ftenet_ircconnect_connection_t * con = ( ftenet_ircconnect_connection_t * ) gcon ;
unsigned char * buffer ;
unsigned char * lenofs ;
int packed ;
int fulllen = length ;
int newoutcount ;
for ( packed = 0 ; packed < FTENET_ADDRTYPES ; packed + + )
2013-05-03 04:28:08 +00:00
if ( to - > type = = con - > generic . addrtype [ packed ] )
2008-11-09 22:29:28 +00:00
break ;
if ( packed = = FTENET_ADDRTYPES )
2016-07-12 00:40:13 +00:00
return NETERR_NOROUTE ;
2008-11-09 22:29:28 +00:00
packed = 0 ;
if ( con - > generic . thesocket = = INVALID_SOCKET )
2016-07-12 00:40:13 +00:00
return NETERR_DISCONNECTED ;
2008-11-09 22:29:28 +00:00
/*
if ( * ( unsigned int * ) data = = ~ 0 & & ! strchr ( data , ' \n ' ) & & ! strchr ( data , ' \r ' ) & & strlen ( data ) = = length )
{
if ( send ( con - > generic . thesocket , va ( " PRIVMSG %s :! " , to . address . irc . user ) , 15 , 0 ) ! = 15 )
Con_Printf ( " bad send \n " ) ;
else if ( send ( con - > generic . thesocket , ( char * ) data + 4 , length - 4 , 0 ) ! = length - 4 )
Con_Printf ( " bad send \n " ) ;
else if ( send ( con - > generic . thesocket , " \r \n " , 2 , 0 ) ! = 2 )
Con_Printf ( " bad send \n " ) ;
return true ;
}
*/
newoutcount = con - > outbufcount ;
if ( ! con - > outbufcount )
while ( length )
{
buffer = con - > outbuf + newoutcount ;
2013-05-03 04:28:08 +00:00
if ( * to - > address . irc . channel )
2008-11-09 22:29:28 +00:00
{
int unamelen ;
int chanlen ;
2013-05-03 04:28:08 +00:00
unamelen = strlen ( to - > address . irc . user ) ;
chanlen = strlen ( to - > address . irc . channel ) ;
2008-11-09 22:29:28 +00:00
packed = 8 + chanlen + 3 + unamelen + 1 + 3 ;
if ( packed + 1 + newoutcount > sizeof ( con - > outbuf ) )
break ;
memcpy ( buffer , " PRIVMSG " , 8 ) ;
2013-05-03 04:28:08 +00:00
memcpy ( buffer + 8 , to - > address . irc . channel , chanlen ) ;
2008-11-09 22:29:28 +00:00
memcpy ( buffer + 8 + chanlen , " :$ " , 3 ) ;
2013-05-03 04:28:08 +00:00
memcpy ( buffer + 8 + chanlen + 3 , to - > address . irc . user , unamelen ) ;
2008-11-09 22:29:28 +00:00
memcpy ( buffer + 8 + chanlen + 3 + unamelen , " # " , 1 ) ;
lenofs = buffer + 8 + chanlen + 3 + unamelen + 1 ;
sprintf ( lenofs , " %03x " , fulllen ) ;
}
else
{
int unamelen ;
2013-05-03 04:28:08 +00:00
unamelen = strlen ( to - > address . irc . user ) ;
2008-11-09 22:29:28 +00:00
packed = 8 + unamelen + 3 + 3 ;
if ( packed + 1 + newoutcount > sizeof ( con - > outbuf ) )
break ;
memcpy ( buffer , " PRIVMSG " , 8 ) ;
2013-05-03 04:28:08 +00:00
memcpy ( buffer + 8 , to - > address . irc . user , unamelen ) ;
2008-11-09 22:29:28 +00:00
memcpy ( buffer + 8 + unamelen , " :# " , 3 ) ;
lenofs = buffer + 8 + unamelen + 3 ;
sprintf ( lenofs , " %03x " , fulllen ) ;
}
while ( length & & packed < 400 & & packed + newoutcount < sizeof ( con - > outbuf ) - 2 ) //make sure there's always space
{
switch ( * ( unsigned char * ) data )
{
case ' \\ ' :
buffer [ packed + + ] = ' \\ ' ;
buffer [ packed + + ] = ' \\ ' ;
break ;
case ' \n ' :
buffer [ packed + + ] = ' \\ ' ;
buffer [ packed + + ] = ' n ' ;
break ;
case ' \r ' :
buffer [ packed + + ] = ' \\ ' ;
buffer [ packed + + ] = ' r ' ;
break ;
case ' \0 ' :
buffer [ packed + + ] = ' \\ ' ;
buffer [ packed + + ] = ' 0 ' ;
break ;
default :
buffer [ packed + + ] = * ( unsigned char * ) data ;
break ;
}
length - - ;
data = ( char * ) data + 1 ;
}
buffer [ packed + + ] = ' \r ' ;
buffer [ packed + + ] = ' \n ' ;
newoutcount + = packed ;
packed = 0 ;
}
if ( ! length )
{
//only if we flushed all
con - > outbufcount = newoutcount ;
}
//try and flush it
length = send ( con - > generic . thesocket , con - > outbuf , con - > outbufcount , 0 ) ;
if ( length > 0 )
{
memmove ( con - > outbuf , con - > outbuf + length , con - > outbufcount - length ) ;
con - > outbufcount - = length ;
}
2016-07-12 00:40:13 +00:00
return NETERR_SENT ;
2008-11-09 22:29:28 +00:00
}
void FTENET_IRCConnect_Close ( ftenet_generic_connection_t * gcon )
{
ftenet_ircconnect_connection_t * con = ( ftenet_ircconnect_connection_t * ) gcon ;
ftenet_ircconnect_stream_t * st ;
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
while ( con - > streams )
{
st = con - > streams ;
con - > streams = st - > next ;
Z_Free ( st ) ;
}
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
FTENET_Generic_Close ( gcon ) ;
}
2005-11-30 01:20:53 +00:00
2015-12-12 19:25:15 +00:00
struct ftenet_generic_connection_s * FTENET_IRCConnect_EstablishConnection ( qboolean isserver , const char * address , netadr_t adr )
2008-11-09 22:29:28 +00:00
{
//this is written to support either ipv4 or ipv6, depending on the remote addr.
ftenet_ircconnect_connection_t * newcon ;
2005-11-30 01:20:53 +00:00
2013-03-12 22:53:23 +00:00
if ( ! NET_StringToAdr ( address , 6667 , & adr ) )
2008-11-09 22:29:28 +00:00
return NULL ; //couldn't resolve the name
2005-11-30 01:20:53 +00:00
2011-05-15 13:23:13 +00:00
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
newcon = Z_Malloc ( sizeof ( * newcon ) ) ;
if ( newcon )
{
newcon - > generic . GetPacket = FTENET_IRCConnect_GetPacket ;
newcon - > generic . SendPacket = FTENET_IRCConnect_SendPacket ;
newcon - > generic . Close = FTENET_IRCConnect_Close ;
2005-11-30 01:20:53 +00:00
2009-07-05 18:45:53 +00:00
newcon - > generic . islisten = isserver ;
2008-11-09 22:29:28 +00:00
newcon - > generic . addrtype [ 0 ] = NA_IRC ;
newcon - > generic . addrtype [ 1 ] = NA_INVALID ;
2007-09-04 20:54:24 +00:00
2008-11-09 22:29:28 +00:00
newcon - > generic . thesocket = INVALID_SOCKET ;
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
newcon - > ircserver = adr ;
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
return & newcon - > generic ;
}
else
{
return NULL ;
}
2004-08-21 01:25:48 +00:00
}
2008-11-09 22:29:28 +00:00
# endif
2004-08-21 01:25:48 +00:00
2013-07-31 00:20:16 +00:00
# ifdef FTE_TARGET_WEB
2013-08-07 14:20:24 +00:00
# include "web/ftejslib.h"
2013-07-31 00:20:16 +00:00
typedef struct
{
2016-07-12 00:40:13 +00:00
ftenet_generic_connection_t generic ;
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 brokersock ; //only if rtc
2016-07-12 00:40:13 +00:00
netadr_t remoteadr ;
qboolean failed ;
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 datasock ; //only if we're a client
size_t numclients ;
2018-06-18 16:44:29 +00:00
struct
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
{
netadr_t remoteadr ;
int datasock ;
} * clients ;
2013-07-31 00:20:16 +00:00
} ftenet_websocket_connection_t ;
static void FTENET_WebSocket_Close ( ftenet_generic_connection_t * gcon )
{
2016-07-12 00:40:13 +00:00
ftenet_websocket_connection_t * wsc = ( void * ) gcon ;
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
size_t i ;
if ( wsc - > brokersock ! = INVALID_SOCKET )
emscriptenfte_ws_close ( wsc - > brokersock ) ;
if ( wsc - > datasock ! = INVALID_SOCKET )
emscriptenfte_ws_close ( wsc - > datasock ) ;
for ( i = 0 ; i < wsc - > numclients ; i + + )
{
if ( wsc - > clients [ i ] . datasock ! = INVALID_SOCKET )
emscriptenfte_ws_close ( wsc - > clients [ i ] . datasock ) ;
}
free ( wsc - > clients ) ;
2013-07-31 00:20:16 +00:00
}
static qboolean FTENET_WebSocket_GetPacket ( ftenet_generic_connection_t * gcon )
{
2016-07-12 00:40:13 +00:00
ftenet_websocket_connection_t * wsc = ( void * ) gcon ;
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
net_message . cursize = emscriptenfte_ws_recv ( wsc - > datasock , net_message_buffer , sizeof ( net_message_buffer ) ) ;
2013-07-31 00:20:16 +00:00
if ( net_message . cursize > 0 )
{
net_from = wsc - > remoteadr ;
return true ;
}
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
if ( ( int ) net_message . cursize < 0 )
wsc - > failed = true ;
2013-07-31 00:20:16 +00:00
net_message . cursize = 0 ; //just incase
return false ;
}
2016-07-12 00:40:13 +00:00
static neterr_t FTENET_WebSocket_SendPacket ( ftenet_generic_connection_t * gcon , int length , const void * data , netadr_t * to )
2013-07-31 00:20:16 +00:00
{
2016-07-12 00:40:13 +00:00
ftenet_websocket_connection_t * wsc = ( void * ) gcon ;
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
if ( wsc - > failed )
return NETERR_DISCONNECTED ;
2013-07-31 00:20:16 +00:00
if ( NET_CompareAdr ( to , & wsc - > remoteadr ) )
{
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
if ( emscriptenfte_ws_send ( wsc - > datasock , data , length ) < 0 )
2016-07-12 00:40:13 +00:00
return NETERR_CLOGGED ;
return NETERR_SENT ;
2013-07-31 00:20:16 +00:00
}
2016-07-12 00:40:13 +00:00
return NETERR_NOROUTE ;
2013-07-31 00:20:16 +00:00
}
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
//called from the javascript when there was some ice event. just forwards over the broker connection.
static void FTENET_WebRTC_Callback ( void * ctxp , int ctxi , int evtype , const char * data )
{
ftenet_websocket_connection_t * wcs = ctxp ;
size_t dl = strlen ( data ) ;
qbyte * o = net_message_buffer ;
* o + + = evtype ;
* o + + = ( ctxi > > 0 ) & 0xff ;
* o + + = ( ctxi > > 8 ) & 0xff ;
memcpy ( o , data , dl ) ;
o + = dl ;
// Con_Printf("To Broker: %i %i\n", evtype, ctxi);
emscriptenfte_ws_send ( wcs - > brokersock , net_message_buffer , o - net_message_buffer ) ;
}
static qboolean FTENET_WebRTC_GetPacket ( ftenet_generic_connection_t * gcon )
{
ftenet_websocket_connection_t * wsc = ( void * ) gcon ;
size_t i ;
if ( ! wsc - > generic . islisten )
{
if ( wsc - > datasock ! = INVALID_SOCKET & & FTENET_WebSocket_GetPacket ( gcon ) )
return true ;
}
else
{
for ( i = 0 ; i < wsc - > numclients ; i + + )
{
net_message . cursize = emscriptenfte_ws_recv ( wsc - > clients [ i ] . datasock , net_message_buffer , sizeof ( net_message_buffer ) ) ;
if ( net_message . cursize > 0 )
{
net_from = wsc - > clients [ i ] . remoteadr ;
return true ;
}
}
}
net_message . cursize = emscriptenfte_ws_recv ( wsc - > brokersock , net_message_buffer , sizeof ( net_message_buffer ) ) ;
if ( net_message . cursize > 0 )
{
int cmd ;
short cl ;
const char * s ;
char * p ;
MSG_BeginReading ( msg_nullnetprim ) ;
cmd = MSG_ReadByte ( ) ;
cl = MSG_ReadShort ( ) ;
//Con_Printf("From Broker: %i %i\n", cmd, cl);
switch ( cmd )
{
case 0 : //connection closing...
if ( cl = = - 1 )
{
wsc - > failed = true ;
Con_Printf ( " Broker closing connection: %s \n " , MSG_ReadString ( ) ) ;
}
else if ( cl > = 0 & & cl < wsc - > numclients )
{
wsc - > clients [ cl ] . remoteadr . type = NA_INVALID ;
if ( wsc - > clients [ cl ] . datasock ! = INVALID_SOCKET )
emscriptenfte_ws_close ( wsc - > clients [ cl ] . datasock ) ;
wsc - > clients [ cl ] . datasock = INVALID_SOCKET ;
Con_Printf ( " Broker closing connection: %s \n " , MSG_ReadString ( ) ) ;
}
break ;
case 1 : //reports the trailing url we're 'listening' on. anyone else using that url will connect to us.
s = MSG_ReadString ( ) ;
if ( * s = = ' / ' )
s + + ;
p = wsc - > remoteadr . address . websocketurl ;
while ( * p )
{
if ( p [ 0 ] = = ' : ' & & p [ 1 ] = = ' / ' & & p [ 2 ] = = ' / ' )
p + = 3 ;
else if ( p [ 0 ] = = ' / ' )
{
* p = 0 ;
break ;
}
else
p + + ;
}
Q_strncatz ( wsc - > remoteadr . address . websocketurl , " / " , sizeof ( wsc - > remoteadr . address . websocketurl ) ) ;
Q_strncatz ( wsc - > remoteadr . address . websocketurl , s , sizeof ( wsc - > remoteadr . address . websocketurl ) ) ;
Con_Printf ( " Listening on %s \n " , wsc - > remoteadr . address . websocketurl ) ;
break ;
case 2 : //connection established with a new peer
if ( wsc - > generic . islisten )
{
if ( cl < 1024 & & cl > = wsc - > numclients )
{ //looks like a new one... but don't waste memory
size_t nm ;
nm = cl + 1 ;
wsc - > clients = realloc ( wsc - > clients , sizeof ( * wsc - > clients ) * nm ) ;
while ( wsc - > numclients < nm )
{
memset ( & wsc - > clients [ i ] . remoteadr , 0 , sizeof ( wsc - > clients [ i ] . remoteadr ) ) ;
wsc - > clients [ wsc - > numclients + + ] . datasock = INVALID_SOCKET ;
}
}
if ( cl < wsc - > numclients )
{
if ( wsc - > clients [ cl ] . datasock ! = INVALID_SOCKET )
emscriptenfte_ws_close ( wsc - > clients [ cl ] . datasock ) ;
memcpy ( & wsc - > clients [ cl ] . remoteadr , & wsc - > remoteadr , sizeof ( netadr_t ) ) ;
wsc - > clients [ cl ] . remoteadr . port = htons ( cl + 1 ) ;
wsc - > clients [ cl ] . datasock = emscriptenfte_rtc_create ( false , wsc , cl , FTENET_WebRTC_Callback ) ;
}
}
else
{
if ( wsc - > datasock ! = INVALID_SOCKET )
emscriptenfte_ws_close ( wsc - > datasock ) ;
wsc - > datasock = emscriptenfte_rtc_create ( true , wsc , cl , FTENET_WebRTC_Callback ) ;
}
break ;
case 3 : //we received an offer from a client
s = MSG_ReadString ( ) ;
if ( wsc - > generic . islisten )
{
if ( cl < wsc - > numclients & & wsc - > clients [ cl ] . datasock ! = INVALID_SOCKET )
emscriptenfte_rtc_offer ( wsc - > clients [ cl ] . datasock , s , " offer " ) ;
}
else
{
if ( wsc - > datasock ! = INVALID_SOCKET )
emscriptenfte_rtc_offer ( wsc - > datasock , s , " answer " ) ;
}
break ;
case 4 :
s = MSG_ReadString ( ) ;
if ( wsc - > generic . islisten )
{
if ( cl < wsc - > numclients & & wsc - > clients [ cl ] . datasock ! = INVALID_SOCKET )
emscriptenfte_rtc_candidate ( wsc - > clients [ cl ] . datasock , s ) ;
}
else
{
if ( wsc - > datasock ! = INVALID_SOCKET )
emscriptenfte_rtc_candidate ( wsc - > datasock , s ) ;
}
break ;
}
}
net_message . cursize = 0 ; //just incase
return false ;
}
static neterr_t FTENET_WebRTC_SendPacket ( ftenet_generic_connection_t * gcon , int length , const void * data , netadr_t * to )
{
ftenet_websocket_connection_t * wsc = ( void * ) gcon ;
size_t i ;
if ( ! wsc - > generic . islisten )
{
// if (wsc->failed)
// return NETERR_DISCONNECTED;
if ( NET_CompareAdr ( to , & wsc - > remoteadr ) )
{
if ( wsc - > datasock = = INVALID_SOCKET )
return NETERR_CLOGGED ; //we're still waiting for the broker to give us a server... or for a server to become available.
else
{
if ( emscriptenfte_ws_send ( wsc - > datasock , data , length ) < = 0 )
return NETERR_CLOGGED ;
return NETERR_SENT ;
}
}
}
else
{
for ( i = 0 ; i < wsc - > numclients ; i + + )
{
if ( NET_CompareAdr ( to , & wsc - > clients [ i ] . remoteadr ) )
{
if ( emscriptenfte_ws_send ( wsc - > clients [ i ] . datasock , data , length ) < = 0 )
return NETERR_CLOGGED ;
return NETERR_SENT ;
}
}
}
return NETERR_NOROUTE ;
}
int FTENET_WebRTC_GetAddresses ( struct ftenet_generic_connection_s * con , unsigned int * adrflags , netadr_t * addresses , int maxaddresses )
{
ftenet_websocket_connection_t * wsc = ( void * ) con ;
if ( maxaddresses )
{
* addresses = wsc - > remoteadr ;
* adrflags = 0 ;
return 1 ;
}
return 0 ;
}
2013-07-31 00:20:16 +00:00
2016-07-12 00:40:13 +00:00
static ftenet_generic_connection_t * FTENET_WebSocket_EstablishConnection ( qboolean isserver , const char * address , netadr_t adr )
2013-07-31 00:20:16 +00:00
{
2016-07-12 00:40:13 +00:00
ftenet_websocket_connection_t * newcon ;
2013-07-31 00:20:16 +00:00
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 brokersocket = INVALID_SOCKET ;
int datasocket = INVALID_SOCKET ;
2013-07-31 00:20:16 +00:00
2016-07-12 00:40:13 +00:00
newcon = Z_Malloc ( sizeof ( * newcon ) ) ;
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
if ( adr . prot = = NP_DTLS )
{ //this requires that we create a broker connection
if ( isserver )
brokersocket = emscriptenfte_ws_connect ( adr . address . websocketurl , " rtc_host " ) ;
else
brokersocket = emscriptenfte_ws_connect ( adr . address . websocketurl , " rtc_client " ) ;
newcon - > generic . GetPacket = FTENET_WebRTC_GetPacket ;
newcon - > generic . SendPacket = FTENET_WebRTC_SendPacket ;
newcon - > generic . GetLocalAddresses = FTENET_WebRTC_GetAddresses ;
}
else
2016-07-12 00:40:13 +00:00
{
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
if ( ! isserver )
datasocket = emscriptenfte_ws_connect ( adr . address . websocketurl , " fteqw " ) ;
2016-07-12 00:40:13 +00:00
newcon - > generic . GetPacket = FTENET_WebSocket_GetPacket ;
newcon - > generic . SendPacket = FTENET_WebSocket_SendPacket ;
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
}
if ( brokersocket = = INVALID_SOCKET & & datasocket = = INVALID_SOCKET )
{
Con_Printf ( " Unable to create rtc/ws connection \n " ) ;
Z_Free ( newcon ) ;
}
else
{
Q_strncpyz ( newcon - > generic . name , " WebSocket " , sizeof ( newcon - > generic . name ) ) ;
2016-07-12 00:40:13 +00:00
newcon - > generic . Close = FTENET_WebSocket_Close ;
newcon - > generic . islisten = isserver ;
newcon - > generic . addrtype [ 0 ] = NA_WEBSOCKET ;
newcon - > generic . addrtype [ 1 ] = NA_INVALID ;
newcon - > generic . thesocket = INVALID_SOCKET ;
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
newcon - > brokersock = brokersocket ;
newcon - > datasock = datasocket ;
2016-07-12 00:40:13 +00:00
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
adr . port = 0 ;
2016-07-12 00:40:13 +00:00
newcon - > remoteadr = adr ;
return & newcon - > generic ;
}
return NULL ;
2013-07-31 00:20:16 +00:00
}
# endif
# ifdef NACL
2012-04-09 19:12:12 +00:00
# include <ppapi/c/pp_errors.h>
# include <ppapi/c/pp_resource.h>
# include <ppapi/c/ppb_core.h>
# include <ppapi/c/ppb_websocket.h>
# include <ppapi/c/ppb_var.h>
2013-11-24 16:35:52 +00:00
# include <ppapi/c/ppb_var_array_buffer.h>
2012-04-09 19:12:12 +00:00
# include <ppapi/c/ppb_instance.h>
extern PPB_Core * ppb_core ;
extern PPB_WebSocket * ppb_websocket_interface ;
extern PPB_Var * ppb_var_interface ;
2013-11-24 16:35:52 +00:00
extern PPB_VarArrayBuffer * ppb_vararraybuffer_interface ;
2012-04-09 19:12:12 +00:00
extern PP_Instance pp_instance ;
typedef struct
{
ftenet_generic_connection_t generic ;
PP_Resource sock ;
netadr_t remoteadr ;
struct PP_Var incomingpacket ;
2013-07-31 00:20:16 +00:00
qboolean havepacket ;
2012-04-09 19:12:12 +00:00
qboolean failed ;
2013-12-08 20:06:55 +00:00
int showerror ;
2012-04-09 19:12:12 +00:00
} ftenet_websocket_connection_t ;
static void websocketgot ( void * user_data , int32_t result )
{
ftenet_websocket_connection_t * wsc = user_data ;
if ( result = = PP_OK )
{
wsc - > havepacket = true ;
}
else
{
Sys_Printf ( " %s: %i \n " , __func__ , result ) ;
wsc - > failed = true ;
2013-12-08 20:06:55 +00:00
wsc - > showerror = result ;
2012-04-09 19:12:12 +00:00
}
}
static void websocketconnected ( void * user_data , int32_t result )
{
ftenet_websocket_connection_t * wsc = user_data ;
if ( result = = PP_OK )
{
int res ;
//we got a successful connection, enable reception.
struct PP_CompletionCallback ccb = { websocketgot , wsc , PP_COMPLETIONCALLBACK_FLAG_OPTIONAL } ;
res = ppb_websocket_interface - > ReceiveMessage ( wsc - > sock , & wsc - > incomingpacket , ccb ) ;
if ( res ! = PP_OK_COMPLETIONPENDING )
websocketgot ( wsc , res ) ;
}
else
{
Sys_Printf ( " %s: %i \n " , __func__ , result ) ;
//some sort of error connecting, make it timeout now
wsc - > failed = true ;
2013-12-08 20:06:55 +00:00
wsc - > showerror = result ;
2012-04-09 19:12:12 +00:00
}
}
static void websocketclosed ( void * user_data , int32_t result )
{
ftenet_websocket_connection_t * wsc = user_data ;
if ( wsc - > havepacket )
{
wsc - > havepacket = false ;
ppb_var_interface - > Release ( wsc - > incomingpacket ) ;
}
ppb_core - > ReleaseResource ( wsc - > sock ) ;
// Z_Free(wsc);
}
2013-07-31 00:20:16 +00:00
static void FTENET_NaClWebSocket_Close ( ftenet_generic_connection_t * gcon )
2012-04-09 19:12:12 +00:00
{
int res ;
/*meant to free the memory too, in this case we get the callback to do it*/
ftenet_websocket_connection_t * wsc = ( void * ) gcon ;
struct PP_CompletionCallback ccb = { websocketclosed , wsc , PP_COMPLETIONCALLBACK_FLAG_NONE } ;
ppb_websocket_interface - > Close ( wsc - > sock , PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE , PP_MakeUndefined ( ) , ccb ) ;
}
2013-07-31 00:20:16 +00:00
static qboolean FTENET_NaClWebSocket_GetPacket ( ftenet_generic_connection_t * gcon )
2012-04-09 19:12:12 +00:00
{
ftenet_websocket_connection_t * wsc = ( void * ) gcon ;
int res ;
int len = 0 ;
if ( wsc - > havepacket )
{
2013-11-24 16:35:52 +00:00
if ( wsc - > incomingpacket . type = = PP_VARTYPE_ARRAY_BUFFER )
2012-04-09 19:12:12 +00:00
{
2013-11-24 16:35:52 +00:00
uint32_t length ;
void * buf = ppb_vararraybuffer_interface - > Map ( wsc - > incomingpacket ) ;
if ( buf & & ppb_vararraybuffer_interface - > ByteLength ( wsc - > incomingpacket , & length ) )
2012-04-09 19:12:12 +00:00
{
2013-11-24 16:35:52 +00:00
net_message . cursize = length ;
memcpy ( net_message_buffer , buf , length ) ;
ppb_vararraybuffer_interface - > Unmap ( wsc - > incomingpacket ) ;
2012-04-09 19:12:12 +00:00
}
else
2013-11-24 16:35:52 +00:00
net_message . cursize = 0 ;
}
else
{
unsigned char * utf8 = ( unsigned char * ) ppb_var_interface - > VarToUtf8 ( wsc - > incomingpacket , & len ) ;
unsigned char * out = ( unsigned char * ) net_message_buffer ;
while ( len & & out < net_message_buffer + sizeof ( net_message_buffer ) )
2012-04-09 19:12:12 +00:00
{
2013-11-24 16:35:52 +00:00
if ( ( * utf8 & 0xe0 ) = = 0xc0 & & len > 1 )
{
* out = ( ( utf8 [ 0 ] & 0x1f ) < < 6 ) | ( ( utf8 [ 1 ] & 0x3f ) < < 0 ) ;
utf8 + = 2 ;
len - = 2 ;
}
else if ( * utf8 & 0x80 )
{
* out = ' ? ' ;
utf8 + + ;
len - = 1 ;
}
else
{
* out = utf8 [ 0 ] ;
utf8 + + ;
len - = 1 ;
}
out + + ;
2012-04-09 19:12:12 +00:00
}
2013-11-24 16:35:52 +00:00
net_message . cursize = out - net_message_buffer ;
2012-04-09 19:12:12 +00:00
}
2013-11-24 16:35:52 +00:00
memcpy ( & net_from , & wsc - > remoteadr , sizeof ( net_from ) ) ;
wsc - > havepacket = false ;
2012-04-09 19:12:12 +00:00
ppb_var_interface - > Release ( wsc - > incomingpacket ) ;
if ( ! wsc - > failed )
{
//get the next one
struct PP_CompletionCallback ccb = { websocketgot , wsc , PP_COMPLETIONCALLBACK_FLAG_OPTIONAL } ;
res = ppb_websocket_interface - > ReceiveMessage ( wsc - > sock , & wsc - > incomingpacket , ccb ) ;
if ( res ! = PP_OK_COMPLETIONPENDING )
websocketgot ( wsc , res ) ;
}
if ( len )
{
char adr [ 64 ] ;
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Warning: Oversize packet from %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) ) ;
2012-04-09 19:12:12 +00:00
return false ;
}
return true ;
}
2013-12-08 20:06:55 +00:00
if ( wsc - > showerror ! = PP_OK )
{
switch ( wsc - > showerror )
{
case PP_ERROR_FAILED :
Con_TPrintf ( " FTENET_NaClWebSocket_GetPacket: PP_ERROR_FAILED \n " ) ;
break ;
case PP_ERROR_ABORTED :
Con_TPrintf ( " FTENET_NaClWebSocket_GetPacket: PP_ERROR_ABORTED \n " ) ;
break ;
case PP_ERROR_NOTSUPPORTED :
Con_TPrintf ( " FTENET_NaClWebSocket_GetPacket: PP_ERROR_NOTSUPPORTED \n " ) ;
break ;
case PP_ERROR_CONNECTION_CLOSED :
Con_TPrintf ( " FTENET_NaClWebSocket_GetPacket: PP_ERROR_CONNECTION_CLOSED \n " ) ;
break ;
case PP_ERROR_CONNECTION_RESET :
Con_TPrintf ( " FTENET_NaClWebSocket_GetPacket: PP_ERROR_CONNECTION_RESET \n " ) ;
break ;
case PP_ERROR_CONNECTION_REFUSED :
Con_TPrintf ( " FTENET_NaClWebSocket_GetPacket: PP_ERROR_CONNECTION_REFUSED \n " ) ;
break ;
case PP_ERROR_CONNECTION_ABORTED :
Con_TPrintf ( " FTENET_NaClWebSocket_GetPacket: PP_ERROR_CONNECTION_ABORTED \n " ) ;
break ;
case PP_ERROR_CONNECTION_FAILED :
Con_TPrintf ( " FTENET_NaClWebSocket_GetPacket: PP_ERROR_CONNECTION_FAILED \n " ) ;
break ;
case PP_ERROR_CONNECTION_TIMEDOUT :
Con_TPrintf ( " FTENET_NaClWebSocket_GetPacket: PP_ERROR_CONNECTION_TIMEDOUT \n " ) ;
break ;
case PP_ERROR_ADDRESS_INVALID :
Con_TPrintf ( " FTENET_NaClWebSocket_GetPacket: PP_ERROR_ADDRESS_INVALID \n " ) ;
break ;
case PP_ERROR_ADDRESS_UNREACHABLE :
Con_TPrintf ( " FTENET_NaClWebSocket_GetPacket: PP_ERROR_ADDRESS_UNREACHABLE \n " ) ;
break ;
case PP_ERROR_ADDRESS_IN_USE :
Con_TPrintf ( " FTENET_NaClWebSocket_GetPacket: PP_ERROR_ADDRESS_IN_USE \n " ) ;
break ;
default :
Con_TPrintf ( " FTENET_NaClWebSocket_GetPacket: error %i \n " , wsc - > showerror ) ;
break ;
}
wsc - > showerror = PP_OK ;
}
2012-04-09 19:12:12 +00:00
return false ;
}
2016-07-12 00:40:13 +00:00
static neterr_t FTENET_NaClWebSocket_SendPacket ( ftenet_generic_connection_t * gcon , int length , void * data , netadr_t * to )
2012-04-09 19:12:12 +00:00
{
ftenet_websocket_connection_t * wsc = ( void * ) gcon ;
int res ;
if ( wsc - > failed )
2016-07-12 00:40:13 +00:00
return NETERR_DISCONNECTED ;
2012-04-09 19:12:12 +00:00
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
# if 1
2013-11-24 16:35:52 +00:00
struct PP_Var str = ppb_vararraybuffer_interface - > Create ( length ) ;
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 * out = ppb_vararraybuffer_interface - > Map ( str ) ;
2013-11-24 16:35:52 +00:00
if ( ! out )
2016-07-12 00:40:13 +00:00
return NETERR_MTU ;
2013-11-24 16:35:52 +00:00
memcpy ( out , data , length ) ;
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
ppb_vararraybuffer_interface - > Unmap ( str ) ;
2013-11-24 16:35:52 +00:00
# else
int outchars = 0 ;
unsigned char outdata [ length * 2 + 1 ] ;
unsigned char * out = outdata , * in = data ;
2012-04-09 19:12:12 +00:00
while ( length - - > 0 )
{
if ( ! * in )
{
2013-03-12 23:09:25 +00:00
//sends 256 instead of 0
2012-04-09 19:12:12 +00:00
* out + + = 0xc0 | ( 0x100 > > 6 ) ;
* out + + = 0x80 | ( 0x100 & 0x3f ) ;
}
else if ( * in > = 0x80 )
{
* out + + = 0xc0 | ( * in > > 6 ) ;
* out + + = 0x80 | ( * in & 0x3f ) ;
}
else
* out + + = * in ;
in + + ;
outchars + + ;
}
* out = 0 ;
struct PP_Var str = ppb_var_interface - > VarFromUtf8 ( outdata , out - outdata ) ;
2013-11-24 16:35:52 +00:00
# endif
2012-04-09 19:12:12 +00:00
res = ppb_websocket_interface - > SendMessage ( wsc - > sock , str ) ;
// Sys_Printf("FTENET_WebSocket_SendPacket: result %i\n", res);
ppb_var_interface - > Release ( str ) ;
2016-07-12 00:40:13 +00:00
return NETERR_SENT ;
2012-04-09 19:12:12 +00:00
}
/*nacl websockets implementation...*/
2016-07-16 13:21:23 +00:00
static ftenet_generic_connection_t * FTENET_WebSocket_EstablishConnection ( qboolean isserver , const char * address , netadr_t adr )
2012-04-09 19:12:12 +00:00
{
ftenet_websocket_connection_t * newcon ;
PP_Resource newsocket ;
if ( isserver | | ! ppb_websocket_interface )
{
return NULL ;
}
2016-07-16 13:21:23 +00:00
2012-04-09 19:12:12 +00:00
newcon = Z_Malloc ( sizeof ( * newcon ) ) ;
if ( newcon )
{
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 WEBSOCKETPROTOCOL "fteqw"
2012-04-09 19:12:12 +00:00
struct PP_CompletionCallback ccb = { websocketconnected , newcon , PP_COMPLETIONCALLBACK_FLAG_NONE } ;
newsocket = ppb_websocket_interface - > Create ( pp_instance ) ;
struct PP_Var str = ppb_var_interface - > VarFromUtf8 ( adr . address . websocketurl , strlen ( adr . address . websocketurl ) ) ;
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
struct PP_Var protocols [ 1 ] = { ppb_var_interface - > VarFromUtf8 ( WEBSOCKETPROTOCOL , strlen ( WEBSOCKETPROTOCOL ) ) } ;
ppb_websocket_interface - > Connect ( newsocket , str , protocols , countof ( protocols ) , ccb ) ;
2012-04-09 19:12:12 +00:00
ppb_var_interface - > Release ( str ) ;
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
ppb_var_interface - > Release ( protocols [ 0 ] ) ;
2013-03-31 04:21:08 +00:00
Q_strncpyz ( newcon - > generic . name , " WebSocket " , sizeof ( newcon - > generic . name ) ) ;
2013-07-31 00:20:16 +00:00
newcon - > generic . GetPacket = FTENET_NaClWebSocket_GetPacket ;
newcon - > generic . SendPacket = FTENET_NaClWebSocket_SendPacket ;
newcon - > generic . Close = FTENET_NaClWebSocket_Close ;
2012-04-09 19:12:12 +00:00
newcon - > generic . islisten = isserver ;
newcon - > generic . addrtype [ 0 ] = NA_WEBSOCKET ;
newcon - > generic . addrtype [ 1 ] = NA_INVALID ;
newcon - > generic . thesocket = INVALID_SOCKET ;
newcon - > sock = newsocket ;
newcon - > remoteadr = adr ;
return & newcon - > generic ;
}
return NULL ;
}
# endif
2014-07-02 03:20:40 +00:00
qboolean NET_GetRates ( ftenet_connections_t * collection , float * pi , float * po , float * bi , float * bo )
{
2016-07-12 00:40:13 +00:00
int ctime ;
2014-07-02 03:20:40 +00:00
if ( ! collection )
return false ;
2016-07-12 00:40:13 +00:00
ctime = Sys_Milliseconds ( ) ;
if ( ( ctime - collection - > timemark ) > 1000 )
{
float secs = ( ctime - collection - > timemark ) / 1000.0f ;
collection - > packetsinrate = collection - > packetsin * secs ;
collection - > packetsoutrate = collection - > packetsout * secs ;
collection - > bytesinrate = collection - > bytesin * secs ;
collection - > bytesoutrate = collection - > bytesout * secs ;
collection - > packetsin = 0 ;
collection - > packetsout = 0 ;
collection - > bytesin = 0 ;
collection - > bytesout = 0 ;
collection - > timemark = ctime ;
}
2014-07-02 03:20:40 +00:00
* pi = collection - > packetsinrate ;
* po = collection - > packetsoutrate ;
* bi = collection - > bytesinrate ;
* bo = collection - > bytesoutrate ;
return true ;
}
2012-04-09 19:12:12 +00:00
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2016-07-12 00:40:13 +00:00
//for demo playback
qboolean NET_UpdateRates ( ftenet_connections_t * collection , qboolean inbound , size_t size )
{
int ctime ;
if ( ! collection )
return false ;
2018-06-18 16:44:29 +00:00
2016-07-12 00:40:13 +00:00
if ( inbound )
{
cls . sockets - > bytesin + = size ;
cls . sockets - > packetsin + = 1 ;
}
else
{
cls . sockets - > bytesout + = size ;
cls . sockets - > packetsout + = 1 ;
}
ctime = Sys_Milliseconds ( ) ;
if ( ( ctime - collection - > timemark ) > 1000 )
{
float secs = ( ctime - collection - > timemark ) / 1000.0f ;
collection - > packetsinrate = collection - > packetsin * secs ;
collection - > packetsoutrate = collection - > packetsout * secs ;
collection - > bytesinrate = collection - > bytesin * secs ;
collection - > bytesoutrate = collection - > bytesout * secs ;
collection - > packetsin = 0 ;
collection - > packetsout = 0 ;
collection - > bytesin = 0 ;
collection - > bytesout = 0 ;
collection - > timemark = ctime ;
}
return true ;
}
# endif
2011-10-27 16:16:29 +00:00
/*firstsock is a cookie*/
2018-12-28 00:04:36 +00:00
int NET_GetPacket ( ftenet_connections_t * collection , int firstsock )
2008-11-09 22:29:28 +00:00
{
2017-11-15 12:38:20 +00:00
struct ftenet_delayed_packet_s * p ;
2014-07-02 03:20:40 +00:00
unsigned int ctime ;
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
if ( ! collection )
2011-10-27 16:16:29 +00:00
return - 1 ;
2008-11-09 22:29:28 +00:00
2017-11-15 12:38:20 +00:00
while ( ( p = collection - > delayed_packets ) & & ( int ) ( Sys_Milliseconds ( ) - p - > sendtime ) > 0 )
{
collection - > delayed_packets = p - > next ;
# ifdef HAVE_DTLS
if ( p - > dest . prot = = NP_DTLS )
FTENET_DTLS_SendPacket ( collection , p - > cursize , p - > data , & p - > dest ) ;
else
# endif
NET_SendPacketCol ( collection , p - > cursize , p - > data , & p - > dest ) ;
Z_Free ( p ) ;
}
2012-02-12 05:18:31 +00:00
while ( firstsock < MAX_CONNECTIONS )
2008-11-09 22:29:28 +00:00
{
2017-05-18 10:24:09 +00:00
if ( collection - > conn [ firstsock ] )
if ( collection - > conn [ firstsock ] - > GetPacket ( collection - > conn [ firstsock ] ) )
2012-02-12 05:18:31 +00:00
{
2017-05-18 10:24:09 +00:00
if ( net_fakeloss . value )
{
if ( frandom ( ) < net_fakeloss . value )
continue ;
}
2012-02-12 05:18:31 +00:00
2017-05-18 10:24:09 +00:00
collection - > bytesin + = net_message . cursize ;
collection - > packetsin + = 1 ;
net_from . connum = firstsock + 1 ;
return firstsock ;
}
2012-02-12 05:18:31 +00:00
firstsock + = 1 ;
2008-11-09 22:29:28 +00:00
}
2005-11-30 01:20:53 +00:00
2014-07-02 03:20:40 +00:00
ctime = Sys_Milliseconds ( ) ;
if ( ( ctime - collection - > timemark ) > 1000 )
{
float secs = ( ctime - collection - > timemark ) / 1000.0f ;
collection - > packetsinrate = collection - > packetsin * secs ;
collection - > packetsoutrate = collection - > packetsout * secs ;
collection - > bytesinrate = collection - > bytesin * secs ;
collection - > bytesoutrate = collection - > bytesout * secs ;
collection - > packetsin = 0 ;
collection - > packetsout = 0 ;
collection - > bytesin = 0 ;
collection - > bytesout = 0 ;
collection - > timemark = ctime ;
}
2011-10-27 16:16:29 +00:00
return - 1 ;
2008-11-09 22:29:28 +00:00
}
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
int NET_LocalAddressForRemote ( ftenet_connections_t * collection , netadr_t * remote , netadr_t * local , int idx )
{
2014-02-07 08:38:40 +00:00
int adrflags ;
2008-11-09 22:29:28 +00:00
if ( ! remote - > connum )
return 0 ;
2005-11-30 01:20:53 +00:00
2011-05-15 13:23:13 +00:00
if ( ! collection - > conn [ remote - > connum - 1 ] )
2008-11-09 22:29:28 +00:00
return 0 ;
2005-11-30 01:20:53 +00:00
2014-02-07 08:38:40 +00:00
if ( ! collection - > conn [ remote - > connum - 1 ] - > GetLocalAddresses )
2008-11-09 22:29:28 +00:00
return 0 ;
2005-11-30 01:20:53 +00:00
2014-02-07 08:38:40 +00:00
return collection - > conn [ remote - > connum - 1 ] - > GetLocalAddresses ( collection - > conn [ remote - > connum - 1 ] , & adrflags , local , 1 ) ;
2008-11-09 22:29:28 +00:00
}
2017-05-18 10:24:09 +00:00
static neterr_t NET_SendPacketCol ( ftenet_connections_t * collection , int length , const void * data , netadr_t * to )
2008-11-09 22:29:28 +00:00
{
2016-07-12 00:40:13 +00:00
neterr_t err ;
2008-11-09 22:29:28 +00:00
int i ;
if ( ! collection )
2016-07-12 00:40:13 +00:00
return NETERR_NOROUTE ;
2005-11-30 01:20:53 +00:00
2018-09-23 19:35:24 +00:00
if ( net_fakeloss . value & & data )
2012-02-12 05:18:31 +00:00
{
if ( frandom ( ) < net_fakeloss . value )
2014-07-02 03:20:40 +00:00
{
collection - > bytesout + = length ;
collection - > packetsout + = 1 ;
2016-07-12 00:40:13 +00:00
return NETERR_SENT ;
2014-07-02 03:20:40 +00:00
}
2012-02-12 05:18:31 +00:00
}
2013-05-03 04:28:08 +00:00
if ( to - > connum )
2008-11-09 22:29:28 +00:00
{
2013-05-03 04:28:08 +00:00
if ( collection - > conn [ to - > connum - 1 ] )
2016-07-12 00:40:13 +00:00
{
err = collection - > conn [ to - > connum - 1 ] - > SendPacket ( collection - > conn [ to - > connum - 1 ] , length , data , to ) ;
if ( err ! = NETERR_NOROUTE )
2014-07-02 03:20:40 +00:00
{
2016-07-12 00:40:13 +00:00
/*if (err == NETERR_DISCONNECTED)
{
collection - > conn [ i ] - > Close ( collection - > conn [ i ] ) ;
collection - > conn [ i ] = NULL ;
continue ;
} */
2014-07-02 03:20:40 +00:00
collection - > bytesout + = length ;
collection - > packetsout + = 1 ;
2016-07-12 00:40:13 +00:00
return err ;
2014-07-02 03:20:40 +00:00
}
2016-07-12 00:40:13 +00:00
}
2008-11-09 22:29:28 +00:00
}
2005-11-30 01:20:53 +00:00
2008-11-09 22:29:28 +00:00
for ( i = 0 ; i < MAX_CONNECTIONS ; i + + )
{
if ( ! collection - > conn [ i ] )
continue ;
2016-07-12 00:40:13 +00:00
err = collection - > conn [ i ] - > SendPacket ( collection - > conn [ i ] , length , data , to ) ;
if ( err ! = NETERR_NOROUTE )
2014-07-02 03:20:40 +00:00
{
2016-07-12 00:40:13 +00:00
/*if (err == NETERR_DISCONNECTED)
{
collection - > conn [ i ] - > Close ( collection - > conn [ i ] ) ;
collection - > conn [ i ] = NULL ;
continue ;
} */
2014-07-02 03:20:40 +00:00
collection - > bytesout + = length ;
collection - > packetsout + = 1 ;
2016-07-12 00:40:13 +00:00
return err ;
2014-07-02 03:20:40 +00:00
}
2004-08-21 01:25:48 +00:00
}
2005-07-03 15:16:20 +00:00
2013-12-08 20:06:55 +00:00
// Con_Printf("No route to %s - try reconnecting\n", NET_AdrToString(buffer, sizeof(buffer), to));
2016-07-12 00:40:13 +00:00
return NETERR_NOROUTE ;
2008-11-09 22:29:28 +00:00
}
2004-08-21 01:25:48 +00:00
2018-12-28 00:04:36 +00:00
neterr_t NET_SendPacket ( ftenet_connections_t * collection , int length , const void * data , netadr_t * to )
2017-05-18 10:24:09 +00:00
{
2018-12-28 00:04:36 +00:00
if ( ! collection )
2017-05-18 10:24:09 +00:00
return NETERR_NOROUTE ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
if ( collection = = cls . sockets & & cl_delay_packets . ival > = 1 & & ! ( cl . fpd & FPD_NO_FAKE_LAG ) )
{
struct ftenet_delayed_packet_s * p , * * l ;
if ( ! collection )
return NETERR_NOROUTE ; //erk...
p = BZ_Malloc ( sizeof ( * p ) - sizeof ( p - > data ) + length ) ;
p - > sendtime = Sys_Milliseconds ( ) + cl_delay_packets . ival ;
p - > next = NULL ;
p - > cursize = length ;
p - > dest = * to ;
memcpy ( p - > data , data , length ) ;
for ( l = & collection - > delayed_packets ; * l ; l = & ( ( * l ) - > next ) )
;
* l = p ;
return NETERR_SENT ; //fixme: mtu, noroute, etc... panic? only allow if udp dest?
2017-05-18 10:24:09 +00:00
}
# endif
2018-12-28 00:04:36 +00:00
2017-05-18 10:24:09 +00:00
# ifdef HAVE_DTLS
if ( to - > prot = = NP_DTLS )
return FTENET_DTLS_SendPacket ( collection , length , data , to ) ;
# endif
return NET_SendPacketCol ( collection , length , data , to ) ;
}
2018-09-23 19:35:24 +00:00
qboolean NET_EnsureRoute ( ftenet_connections_t * collection , char * routename , char * host , netadr_t * adr )
2008-11-09 22:29:28 +00:00
{
2018-09-23 19:35:24 +00:00
switch ( adr - > prot )
2005-04-17 20:54:43 +00:00
{
2018-09-23 19:35:24 +00:00
case NP_DTLS :
break ;
case NP_DGRAM :
if ( NET_SendPacketCol ( collection , 0 , NULL , adr ) ! = NETERR_NOROUTE )
return true ;
case NP_WS :
case NP_WSS :
case NP_TLS :
case NP_STREAM :
if ( ! FTENET_AddToCollection ( collection , routename , host , adr - > type , adr - > prot ) )
return false ;
Con_Printf ( " Establishing connection to %s \n " , host ) ;
break ;
default :
//not recognised, or not needed
break ;
2005-04-17 20:54:43 +00:00
}
2012-01-17 07:57:46 +00:00
return true ;
2008-11-09 22:29:28 +00:00
}
2005-04-17 20:54:43 +00:00
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 NET_EnumerateAddresses ( ftenet_connections_t * collection , struct ftenet_generic_connection_s * * con , unsigned int * adrflags , netadr_t * addresses , int maxaddresses )
2014-02-07 08:38:40 +00:00
{
unsigned int found = 0 , c , i , j ;
for ( i = 0 ; i < MAX_CONNECTIONS ; i + + )
{
if ( ! collection - > conn [ i ] )
continue ;
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
if ( collection - > conn [ i ] - > GetLocalAddresses )
c = collection - > conn [ i ] - > GetLocalAddresses ( collection - > conn [ i ] , adrflags , addresses , maxaddresses ) ;
else
c = 0 ;
2014-02-07 08:38:40 +00:00
if ( maxaddresses & & ! c )
{
* adrflags = 0 ;
addresses - > type = NA_INVALID ;
c = 1 ;
}
//fill in connection info
for ( j = 0 ; j < c ; j + + )
{
con [ j ] = collection - > conn [ i ] ;
addresses [ j ] . connum = i + 1 ;
}
con + = c ;
adrflags + = c ;
addresses + = c ;
maxaddresses - = c ;
found + = c ;
}
return found ;
}
2019-08-24 16:09:08 +00:00
static enum addressscope_e NET_ClassifyAddressipv4 ( int ip , char * * outdesc )
{
int scope = ASCOPE_NET ;
char * desc = NULL ;
if ( ( ip & BigLong ( 0xffff0000 ) ) = = BigLong ( 0xA9FE0000 ) ) //169.254.x.x/16
scope = ASCOPE_LINK , desc = " link-local " ;
else if ( ( ip & BigLong ( 0xff000000 ) ) = = BigLong ( 0x0a000000 ) ) //10.x.x.x/8
scope = ASCOPE_LAN , desc = " private " ;
else if ( ( ip & BigLong ( 0xff000000 ) ) = = BigLong ( 0x7f000000 ) ) //127.x.x.x/8
scope = ASCOPE_HOST , desc = " localhost " ;
else if ( ( ip & BigLong ( 0xfff00000 ) ) = = BigLong ( 0xac100000 ) ) //172.16.x.x/12
scope = ASCOPE_LAN , desc = " private " ;
else if ( ( ip & BigLong ( 0xffff0000 ) ) = = BigLong ( 0xc0a80000 ) ) //192.168.x.x/16
scope = ASCOPE_LAN , desc = " private " ;
else if ( ( ip & BigLong ( 0xffc00000 ) ) = = BigLong ( 0x64400000 ) ) //100.64.x.x/10
scope = ASCOPE_LAN , desc = " CGNAT " ;
else if ( ip = = BigLong ( 0x00000000 ) ) //0.0.0.0/32
scope = ASCOPE_LAN , desc = " any " ;
* outdesc = desc ;
return scope ;
}
2015-07-07 02:33:00 +00:00
enum addressscope_e NET_ClassifyAddress ( netadr_t * adr , char * * outdesc )
{
int scope = ASCOPE_NET ;
char * desc = NULL ;
if ( adr - > type = = NA_LOOPBACK )
{
//we don't list 127.0.0.1 or ::1, so don't bother with this either. its not interesting.
scope = ASCOPE_PROCESS , desc = " internal " ;
}
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
else if ( adr - > type = = NA_IPV6 )
2015-07-07 02:33:00 +00:00
{
if ( ( * ( int * ) adr - > address . ip6 & BigLong ( 0xffc00000 ) ) = = BigLong ( 0xfe800000 ) ) //fe80::/10
2019-02-16 19:09:07 +00:00
scope = ASCOPE_LINK , desc = " link-local " ;
2015-07-07 02:33:00 +00:00
else if ( ( * ( int * ) adr - > address . ip6 & BigLong ( 0xfe000000 ) ) = = BigLong ( 0xfc00000 ) ) //fc::/7
scope = ASCOPE_LAN , desc = " ULA/private " ;
else if ( * ( int * ) adr - > address . ip6 = = BigLong ( 0x20010000 ) ) //2001::/32
scope = ASCOPE_NET , desc = " toredo " ;
else if ( ( * ( int * ) adr - > address . ip6 & BigLong ( 0xffff0000 ) ) = = BigLong ( 0x20020000 ) ) //2002::/16
scope = ASCOPE_NET , desc = " 6to4 " ;
else if ( memcmp ( adr - > address . ip6 , " \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \1 " , 16 ) = = 0 ) //::1
scope = ASCOPE_HOST , desc = " localhost " ;
else if ( memcmp ( adr - > address . ip6 , " \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 " , 16 ) = = 0 ) //::
scope = ASCOPE_NET , desc = " any " ;
2019-08-24 16:09:08 +00:00
else if ( memcmp ( adr - > address . ip6 , " \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \xff \xff " , 12 ) = = 0 ) //::ffff:x.y.z.w
{
scope = NET_ClassifyAddressipv4 ( * ( int * ) ( adr - > address . ip6 + 12 ) , & desc ) ;
if ( ! desc )
desc = " vp-mapped " ;
}
2015-07-07 02:33:00 +00:00
}
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
else if ( adr - > type = = NA_IP )
2019-08-24 16:09:08 +00:00
scope = NET_ClassifyAddressipv4 ( * ( int * ) adr - > address . ip , & desc ) ;
2015-07-07 02:33:00 +00:00
if ( outdesc )
* outdesc = desc ;
return scope ;
}
2014-02-07 08:38:40 +00:00
# define MAXADDRESSES 64
2008-11-09 22:29:28 +00:00
void NET_PrintAddresses ( ftenet_connections_t * collection )
{
int i ;
char adrbuf [ MAX_ADR_SIZE ] ;
2014-02-07 08:38:40 +00:00
int m ;
netadr_t addr [ 64 ] ;
struct ftenet_generic_connection_s * con [ sizeof ( addr ) / sizeof ( addr [ 0 ] ) ] ;
int flags [ sizeof ( addr ) / sizeof ( addr [ 0 ] ) ] ;
2015-06-12 14:44:50 +00:00
qboolean warn = true ;
2019-02-16 19:09:07 +00:00
static const char * scopes [ ] = { " process " , " local " , " link " , " lan " , " net " } ;
char * desc ;
2004-08-21 01:25:48 +00:00
2008-11-09 22:29:28 +00:00
if ( ! collection )
return ;
2004-08-21 01:25:48 +00:00
2014-02-07 08:38:40 +00:00
m = NET_EnumerateAddresses ( collection , con , flags , addr , sizeof ( addr ) / sizeof ( addr [ 0 ] ) ) ;
for ( i = 0 ; i < m ; i + + )
2008-11-09 22:29:28 +00:00
{
2015-06-12 14:44:50 +00:00
if ( addr [ i ] . type ! = NA_INVALID )
{
2019-02-16 19:09:07 +00:00
enum addressscope_e scope = NET_ClassifyAddress ( & addr [ i ] , & desc ) ;
if ( developer . ival | | scope > = ASCOPE_LAN )
2015-06-14 08:16:15 +00:00
{
warn = false ;
if ( desc )
2019-02-16 19:09:07 +00:00
Con_Printf ( " %s address (%s): %s (%s) \n " , scopes [ scope ] , con [ i ] - > name , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & addr [ i ] ) , desc ) ;
2015-06-14 08:16:15 +00:00
else
2019-02-16 19:09:07 +00:00
Con_Printf ( " %s address (%s): %s \n " , scopes [ scope ] , con [ i ] - > name , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & addr [ i ] ) ) ;
2015-06-12 14:44:50 +00:00
}
}
2004-08-21 01:25:48 +00:00
}
2015-06-12 14:44:50 +00:00
if ( warn )
2019-02-16 19:09:07 +00:00
Con_Printf ( " net address: no public addresses \n " ) ;
2004-08-21 01:25:48 +00:00
}
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 NET_PrintConnectionsStatus ( ftenet_connections_t * collection )
{
unsigned int i ;
for ( i = 0 ; i < MAX_CONNECTIONS ; i + + )
{
if ( ! collection - > conn [ i ] )
continue ;
if ( collection - > conn [ i ] - > PrintStatus )
collection - > conn [ i ] - > PrintStatus ( collection - > conn [ i ] ) ;
}
2017-05-18 10:24:09 +00:00
# ifdef HAVE_DTLS
2018-10-23 07:09:06 +00:00
if ( developer . ival )
2017-05-18 10:24:09 +00:00
{
struct dtlspeer_s * dtls ;
char adr [ 64 ] ;
for ( dtls = collection - > dtls ; dtls ; dtls = dtls - > next )
Con_Printf ( " dtls: %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & dtls - > addr ) ) ;
}
2018-10-23 07:09:06 +00:00
else
{
struct dtlspeer_s * dtls ;
int c = 0 ;
for ( dtls = collection - > dtls ; dtls ; dtls = dtls - > next )
c + + ;
if ( c )
Con_Printf ( " dtls connections : %i \n " , c ) ;
}
2017-05-18 10:24:09 +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
}
2004-08-21 01:25:48 +00:00
//=============================================================================
2013-05-03 04:28:08 +00:00
int TCP_OpenStream ( netadr_t * remoteaddr )
2005-11-30 01:20:53 +00:00
{
2012-04-09 19:12:12 +00:00
# ifndef HAVE_TCP
2018-03-25 09:36:14 +00:00
return ( int ) INVALID_SOCKET ;
2012-04-09 19:12:12 +00:00
# else
2005-11-30 01:20:53 +00:00
unsigned long _true = true ;
int newsocket ;
int temp ;
struct sockaddr_qstorage qs ;
2012-01-21 07:53:49 +00:00
// struct sockaddr_qstorage loc;
2013-03-31 04:21:08 +00:00
int recvbufsize = ( 1 < < 19 ) ; //512kb
2018-09-23 19:35:24 +00:00
int sysprot ;
2005-11-30 01:20:53 +00:00
2018-09-23 19:35:24 +00:00
switch ( remoteaddr - > type )
{
# if defined(HAVE_IPV4) || defined(HAVE_IPV6)
case NA_IP :
case NA_IPV6 :
sysprot = IPPROTO_TCP ;
break ;
# endif
# ifdef HAVE_IPX
case NA_IPX :
2018-10-17 00:43:04 +00:00
sysprot = NSPROTO_IPX ;
2018-09-23 19:35:24 +00:00
break ;
# endif
default :
sysprot = 0 ;
break ;
}
2013-05-03 04:28:08 +00:00
temp = NetadrToSockadr ( remoteaddr , & qs ) ;
2005-12-15 19:15:39 +00:00
2018-09-23 19:35:24 +00:00
if ( ( newsocket = socket ( ( ( struct sockaddr_in * ) & qs ) - > sin_family , SOCK_CLOEXEC | SOCK_STREAM , sysprot ) ) = = INVALID_SOCKET )
2013-06-24 09:04:00 +00:00
return ( int ) INVALID_SOCKET ;
2005-11-30 01:20:53 +00:00
2013-03-31 04:21:08 +00:00
setsockopt ( newsocket , SOL_SOCKET , SO_RCVBUF , ( void * ) & recvbufsize , sizeof ( recvbufsize ) ) ;
2013-06-23 02:17:02 +00:00
if ( ioctlsocket ( newsocket , FIONBIO , & _true ) = = - 1 )
2014-02-07 08:38:40 +00:00
Sys_Error ( " UDP_OpenSocket: ioctl FIONBIO: %s " , strerror ( neterrno ( ) ) ) ;
2013-06-23 02:17:02 +00:00
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
if ( remoteaddr - > type = = AF_UNIX )
{ //if its a unix socket, attempt to bind it to an unnamed address. linux should generate an ephemerial abstract address (otherwise the server will see an empty address).
struct sockaddr_un un ;
memset ( & un , 0 , offsetof ( struct sockaddr_un , sun_path ) ) ;
2019-02-16 19:09:07 +00:00
bind ( newsocket , ( struct sockaddr * ) & un , offsetof ( struct sockaddr_un , sun_path ) ) ;
2018-09-23 19:35:24 +00:00
}
else
# endif
{
// memset(&loc, 0, sizeof(loc));
// ((struct sockaddr*)&loc)->sa_family = ((struct sockaddr*)&loc)->sa_family;
// bind(newsocket, (struct sockaddr *)&loc, ((struct sockaddr_in*)&qs)->sin_family == AF_INET?sizeof(struct sockaddr_in):sizeof(struct sockaddr_in6));
}
2012-01-17 07:57:46 +00:00
2005-11-30 01:20:53 +00:00
if ( connect ( newsocket , ( struct sockaddr * ) & qs , temp ) = = INVALID_SOCKET )
{
2014-02-07 08:38:40 +00:00
int err = neterrno ( ) ;
if ( err ! = NET_EWOULDBLOCK & & err ! = NET_EINPROGRESS )
2013-03-12 22:44:00 +00:00
{
2013-06-24 09:04:00 +00:00
char buf [ 256 ] ;
NET_AdrToString ( buf , sizeof ( buf ) , remoteaddr ) ;
2014-02-07 08:38:40 +00:00
if ( err = = NET_EADDRNOTAVAIL )
2013-06-23 02:17:02 +00:00
{
if ( remoteaddr - > port = = 0 & & ( remoteaddr - > type = = NA_IP | | remoteaddr - > type = = NA_IPV6 ) )
2013-06-24 09:04:00 +00:00
Con_Printf ( " TCP_OpenStream: no port specified (%s) \n " , buf ) ;
2013-06-23 02:17:02 +00:00
else
Con_Printf ( " TCP_OpenStream: invalid address trying to connect to %s \n " , buf ) ;
}
2018-09-23 19:35:24 +00:00
else if ( err = = NET_ECONNREFUSED )
Con_Printf ( " TCP_OpenStream: connection refused (%s) \n " , buf ) ;
2014-02-07 08:38:40 +00:00
else if ( err = = NET_EACCES )
2013-06-24 09:04:00 +00:00
Con_Printf ( " TCP_OpenStream: access denied: check firewall (%s) \n " , buf ) ;
2013-03-12 22:44:00 +00:00
else
2013-06-24 09:04:00 +00:00
Con_Printf ( " TCP_OpenStream: connect: error %i (%s) \n " , err , buf ) ;
2013-06-23 02:17:02 +00:00
closesocket ( newsocket ) ;
2013-06-24 09:04:00 +00:00
return ( int ) INVALID_SOCKET ;
2013-03-12 22:44:00 +00:00
}
2005-11-30 01:20:53 +00:00
}
return newsocket ;
2012-04-09 19:12:12 +00:00
# endif
2005-11-30 01:20:53 +00:00
}
2013-03-31 04:21:08 +00:00
/*int TCP_OpenListenSocket (const char *localip, int port)
2005-11-30 01:20:53 +00:00
{
2012-04-09 19:12:12 +00:00
# ifndef HAVE_TCP
return INVALID_SOCKET ;
# else
2005-11-30 01:20:53 +00:00
int newsocket ;
2013-03-31 04:21:08 +00:00
struct sockaddr_qstorage address ;
int pf ;
2005-11-30 01:20:53 +00:00
unsigned long _true = true ;
int i ;
int maxport = port + 100 ;
2013-03-31 04:21:08 +00:00
if ( localip & & * localip )
{
if ( ! NET_StringToSockaddr ( localip , port , & address , & pf , & adrsize ) )
return INVALID_SOCKET ;
}
else
{
adrsize = sizeof ( struct sockaddr_in ) ;
pf = ( ( struct sockaddr_in * ) & address ) - > sin_family = AF_INET ;
( ( struct sockaddr_in * ) & address ) - > sin_port = htons ( port ) ;
//ZOID -- check for interface binding option
if ( ( i = COM_CheckParm ( " -ip " ) ) ! = 0 & & i < com_argc )
{
( ( struct sockaddr_in * ) & address ) - > sin_addr . s_addr = inet_addr ( com_argv [ i + 1 ] ) ;
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Binding to IP Interface Address of %s \n " ,
2013-03-31 04:21:08 +00:00
inet_ntoa ( address . sin_addr ) ) ;
}
else
( ( struct sockaddr_in * ) & address ) - > sin_addr . s_addr = INADDR_ANY ;
}
if ( ( newsocket = socket ( pf , SOCK_STREAM , IPPROTO_TCP ) ) = = INVALID_SOCKET )
2005-11-30 01:20:53 +00:00
return INVALID_SOCKET ;
if ( ioctlsocket ( newsocket , FIONBIO , & _true ) = = - 1 )
Sys_Error ( " TCP_OpenListenSocket: ioctl FIONBIO: %s " , strerror ( qerrno ) ) ;
for ( ; ; )
{
if ( port = = PORT_ANY )
address . sin_port = 0 ;
else
address . sin_port = htons ( ( short ) port ) ;
if ( bind ( newsocket , ( void * ) & address , sizeof ( address ) ) = = - 1 )
{
if ( ! port )
{
Con_Printf ( " Cannot bind tcp socket \n " ) ;
closesocket ( newsocket ) ;
return INVALID_SOCKET ;
}
port + + ;
if ( port > maxport )
{
Con_Printf ( " Cannot bind tcp socket \n " ) ;
closesocket ( newsocket ) ;
return INVALID_SOCKET ;
}
}
else
break ;
}
if ( listen ( newsocket , 1 ) = = INVALID_SOCKET )
{
Con_Printf ( " Cannot listen on tcp socket \n " ) ;
closesocket ( newsocket ) ;
return INVALID_SOCKET ;
}
return newsocket ;
2012-04-09 19:12:12 +00:00
# endif
2005-11-30 01:20:53 +00:00
}
2013-03-31 04:21:08 +00:00
*/
2005-11-30 01:20:53 +00:00
2012-04-09 19:12:12 +00:00
# if defined(SV_MASTER) || defined(CL_MASTER)
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 UDP_OpenSocket ( int port )
2004-08-21 01:25:48 +00:00
{
2011-12-23 03:12:29 +00:00
SOCKET newsocket ;
2004-08-21 01:25:48 +00:00
struct sockaddr_in address ;
unsigned long _true = true ;
int i ;
int maxport = port + 100 ;
2016-07-12 00:40:13 +00:00
if ( ( newsocket = socket ( PF_INET , SOCK_CLOEXEC | SOCK_DGRAM , IPPROTO_UDP ) ) = = INVALID_SOCKET )
2013-06-24 09:04:00 +00:00
return ( int ) INVALID_SOCKET ;
2004-08-21 01:25:48 +00:00
if ( ioctlsocket ( newsocket , FIONBIO , & _true ) = = - 1 )
2014-02-07 08:38:40 +00:00
Sys_Error ( " UDP_OpenSocket: ioctl FIONBIO: %s " , strerror ( neterrno ( ) ) ) ;
2004-08-21 01:25:48 +00:00
address . sin_family = AF_INET ;
//ZOID -- check for interface binding option
if ( ( i = COM_CheckParm ( " -ip " ) ) ! = 0 & & i < com_argc ) {
address . sin_addr . s_addr = inet_addr ( com_argv [ i + 1 ] ) ;
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Binding to IP Interface Address of %s \n " ,
2004-08-21 01:25:48 +00:00
inet_ntoa ( address . sin_addr ) ) ;
} else
address . sin_addr . s_addr = INADDR_ANY ;
for ( ; ; )
{
if ( port = = PORT_ANY )
address . sin_port = 0 ;
else
address . sin_port = htons ( ( short ) port ) ;
2005-07-03 15:16:20 +00:00
2004-08-21 01:25:48 +00:00
if ( bind ( newsocket , ( void * ) & address , sizeof ( address ) ) = = - 1 )
{
if ( ! port )
2014-02-07 08:38:40 +00:00
Sys_Error ( " UDP_OpenSocket: bind: %s " , strerror ( neterrno ( ) ) ) ;
2004-08-21 01:25:48 +00:00
port + + ;
if ( port > maxport )
2014-02-07 08:38:40 +00:00
Sys_Error ( " UDP_OpenSocket: bind: %s " , strerror ( neterrno ( ) ) ) ;
2004-08-21 01:25:48 +00:00
}
else
break ;
}
return newsocket ;
}
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
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 UDP6_OpenSocket ( int port )
2004-08-21 01:25:48 +00:00
{
2006-06-27 16:00:41 +00:00
int err ;
2011-12-23 03:12:29 +00:00
SOCKET newsocket ;
2004-08-21 01:25:48 +00:00
struct sockaddr_in6 address ;
unsigned long _true = true ;
// int i;
int maxport = port + 100 ;
2007-07-23 10:56:17 +00:00
memset ( & address , 0 , sizeof ( address ) ) ;
2016-07-12 00:40:13 +00:00
if ( ( newsocket = socket ( PF_INET6 , SOCK_CLOEXEC | SOCK_DGRAM , 0 ) ) = = INVALID_SOCKET )
2004-08-21 01:25:48 +00:00
{
2014-02-07 08:38:40 +00:00
Con_Printf ( " IPV6 is not supported: %s \n " , strerror ( neterrno ( ) ) ) ;
2013-06-24 09:04:00 +00:00
return ( int ) INVALID_SOCKET ;
2004-08-21 01:25:48 +00:00
}
if ( ioctlsocket ( newsocket , FIONBIO , & _true ) = = - 1 )
2014-02-07 08:38:40 +00:00
Sys_Error ( " UDP_OpenSocket: ioctl FIONBIO: %s " , strerror ( neterrno ( ) ) ) ;
2004-08-21 01:25:48 +00:00
2011-12-05 15:23:40 +00:00
# ifdef IPV6_V6ONLY
setsockopt ( newsocket , IPPROTO_IPV6 , IPV6_V6ONLY , ( char * ) & _true , sizeof ( _true ) ) ;
# endif
2004-08-21 01:25:48 +00:00
address . sin6_family = AF_INET6 ;
//ZOID -- check for interface binding option
// if ((i = COM_CheckParm("-ip6")) != 0 && i < com_argc) {
// address.sin6_addr = inet_addr(com_argv[i+1]);
2013-11-29 14:36:47 +00:00
/// Con_TPrintf("Binding to IP Interface Address of %s\n",
2004-08-21 01:25:48 +00:00
// inet_ntoa(address.sin6_addr));
// } else
2004-09-04 17:40:49 +00:00
memset ( & address . sin6_addr , 0 , sizeof ( struct in6_addr ) ) ;
2004-08-21 01:25:48 +00:00
for ( ; ; )
{
if ( port = = PORT_ANY )
address . sin6_port = 0 ;
else
address . sin6_port = htons ( ( short ) port ) ;
if ( bind ( newsocket , ( void * ) & address , sizeof ( address ) ) = = - 1 )
{
if ( ! port )
2006-06-27 16:00:41 +00:00
{
2014-02-07 08:38:40 +00:00
err = neterrno ( ) ;
2006-06-27 16:00:41 +00:00
Con_Printf ( " UDP6_OpenSocket: bind: (%i) %s " , err , strerror ( err ) ) ;
closesocket ( newsocket ) ;
2013-06-24 09:04:00 +00:00
return ( int ) INVALID_SOCKET ;
2006-06-27 16:00:41 +00:00
}
2004-08-21 01:25:48 +00:00
port + + ;
if ( port > maxport )
2006-06-27 16:00:41 +00:00
{
2014-02-07 08:38:40 +00:00
err = neterrno ( ) ;
2006-06-27 16:00:41 +00:00
Con_Printf ( " UDP6_OpenSocket: bind: (%i) %s " , err , strerror ( err ) ) ;
closesocket ( newsocket ) ;
2013-06-24 09:04:00 +00:00
return ( int ) INVALID_SOCKET ;
2006-06-27 16:00:41 +00:00
}
2004-08-21 01:25:48 +00:00
}
else
break ;
}
return newsocket ;
}
# endif
void UDP_CloseSocket ( int socket )
{
closesocket ( socket ) ;
}
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 IPX_OpenSocket ( int port )
2004-08-21 01:25:48 +00:00
{
2018-09-23 19:35:24 +00:00
# ifndef HAVE_IPX
2004-08-21 01:25:48 +00:00
return 0 ;
# else
2011-12-23 03:12:29 +00:00
SOCKET newsocket ;
2004-08-21 01:25:48 +00:00
struct sockaddr_ipx address ;
u_long _true = 1 ;
2016-07-12 00:40:13 +00:00
if ( ( newsocket = socket ( PF_IPX , SOCK_CLOEXEC | SOCK_DGRAM , NSPROTO_IPX ) ) = = INVALID_SOCKET )
2004-08-21 01:25:48 +00:00
{
2014-02-07 08:38:40 +00:00
int e = neterrno ( ) ;
if ( e ! = NET_EAFNOSUPPORT )
Con_Printf ( " WARNING: IPX_Socket: socket: %i \n " , e ) ;
2005-05-19 02:40:18 +00:00
return INVALID_SOCKET ;
2004-08-21 01:25:48 +00:00
}
// make it non-blocking
if ( ioctlsocket ( newsocket , FIONBIO , & _true ) = = - 1 )
{
2014-02-07 08:38:40 +00:00
Con_Printf ( " WARNING: IPX_Socket: ioctl FIONBIO: %i \n " , neterrno ( ) ) ;
2005-05-19 02:40:18 +00:00
return INVALID_SOCKET ;
2004-08-21 01:25:48 +00:00
}
address . sa_family = AF_IPX ;
memset ( address . sa_netnum , 0 , 4 ) ;
memset ( address . sa_nodenum , 0 , 6 ) ;
if ( port = = PORT_ANY )
address . sa_socket = 0 ;
else
address . sa_socket = htons ( ( short ) port ) ;
if ( bind ( newsocket , ( void * ) & address , sizeof ( address ) ) = = - 1 )
{
2014-02-07 08:38:40 +00:00
Con_Printf ( " WARNING: IPX_Socket: bind: %i \n " , neterrno ( ) ) ;
2004-08-21 01:25:48 +00:00
closesocket ( newsocket ) ;
2005-05-19 02:40:18 +00:00
return INVALID_SOCKET ;
2004-08-21 01:25:48 +00:00
}
return newsocket ;
# endif
}
void IPX_CloseSocket ( int socket )
{
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2004-08-21 01:25:48 +00:00
closesocket ( socket ) ;
# endif
}
2012-04-09 19:12:12 +00:00
# endif
2004-08-21 01:25:48 +00:00
// sleeps msec or until net socket is ready
//stdin can sometimes be a socket. As a result,
//we give the option to select it for nice console imput with timeouts.
2014-07-02 03:20:40 +00:00
qboolean NET_Sleep ( float seconds , qboolean stdinissocket )
2004-08-21 01:25:48 +00:00
{
2012-04-09 19:12:12 +00:00
# ifdef HAVE_PACKET
2014-09-02 02:44:43 +00:00
struct timeval timeout ;
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
fd_set readfdset ;
fd_set writefdset ;
2014-09-02 02:44:43 +00:00
qintptr_t maxfd = - 1 ;
2008-11-09 22:29:28 +00:00
int con , sock ;
2014-07-02 03:20:40 +00:00
unsigned int usec ;
2004-08-21 01:25:48 +00:00
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
FD_ZERO ( & readfdset ) ;
FD_ZERO ( & writefdset ) ;
2004-08-21 01:25:48 +00:00
if ( stdinissocket )
2014-09-02 02:44:43 +00:00
{
sock = 0 ; //stdin tends to be socket/filehandle 0 in unix
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
FD_SET ( sock , & readfdset ) ;
2014-09-02 02:44:43 +00:00
maxfd = sock ;
}
2004-08-21 01:25:48 +00:00
2018-12-28 00:04:36 +00:00
# ifdef SV_MASTER
{
extern ftenet_connections_t * svm_sockets ;
if ( svm_sockets )
for ( con = 0 ; con < MAX_CONNECTIONS ; con + + )
{
if ( ! svm_sockets - > conn [ con ] )
continue ;
if ( svm_sockets - > conn [ con ] - > SetFDSets )
{
sock = svm_sockets - > conn [ con ] - > SetFDSets ( svm_sockets - > conn [ con ] , & readfdset , & writefdset ) ;
if ( sock > maxfd )
maxfd = sock ;
}
else
{
sock = svm_sockets - > conn [ con ] - > thesocket ;
if ( sock ! = INVALID_SOCKET )
{
FD_SET ( sock , & readfdset ) ; // network socket
if ( sock > maxfd )
maxfd = sock ;
}
}
}
}
# endif
# ifdef HAVE_SERVER
2008-11-09 22:29:28 +00:00
if ( svs . sockets )
for ( con = 0 ; con < MAX_CONNECTIONS ; con + + )
2004-08-21 01:25:48 +00:00
{
2008-11-09 22:29:28 +00:00
if ( ! svs . sockets - > conn [ con ] )
continue ;
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
if ( svs . sockets - > conn [ con ] - > SetFDSets )
2008-11-09 22:29:28 +00:00
{
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
sock = svs . sockets - > conn [ con ] - > SetFDSets ( svs . sockets - > conn [ con ] , & readfdset , & writefdset ) ;
2008-11-09 22:29:28 +00:00
if ( sock > maxfd )
maxfd = sock ;
}
2012-04-09 19:12:12 +00:00
else
{
sock = svs . sockets - > conn [ con ] - > thesocket ;
if ( sock ! = INVALID_SOCKET )
{
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
FD_SET ( sock , & readfdset ) ; // network socket
2012-04-09 19:12:12 +00:00
if ( sock > maxfd )
maxfd = sock ;
}
}
2004-08-21 01:25:48 +00:00
}
2018-12-28 00:04:36 +00:00
# endif
2008-11-09 22:29:28 +00:00
2016-07-12 00:40:13 +00:00
if ( seconds > 4.0 ) //realy? oh well.
seconds = 4.0 ;
2014-09-02 02:44:43 +00:00
if ( maxfd = = - 1 )
2014-07-02 03:20:40 +00:00
Sys_Sleep ( seconds ) ;
2013-07-13 12:14:32 +00:00
else
2016-07-12 00:40:13 +00:00
{
usec = seconds * 1000 * 1000 ;
usec + = 1000 ; //slight extra delay, to ensure we don't wake up with nothing to do.
timeout . tv_sec = usec / ( 1000 * 1000 ) ;
timeout . tv_usec = usec ;
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
select ( maxfd + 1 , & readfdset , & writefdset , NULL , & timeout ) ;
2016-07-12 00:40:13 +00:00
}
2004-08-21 01:25:48 +00:00
if ( stdinissocket )
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
return FD_ISSET ( 0 , & readfdset ) ;
2012-04-09 19:12:12 +00:00
# endif
2004-08-21 01:25:48 +00:00
return true ;
}
2013-11-24 16:35:52 +00:00
//this function is used to determine the 'default' local address.
//this is used for compat with gamespy which insists on sending us a packet via that interface and not something more sensible like 127.0.0.1
//thus its only needed on windows and with ipv4.
2005-05-26 12:55:34 +00:00
void NET_GetLocalAddress ( int socket , netadr_t * out )
2004-08-21 01:25:48 +00:00
{
2014-03-30 08:55:06 +00:00
# if defined(_WIN32) && defined(HAVE_PACKET)
2004-08-21 01:25:48 +00:00
char buff [ 512 ] ;
struct sockaddr_qstorage address ;
int namelen ;
2006-01-27 08:06:48 +00:00
netadr_t adr = { 0 } ;
2005-10-07 16:27:20 +00:00
qboolean notvalid = false ;
2004-08-21 01:25:48 +00:00
2005-10-07 16:27:20 +00:00
strcpy ( buff , " localhost " ) ;
2004-08-21 01:25:48 +00:00
gethostname ( buff , 512 ) ;
buff [ 512 - 1 ] = 0 ;
2013-03-12 22:53:23 +00:00
if ( ! NET_StringToAdr ( buff , 0 , & adr ) ) //urm
2016-02-15 06:01:17 +00:00
if ( ! NET_StringToAdr ( " 127.0.0.1 " , 0 , & adr ) )
return ;
2005-10-07 16:27:20 +00:00
2004-08-21 01:25:48 +00:00
namelen = sizeof ( address ) ;
if ( getsockname ( socket , ( struct sockaddr * ) & address , & namelen ) = = - 1 )
2005-10-07 16:27:20 +00:00
{
notvalid = true ;
2018-09-23 19:35:24 +00:00
NET_StringToSockaddr2 ( " 0.0.0.0 " , 0 , NA_INVALID , ( struct sockaddr_qstorage * ) & address , NULL , NULL , 1 ) ;
2005-10-07 16:27:20 +00:00
// Sys_Error ("NET_Init: getsockname:", strerror(qerrno));
}
2004-08-21 01:25:48 +00:00
2018-09-23 19:35:24 +00:00
SockadrToNetadr ( & address , namelen , out ) ;
2008-05-25 01:07:53 +00:00
if ( out - > type = = NA_IP )
{
if ( ! * ( int * ) out - > address . ip ) //socket was set to auto
2013-11-28 00:45:22 +00:00
{
if ( adr . type = = NA_IP )
* ( int * ) out - > address . ip = * ( int * ) adr . address . ip ; //change it to what the machine says it is, rather than the socket.
}
}
if ( out - > type = = NA_IPV6 )
{
if ( ! ( ( int * ) out - > address . ip6 ) [ 0 ] & &
! ( ( int * ) out - > address . ip6 ) [ 1 ] & &
! ( ( short * ) out - > address . ip6 ) [ 4 ] & &
( ! ( ( short * ) out - > address . ip6 ) [ 5 ] | | ( ( unsigned short * ) out - > address . ip6 ) [ 5 ] = = 0xffffu )
& & ! ( ( int * ) out - > address . ip6 ) [ 3 ] ) //ipv6 any or ipv4-mapped any.
{
if ( adr . type = = NA_IP )
{
memset ( out - > address . ip6 , 0 , sizeof ( out - > address . ip6 ) ) ;
( ( short * ) out - > address . ip6 ) [ 5 ] = 0xffff ;
( ( int * ) out - > address . ip6 ) [ 3 ] = * ( int * ) adr . address . ip ;
}
else if ( adr . type = = NA_IPV6 )
memcpy ( out - > address . ip6 , adr . address . ip6 , sizeof ( out - > address . ip6 ) ) ;
}
2008-05-25 01:07:53 +00:00
}
2004-08-21 01:25:48 +00:00
2013-11-24 16:35:52 +00:00
if ( ! notvalid )
{
2014-06-08 09:36:15 +00:00
// char adrbuf[MAX_ADR_SIZE];
2014-06-02 16:50:40 +00:00
// Con_TPrintf("Client IP address %s\n", NET_AdrToString (adrbuf, sizeof(adrbuf), out) );
2013-11-24 16:35:52 +00:00
return ;
}
2014-06-02 16:50:40 +00:00
// Con_Printf("Couldn't detect local ip\n");
2012-04-09 19:12:12 +00:00
# endif
2013-11-24 16:35:52 +00:00
out - > type = NA_INVALID ;
2004-08-21 01:25:48 +00:00
}
2018-12-28 00:04:36 +00:00
# ifdef HAVE_SERVER
2013-11-21 23:02:28 +00:00
void SVNET_AddPort_f ( void )
2013-06-29 16:01:07 +00:00
{
2013-11-21 23:02:28 +00:00
char * s = Cmd_Argv ( 1 ) ;
char * conname = Cmd_Argv ( 2 ) ;
2013-06-29 16:01:07 +00:00
2013-11-21 23:02:28 +00:00
if ( ! * s & & ! * conname )
{
Con_Printf ( " Active Server ports: \n " ) ;
NET_PrintAddresses ( svs . sockets ) ;
Con_Printf ( " end of list \n " ) ;
return ;
}
if ( ! * conname )
conname = NULL ;
2013-06-29 16:01:07 +00:00
2013-11-21 23:02:28 +00:00
//just in case
if ( ! svs . sockets )
{
svs . sockets = FTENET_CreateCollection ( true ) ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2018-04-07 12:33:06 +00:00
FTENET_AddToCollection ( svs . sockets , " SVLoopback " , STRINGIFY ( PORT_DEFAULTSERVER ) , NA_LOOPBACK , NP_DGRAM ) ;
2013-11-21 23:02:28 +00:00
# endif
}
2013-06-29 16:01:07 +00:00
2017-06-21 01:24:25 +00:00
FTENET_AddToCollection ( svs . sockets , conname , * s ? s : NULL , * s ? NA_IP : NA_INVALID , NP_DGRAM ) ;
2013-11-21 23:02:28 +00:00
}
# endif
2013-06-29 16:01:07 +00:00
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2013-11-21 23:02:28 +00:00
void NET_ClientPort_f ( void )
2013-06-29 16:01:07 +00:00
{
2013-11-21 23:02:28 +00:00
Con_Printf ( " Active Client ports: \n " ) ;
NET_PrintAddresses ( cls . sockets ) ;
Con_Printf ( " end of list \n " ) ;
}
# endif
2013-06-29 16:01:07 +00:00
2018-12-28 00:04:36 +00:00
qboolean NET_WasSpecialPacket ( ftenet_connections_t * collection )
2013-06-29 16:01:07 +00:00
{
2017-05-18 10:24:09 +00:00
# ifdef HAVE_NATPMP
if ( NET_Was_NATPMP ( collection ) )
return true ;
# endif
2013-11-21 23:02:28 +00:00
# ifdef SUPPORT_ICE
2018-12-28 00:04:36 +00:00
if ( ICE_WasStun ( collection ) )
2013-11-21 23:02:28 +00:00
return true ;
# endif
2017-05-18 10:24:09 +00:00
2013-06-29 16:01:07 +00:00
return false ;
}
2014-02-07 08:38:40 +00:00
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
//static void QDECL NET_UPNPIGP_Callback(cvar_t *var, char *oldval)
//{
//}
//cvar_t net_upnpigp = CVARCD("net_upnpigp", "0", NET_UPNPIGP_Callback, "If set, enables the use of the upnp-igd protocol to punch holes in your local NAT box.");
2014-02-07 08:38:40 +00:00
2014-12-25 20:10:05 +00:00
void SSL_Init ( void ) ;
2013-11-21 23:02:28 +00:00
/*
= = = = = = = = = = = = = = = = = = = =
NET_Init
= = = = = = = = = = = = = = = = = = = =
*/
void NET_Init ( void )
2013-06-29 16:01:07 +00:00
{
2015-06-05 03:45:01 +00:00
Cvar_Register ( & net_enabled , " networking " ) ;
2019-02-16 19:09:07 +00:00
Cvar_Register ( & net_dns_ipv4 , " networking " ) ;
Cvar_Register ( & net_dns_ipv6 , " networking " ) ;
2015-06-06 08:15:23 +00:00
if ( net_enabled . ival )
2015-06-05 03:45:01 +00:00
{
2014-03-30 08:55:06 +00:00
# if defined(_WIN32) && defined(HAVE_PACKET)
2015-06-05 03:45:01 +00:00
int r ;
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2015-06-05 03:45:01 +00:00
dllfunction_t fncs [ ] =
{
{ ( void * * ) & pgetaddrinfo , " getaddrinfo " } ,
{ ( void * * ) & pfreeaddrinfo , " freeaddrinfo " } ,
2019-07-19 02:13:19 +00:00
{ ( void * * ) & pgetnameinfo , " getnameinfo " } ,
2015-06-05 03:45:01 +00:00
{ NULL , NULL }
} ;
Sys_LoadLibrary ( " ws2_32.dll " , fncs ) ;
2013-06-29 16:01:07 +00:00
# endif
2015-06-05 03:45:01 +00:00
r = WSAStartup ( MAKEWORD ( 2 , 2 ) , & winsockdata ) ;
2013-06-29 16:01:07 +00:00
2015-06-05 03:45:01 +00:00
if ( r )
Sys_Error ( " Winsock initialization failed. " ) ;
2013-11-21 23:02:28 +00:00
# endif
2015-06-05 03:45:01 +00:00
}
2013-06-29 16:01:07 +00:00
2018-10-23 07:09:06 +00:00
Cvar_Register ( & timeout , " networking " ) ;
2013-11-21 23:02:28 +00:00
Cvar_Register ( & net_hybriddualstack , " networking " ) ;
Cvar_Register ( & net_fakeloss , " networking " ) ;
2013-06-23 02:17:02 +00:00
2018-12-28 00:04:36 +00:00
# if defined(TCPCONNECT) && (defined(HAVE_SERVER) || defined(HAVE_HTTPSV))
# ifdef HAVE_SERVER
Cvar_Register ( & net_enable_qizmo , " networking " ) ;
Cvar_Register ( & net_enable_qtv , " networking " ) ;
# endif
# if defined(HAVE_SSL)
Cvar_Register ( & net_enable_tls , " networking " ) ;
2019-06-05 20:48:06 +00:00
Cvar_Register ( & tls_ignorecertificateerrors , " networking " ) ;
2018-12-28 00:04:36 +00:00
# endif
2019-05-23 15:11:32 +00:00
# ifdef HAVE_HTTPSV
2018-12-28 00:04:36 +00:00
Cvar_Register ( & net_enable_http , " networking " ) ;
Cvar_Register ( & net_enable_websockets , " networking " ) ;
Cvar_Register ( & net_enable_webrtcbroker , " networking " ) ;
# endif
2019-05-23 15:11:32 +00:00
# endif
2018-12-28 00:04:36 +00:00
# ifdef HAVE_SERVER
2013-11-21 23:02:28 +00:00
Cmd_AddCommand ( " sv_addport " , SVNET_AddPort_f ) ;
2013-06-29 16:01:07 +00:00
# endif
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2017-12-28 16:24:50 +00:00
Cvar_Register ( & cl_delay_packets , " networking " ) ;
2013-11-21 23:02:28 +00:00
Cmd_AddCommand ( " cl_addport " , NET_ClientPort_f ) ;
2013-06-23 02:17:02 +00:00
# endif
2014-02-07 08:38:40 +00:00
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
// Cvar_Register (&net_upnpigp, "networking");
// net_upnpigp.restriction = RESTRICT_MAX;
2014-12-23 15:26:42 +00:00
2015-06-06 08:26:40 +00:00
//
// init the message buffer
//
net_message . maxsize = sizeof ( net_message_buffer ) ;
net_message . data = net_message_buffer ;
2014-12-25 20:10:05 +00:00
# if defined(HAVE_WINSSPI)
SSL_Init ( ) ;
# endif
2018-12-28 00:04:36 +00:00
# if defined(HAVE_CLIENT)||defined(HAVE_SERVER)
2014-12-23 15:26:42 +00:00
Net_Master_Init ( ) ;
2018-12-28 00:04:36 +00:00
# endif
2013-11-21 23:02:28 +00:00
}
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2017-05-18 10:24:09 +00:00
void NET_CloseClient ( void )
{ //called by disconnect console command
FTENET_CloseCollection ( cls . sockets ) ;
cls . sockets = NULL ;
}
2015-06-05 03:45:01 +00:00
void NET_InitClient ( qboolean loopbackonly )
2013-11-21 23:02:28 +00:00
{
const char * port ;
int p ;
2014-06-02 16:50:40 +00:00
# ifdef QUAKESPYAPI
2013-11-21 23:02:28 +00:00
port = STRINGIFY ( PORT_QWCLIENT ) ;
2014-06-02 16:50:40 +00:00
# else
port = " 0 " ;
# endif
2013-06-29 16:01:07 +00:00
2013-11-21 23:02:28 +00:00
p = COM_CheckParm ( " -clport " ) ;
if ( p & & p < com_argc )
2013-06-23 02:17:02 +00:00
{
2013-11-21 23:02:28 +00:00
port = com_argv [ p + 1 ] ;
2005-11-30 01:20:53 +00:00
}
2015-06-05 03:45:01 +00:00
if ( ! cls . sockets )
cls . sockets = FTENET_CreateCollection ( false ) ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_SERVER
2017-06-21 01:24:25 +00:00
FTENET_AddToCollection ( cls . sockets , " CLLoopback " , " 1 " , NA_LOOPBACK , NP_DGRAM ) ;
2004-08-21 01:25:48 +00:00
# endif
2015-06-05 03:45:01 +00:00
if ( loopbackonly )
port = " " ;
2017-05-22 05:12:01 +00:00
# if defined(HAVE_IPV4) && defined(HAVE_IPV6)
if ( net_hybriddualstack . ival )
{
2017-06-21 01:24:25 +00:00
FTENET_AddToCollection ( cls . sockets , " CLUDP " , port , NA_IP , NP_DGRAM ) ;
2017-05-22 05:12:01 +00:00
}
else
2008-12-01 02:10:35 +00:00
# endif
2017-05-22 05:12:01 +00:00
{
# ifdef HAVE_IPV4
2017-06-21 01:24:25 +00:00
FTENET_AddToCollection ( cls . sockets , " CLUDP4 " , port , NA_IP , NP_DGRAM ) ;
2017-05-22 05:12:01 +00:00
# endif
# ifdef HAVE_IPV6
2017-06-21 01:24:25 +00:00
FTENET_AddToCollection ( cls . sockets , " CLUDP6 " , port , NA_IPV6 , NP_DGRAM ) ;
2017-05-22 05:12:01 +00:00
# endif
}
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2017-06-21 01:24:25 +00:00
FTENET_AddToCollection ( cls . sockets , " CLIPX " , port , NA_IPX , NP_DGRAM ) ;
2008-11-13 08:55:41 +00:00
# endif
2004-08-21 01:25:48 +00:00
2015-06-06 08:26:40 +00:00
// Con_TPrintf("Client port Initialized\n");
2004-08-21 01:25:48 +00:00
}
# endif
2008-11-09 22:29:28 +00:00
2018-12-28 00:04:36 +00:00
# ifdef HAVE_SERVER
2012-04-09 19:12:12 +00:00
# ifdef HAVE_IPV4
2018-10-11 10:31:23 +00:00
static void QDECL SV_Tcpport_Callback ( struct cvar_s * var , char * oldvalue )
2004-08-21 01:25:48 +00:00
{
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
if ( ! strcmp ( var - > string , " 0 " ) ) //qtv_streamport had an old default value of 0. make sure we don't end up listening on random ports.
2017-06-21 01:24:25 +00:00
FTENET_AddToCollection ( svs . sockets , var - > name , " " , NA_IP , NP_STREAM ) ;
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
else
2017-06-21 01:24:25 +00:00
FTENET_AddToCollection ( svs . sockets , var - > name , var - > string , NA_IP , NP_STREAM ) ;
2008-11-09 22:29:28 +00:00
}
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
cvar_t sv_port_tcp = CVARFC ( " sv_port_tcp " , " " , CVAR_SERVERINFO , SV_Tcpport_Callback ) ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_LEGACY
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
cvar_t qtv_streamport = CVARAFCD ( " qtv_streamport " , " " ,
" mvd_streamport " , 0 , SV_Tcpport_Callback , " Legacy cvar. Use sv_port_tcp instead. " ) ;
# endif
2012-04-09 19:12:12 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2018-10-11 10:31:23 +00:00
static void QDECL SV_Tcpport6_Callback ( struct cvar_s * var , char * oldvalue )
2008-11-09 22:29:28 +00:00
{
2017-06-21 01:24:25 +00:00
FTENET_AddToCollection ( svs . sockets , var - > name , var - > string , NA_IPV6 , NP_STREAM ) ;
2008-11-09 22:29:28 +00:00
}
2013-03-31 04:21:08 +00:00
cvar_t sv_port_tcp6 = CVARC ( " sv_port_tcp6 " , " " , SV_Tcpport6_Callback ) ;
2008-12-03 07:36:38 +00:00
# endif
2012-04-09 19:12:12 +00:00
# ifdef HAVE_IPV4
2018-10-11 10:31:23 +00:00
static void QDECL SV_Port_Callback ( struct cvar_s * var , char * oldvalue )
2008-11-09 22:29:28 +00:00
{
2017-06-21 01:24:25 +00:00
FTENET_AddToCollection ( svs . sockets , var - > name , var - > string , NA_IP , NP_DGRAM ) ;
2008-11-09 22:29:28 +00:00
}
2018-04-07 12:33:06 +00:00
cvar_t sv_port_ipv4 = CVARC ( " sv_port " , STRINGIFY ( PORT_DEFAULTSERVER ) , SV_Port_Callback ) ;
2012-04-09 19:12:12 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2018-10-11 10:31:23 +00:00
static void QDECL SV_PortIPv6_Callback ( struct cvar_s * var , char * oldvalue )
2008-11-09 22:29:28 +00:00
{
2017-06-21 01:24:25 +00:00
FTENET_AddToCollection ( svs . sockets , var - > name , var - > string , NA_IPV6 , NP_DGRAM ) ;
2008-11-09 22:29:28 +00:00
}
2015-06-16 23:53:58 +00:00
cvar_t sv_port_ipv6 = CVARCD ( " sv_port_ipv6 " , " " , SV_PortIPv6_Callback , " Port to use for incoming ipv6 udp connections. Due to hybrid sockets this might not be needed. You can specify an ipv4 address:port for a second ipv4 port if you want. " ) ;
2005-05-19 02:40:18 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2015-04-21 04:12:00 +00:00
void QDECL SV_PortIPX_Callback ( struct cvar_s * var , char * oldvalue )
2008-11-09 22:29:28 +00:00
{
2017-06-21 01:24:25 +00:00
FTENET_AddToCollection ( svs . sockets , var - > name , var - > string , NA_IPX , NP_DGRAM ) ;
2013-03-31 04:21:08 +00:00
}
cvar_t sv_port_ipx = CVARC ( " sv_port_ipx " , " " , SV_PortIPX_Callback ) ;
# endif
2018-10-17 00:43:04 +00:00
# ifdef UNIXSOCKETS
2018-09-23 19:35:24 +00:00
void QDECL SV_PortUNIX_Callback ( struct cvar_s * var , char * oldvalue )
{
FTENET_AddToCollection ( svs . sockets , var - > name , var - > string , NA_UNIX , NP_DGRAM ) ;
}
2019-02-16 19:09:07 +00:00
# ifdef __linux //linux adds abstract sockets, which require no filesystem cleanup.
cvar_t sv_port_unix = CVARC ( " sv_port_unix " , " @qsock.fte " , SV_PortUNIX_Callback ) ;
# else
cvar_t sv_port_unix = CVARC ( " sv_port_unix " , " /tmp/qsock.fte " , SV_PortUNIX_Callback ) ;
# endif
2018-09-23 19:35:24 +00:00
# endif
2013-03-31 04:21:08 +00:00
# ifdef HAVE_NATPMP
2018-10-11 10:31:23 +00:00
static void QDECL SV_Port_NatPMP_Callback ( struct cvar_s * var , char * oldvalue )
2013-03-31 04:21:08 +00:00
{
2017-06-21 01:24:25 +00:00
FTENET_AddToCollection ( svs . sockets , var - > name , va ( " natpmp://%s " , var - > string ) , NA_IP , NP_NATPMP ) ;
2008-11-09 22:29:28 +00:00
}
2013-05-03 04:28:08 +00:00
# if 1 //def SERVERONLY
2013-03-31 04:21:08 +00:00
# define NATPMP_DEFAULT_PORT "" //don't fuck with dedicated servers
# else
# define NATPMP_DEFAULT_PORT "5351" //home users, yay, lucky people.
# endif
cvar_t sv_port_natpmp = CVARCD ( " sv_port_natpmp " , NATPMP_DEFAULT_PORT , SV_Port_NatPMP_Callback , " If set (typically to 5351), automatically configures your router's port forwarding. You can instead specify the full ip address of your router (192.168.1.1:5351 for example). Your router must have NAT-PMP supported and enabled. " ) ;
# 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
# ifdef FTE_TARGET_WEB
void QDECL SV_PortRTC_Callback ( struct cvar_s * var , char * oldvalue )
{
2017-06-23 20:36:35 +00:00
FTENET_AddToCollection ( svs . sockets , var - > name , var - > string , NA_WEBSOCKET , NP_DTLS ) ;
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
}
cvar_t sv_port_rtc = CVARCD ( " sv_port_rtc " , " / " , SV_PortRTC_Callback , " This specifies the broker url to use to obtain clients from. If the hostname is ommitted, it'll come from the manifest. If omitted, the broker service will randomize the resource part, so be sure to tell your friends the path reported by eg status rather than just this cvar value. Or just set it to 'rtc:///example' and tell clients to connect to the same sservevalue. " ) ;
# endif
2013-03-31 04:21:08 +00:00
void SVNET_RegisterCvars ( void )
{
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
# ifdef FTE_TARGET_WEB
Cvar_Register ( & sv_port_rtc , " networking " ) ;
// sv_port_rtc.restriction = RESTRICT_MAX;
# endif
2013-03-31 04:21:08 +00:00
# if defined(TCPCONNECT) && defined(HAVE_IPV4)
Cvar_Register ( & sv_port_tcp , " networking " ) ;
sv_port_tcp . restriction = RESTRICT_MAX ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_LEGACY
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
Cvar_Register ( & qtv_streamport , " networking " ) ;
qtv_streamport . restriction = RESTRICT_MAX ;
# endif
2013-03-31 04:21:08 +00:00
# endif
2018-09-23 19:35:24 +00:00
# if defined(TCPCONNECT) && defined(HAVE_IPV6)
2013-03-31 04:21:08 +00:00
Cvar_Register ( & sv_port_tcp6 , " networking " ) ;
sv_port_tcp6 . restriction = RESTRICT_MAX ;
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2013-03-31 04:21:08 +00:00
Cvar_Register ( & sv_port_ipv6 , " networking " ) ;
sv_port_ipv6 . restriction = RESTRICT_MAX ;
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2013-03-31 04:21:08 +00:00
Cvar_Register ( & sv_port_ipx , " networking " ) ;
sv_port_ipx . restriction = RESTRICT_MAX ;
# endif
# ifdef HAVE_IPV4
Cvar_Register ( & sv_port_ipv4 , " networking " ) ;
sv_port_ipv4 . restriction = RESTRICT_MAX ;
# endif
# ifdef HAVE_NATPMP
Cvar_Register ( & sv_port_natpmp , " networking " ) ;
sv_port_natpmp . restriction = RESTRICT_MAX ;
# endif
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
// Cvar_Register (&sv_port_unix, "networking");
# endif
2017-05-18 10:24:09 +00:00
2018-12-28 00:04:36 +00:00
# if defined(HAVE_DTLS) && defined(HAVE_SERVER)
2018-03-24 04:02:09 +00:00
Cvar_Register ( & net_enable_dtls , " networking " ) ;
# endif
2013-03-31 04:21:08 +00:00
}
2004-08-21 01:25:48 +00:00
2008-11-09 22:29:28 +00:00
void NET_CloseServer ( void )
{
FTENET_CloseCollection ( svs . sockets ) ;
svs . sockets = NULL ;
2004-08-21 01:25:48 +00:00
}
void NET_InitServer ( void )
{
2018-09-23 19:35:24 +00:00
qboolean singleplayer = ( sv . allocated_client_slots = = 1 ) & & ! isDedicated ;
if ( ( sv_listen_nq . value | | sv_listen_dp . value | | sv_listen_qw . value
2017-05-18 10:24:09 +00:00
# ifdef QWOVERQ3
| | sv_listen_q3 . ival
# endif
2018-09-23 19:35:24 +00:00
) & & ! singleplayer )
2004-08-21 01:25:48 +00:00
{
2010-07-18 08:42:59 +00:00
if ( ! svs . sockets )
{
svs . sockets = FTENET_CreateCollection ( true ) ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2018-04-07 12:33:06 +00:00
FTENET_AddToCollection ( svs . sockets , " SVLoopback " , STRINGIFY ( PORT_DEFAULTSERVER ) , NA_LOOPBACK , NP_DGRAM ) ;
2013-03-31 04:21:08 +00:00
# endif
2010-07-18 08:42:59 +00:00
}
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
# ifdef FTE_TARGET_WEB
Cvar_ForceCallback ( & sv_port_rtc ) ;
# endif
2012-04-09 19:12:12 +00:00
# ifdef HAVE_IPV4
2011-10-27 16:16:29 +00:00
Cvar_ForceCallback ( & sv_port_ipv4 ) ;
2012-04-09 19:12:12 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2006-05-09 00:02:05 +00:00
Cvar_ForceCallback ( & sv_port_ipv6 ) ;
2004-08-21 01:25:48 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPX
2006-05-09 00:02:05 +00:00
Cvar_ForceCallback ( & sv_port_ipx ) ;
2008-11-09 22:29:28 +00:00
# endif
2013-04-04 08:08:49 +00:00
# if defined(TCPCONNECT) && defined(HAVE_TCP)
2008-11-09 22:29:28 +00:00
Cvar_ForceCallback ( & sv_port_tcp ) ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_LEGACY
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
Cvar_ForceCallback ( & qtv_streamport ) ;
# endif
2018-09-23 19:35:24 +00:00
# ifdef HAVE_IPV6
2008-11-09 22:29:28 +00:00
Cvar_ForceCallback ( & sv_port_tcp6 ) ;
# endif
2013-03-31 04:21:08 +00:00
# endif
# ifdef HAVE_NATPMP
Cvar_ForceCallback ( & sv_port_natpmp ) ;
2018-03-24 04:02:09 +00:00
# endif
2018-09-23 19:35:24 +00:00
# ifdef UNIXSOCKETS
// Cvar_ForceCallback(&sv_port_unix);
# endif
2018-03-24 04:02:09 +00:00
# ifdef HAVE_DTLS
Cvar_ForceCallback ( & net_enable_dtls ) ;
2004-08-21 01:25:48 +00:00
# endif
}
else
2010-07-18 08:42:59 +00:00
{
2004-08-21 01:25:48 +00:00
NET_CloseServer ( ) ;
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2010-07-18 08:42:59 +00:00
svs . sockets = FTENET_CreateCollection ( true ) ;
2018-04-07 12:33:06 +00:00
FTENET_AddToCollection ( svs . sockets , " SVLoopback " , STRINGIFY ( PORT_DEFAULTSERVER ) , NA_LOOPBACK , NP_DGRAM ) ;
2010-07-18 08:42:59 +00:00
# endif
}
2004-08-21 01:25:48 +00:00
}
# endif
2013-06-29 16:01:07 +00:00
void NET_Tick ( void )
{
# ifdef SUPPORT_ICE
ICE_Tick ( ) ;
# endif
}
2004-08-21 01:25:48 +00:00
/*
= = = = = = = = = = = = = = = = = = = =
NET_Shutdown
= = = = = = = = = = = = = = = = = = = =
*/
void NET_Shutdown ( void )
{
2018-12-28 00:04:36 +00:00
# ifdef HAVE_SERVER
2004-08-21 01:25:48 +00:00
NET_CloseServer ( ) ;
# endif
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
2008-11-09 22:29:28 +00:00
FTENET_CloseCollection ( cls . sockets ) ;
cls . sockets = NULL ;
2004-08-21 01:25:48 +00:00
# endif
2008-11-09 22:29:28 +00:00
2014-03-30 08:55:06 +00:00
# if defined(_WIN32) && defined(HAVE_PACKET)
2004-08-21 01:25:48 +00:00
# ifdef SERVERTONLY
if ( ! serverthreadID ) //running as subsystem of client. Don't close all of it's sockets too.
# endif
WSACleanup ( ) ;
# endif
}
2006-03-14 01:25:46 +00:00
2012-04-09 19:12:12 +00:00
# ifdef HAVE_TCP
2006-03-14 01:25:46 +00:00
typedef struct {
vfsfile_t funcs ;
2013-06-23 02:17:02 +00:00
SOCKET sock ;
qboolean conpending ;
2006-03-14 01:25:46 +00:00
char readbuffer [ 65536 ] ;
int readbuffered ;
2013-06-29 16:01:07 +00:00
char peer [ 1 ] ;
2006-03-14 01:25:46 +00:00
} tcpfile_t ;
2018-10-11 10:31:23 +00:00
static void VFSTCP_Error ( tcpfile_t * f )
2006-03-14 01:25:46 +00:00
{
if ( f - > sock ! = INVALID_SOCKET )
{
closesocket ( f - > sock ) ;
f - > sock = INVALID_SOCKET ;
}
}
2013-05-03 04:28:08 +00:00
int QDECL VFSTCP_ReadBytes ( struct vfsfile_s * file , void * buffer , int bytestoread )
2006-03-14 01:25:46 +00:00
{
tcpfile_t * tf = ( tcpfile_t * ) file ;
int len ;
2007-12-01 05:55:44 +00:00
int trying ;
2006-03-14 01:25:46 +00:00
2013-06-23 02:17:02 +00:00
if ( tf - > conpending )
{
2013-06-29 16:01:07 +00:00
fd_set wr ;
fd_set ex ;
2013-06-23 02:17:02 +00:00
struct timeval timeout ;
timeout . tv_sec = 0 ;
timeout . tv_usec = 0 ;
2013-06-29 16:01:07 +00:00
FD_ZERO ( & wr ) ;
FD_SET ( tf - > sock , & wr ) ;
FD_ZERO ( & ex ) ;
FD_SET ( tf - > sock , & ex ) ;
if ( ! select ( ( int ) tf - > sock + 1 , NULL , & wr , & ex , & timeout ) )
2013-06-23 02:17:02 +00:00
return 0 ;
tf - > conpending = false ;
}
2006-03-14 01:25:46 +00:00
if ( tf - > sock ! = INVALID_SOCKET )
{
2007-12-01 05:55:44 +00:00
trying = sizeof ( tf - > readbuffer ) - tf - > readbuffered ;
2015-04-14 23:12:17 +00:00
if ( bytestoread > 1500 )
{
if ( trying > bytestoread )
trying = bytestoread ;
}
else
{
if ( trying > 1500 )
trying = 1500 ;
}
2007-12-01 05:55:44 +00:00
len = recv ( tf - > sock , tf - > readbuffer + tf - > readbuffered , trying , 0 ) ;
2006-03-14 01:25:46 +00:00
if ( len = = - 1 )
{
2014-02-07 08:38:40 +00:00
int e = neterrno ( ) ;
if ( e ! = NET_EWOULDBLOCK )
2013-03-31 04:21:08 +00:00
{
switch ( e )
{
2014-02-07 08:38:40 +00:00
case NET_ENOTCONN :
2013-06-29 16:01:07 +00:00
Con_Printf ( " connection to \" %s \" failed \n " , tf - > peer ) ;
break ;
2014-02-07 08:38:40 +00:00
case NET_ECONNABORTED :
2013-06-29 16:01:07 +00:00
Con_DPrintf ( " connection to \" %s \" aborted \n " , tf - > peer ) ;
2013-03-31 04:21:08 +00:00
break ;
2016-07-12 00:40:13 +00:00
case NET_ETIMEDOUT :
Con_Printf ( " connection to \" %s \" timed out \n " , tf - > peer ) ;
break ;
2014-02-07 08:38:40 +00:00
case NET_ECONNREFUSED :
2013-06-29 16:01:07 +00:00
Con_DPrintf ( " connection to \" %s \" refused \n " , tf - > peer ) ;
2013-06-23 02:17:02 +00:00
break ;
2014-02-07 08:38:40 +00:00
case NET_ECONNRESET :
2013-06-29 16:01:07 +00:00
Con_DPrintf ( " connection to \" %s \" reset \n " , tf - > peer ) ;
2013-06-23 02:17:02 +00:00
break ;
2013-03-31 04:21:08 +00:00
default :
2013-11-21 23:02:28 +00:00
Con_Printf ( " tcp socket error %i (%s) \n " , e , tf - > peer ) ;
2013-03-31 04:21:08 +00:00
}
VFSTCP_Error ( tf ) ;
}
2006-03-14 01:25:46 +00:00
//fixme: figure out wouldblock or error
}
2007-12-01 05:55:44 +00:00
else if ( len = = 0 & & trying ! = 0 )
{
2013-03-31 04:21:08 +00:00
//peer disconnected
2006-03-14 01:25:46 +00:00
VFSTCP_Error ( tf ) ;
2007-12-01 05:55:44 +00:00
}
2006-03-14 01:25:46 +00:00
else
2007-12-01 05:55:44 +00:00
{
2006-03-14 01:25:46 +00:00
tf - > readbuffered + = len ;
2007-12-01 05:55:44 +00:00
}
2006-03-14 01:25:46 +00:00
}
2007-12-01 05:55:44 +00:00
//return a partially filled buffer.
if ( bytestoread > tf - > readbuffered )
bytestoread = tf - > readbuffered ;
if ( bytestoread < 0 )
2007-12-03 11:08:56 +00:00
VFSTCP_Error ( tf ) ;
2007-12-01 05:55:44 +00:00
if ( bytestoread > 0 )
2006-03-14 01:25:46 +00:00
{
memcpy ( buffer , tf - > readbuffer , bytestoread ) ;
tf - > readbuffered - = bytestoread ;
memmove ( tf - > readbuffer , tf - > readbuffer + bytestoread , tf - > readbuffered ) ;
return bytestoread ;
}
else
2007-12-01 05:55:44 +00:00
{
if ( tf - > sock = = INVALID_SOCKET )
2013-06-24 09:04:00 +00:00
{
2007-12-01 05:55:44 +00:00
return - 1 ; //signal an error
2013-06-24 09:04:00 +00:00
}
2007-12-01 05:55:44 +00:00
return 0 ; //signal nothing available
}
2006-03-14 01:25:46 +00:00
}
2013-05-03 04:28:08 +00:00
int QDECL VFSTCP_WriteBytes ( struct vfsfile_s * file , const void * buffer , int bytestoread )
2006-03-14 01:25:46 +00:00
{
tcpfile_t * tf = ( tcpfile_t * ) file ;
int len ;
if ( tf - > sock = = INVALID_SOCKET )
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
return - 1 ;
2006-03-14 01:25:46 +00:00
2013-06-23 02:17:02 +00:00
if ( tf - > conpending )
{
2018-08-04 19:00:19 +00:00
fd_set fdw , fdx ;
2013-06-23 02:17:02 +00:00
struct timeval timeout ;
timeout . tv_sec = 0 ;
timeout . tv_usec = 0 ;
2018-08-04 19:00:19 +00:00
FD_ZERO ( & fdw ) ;
FD_SET ( tf - > sock , & fdw ) ;
FD_ZERO ( & fdx ) ;
FD_SET ( tf - > sock , & fdx ) ;
if ( ! select ( ( int ) tf - > sock + 1 , NULL , & fdw , & fdx , & timeout ) )
2013-06-23 02:17:02 +00:00
return 0 ;
tf - > conpending = false ;
}
2006-03-14 01:25:46 +00:00
len = send ( tf - > sock , buffer , bytestoread , 0 ) ;
if ( len = = - 1 | | len = = 0 )
{
2014-02-07 08:38:40 +00:00
int e = neterrno ( ) ;
2013-06-23 02:17:02 +00:00
switch ( e )
{
2014-02-07 08:38:40 +00:00
case NET_EWOULDBLOCK :
2013-11-21 23:02:28 +00:00
return 0 ; //nothing available yet.
2016-07-12 00:40:13 +00:00
case NET_ETIMEDOUT :
Con_Printf ( " connection to \" %s \" timed out \n " , tf - > peer ) ;
return - 1 ; //don't bother trying to read if we never connected.
2014-02-07 08:38:40 +00:00
case NET_ENOTCONN :
2019-05-10 09:31:21 +00:00
# ifdef __unix__
case EPIPE :
# endif
2013-11-21 23:02:28 +00:00
Con_Printf ( " connection to \" %s \" failed \n " , tf - > peer ) ;
2015-04-14 23:12:17 +00:00
return - 1 ; //don't bother trying to read if we never connected.
2013-06-23 02:17:02 +00:00
default :
2013-11-21 23:02:28 +00:00
Sys_Printf ( " tcp socket error %i (%s) \n " , e , tf - > peer ) ;
2013-06-23 02:17:02 +00:00
break ;
}
2013-03-31 04:21:08 +00:00
// don't destroy it on write errors, because that prevents us from reading anything that was sent to us afterwards.
// instead let the read handling kill it if there's nothing new to be read
VFSTCP_ReadBytes ( file , NULL , 0 ) ;
2013-11-21 23:02:28 +00:00
return - 1 ;
2006-03-14 01:25:46 +00:00
}
return len ;
}
2014-02-07 08:38:40 +00:00
qboolean QDECL VFSTCP_Seek ( struct vfsfile_s * file , qofs_t pos )
2006-03-14 01:25:46 +00:00
{
VFSTCP_Error ( ( tcpfile_t * ) file ) ;
return false ;
}
2018-10-11 10:31:23 +00:00
static qofs_t QDECL VFSTCP_Tell ( struct vfsfile_s * file )
2006-03-14 01:25:46 +00:00
{
VFSTCP_Error ( ( tcpfile_t * ) file ) ;
return 0 ;
}
2018-10-11 10:31:23 +00:00
static qofs_t QDECL VFSTCP_GetLen ( struct vfsfile_s * file )
2006-03-14 01:25:46 +00:00
{
return 0 ;
}
2018-10-11 10:31:23 +00:00
static qboolean QDECL VFSTCP_Close ( struct vfsfile_s * file )
2006-03-14 01:25:46 +00:00
{
2014-03-30 08:55:06 +00:00
tcpfile_t * f = ( tcpfile_t * ) file ;
qboolean success = f - > sock ! = INVALID_SOCKET ;
VFSTCP_Error ( f ) ;
Z_Free ( f ) ;
return success ;
2006-03-14 01:25:46 +00:00
}
2014-03-30 08:55:06 +00:00
vfsfile_t * FS_OpenTCPSocket ( SOCKET sock , qboolean conpending , const char * peername )
2006-03-14 01:25:46 +00:00
{
tcpfile_t * newf ;
2014-03-30 08:55:06 +00:00
if ( sock = = INVALID_SOCKET )
return NULL ;
newf = Z_Malloc ( sizeof ( * newf ) + strlen ( peername ) ) ;
strcpy ( newf - > peer , peername ) ;
newf - > conpending = conpending ;
newf - > sock = sock ;
newf - > funcs . Close = VFSTCP_Close ;
newf - > funcs . Flush = NULL ;
newf - > funcs . GetLen = VFSTCP_GetLen ;
newf - > funcs . ReadBytes = VFSTCP_ReadBytes ;
newf - > funcs . Seek = VFSTCP_Seek ;
newf - > funcs . Tell = VFSTCP_Tell ;
newf - > funcs . WriteBytes = VFSTCP_WriteBytes ;
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
newf - > funcs . seekstyle = SS_UNSEEKABLE ;
2014-03-30 08:55:06 +00:00
return & newf - > funcs ;
}
vfsfile_t * FS_OpenTCP ( const char * name , int defaultport )
{
2006-03-23 19:22:12 +00:00
netadr_t adr = { 0 } ;
2013-03-31 04:21:08 +00:00
if ( NET_StringToAdr ( name , defaultport , & adr ) )
2006-03-23 19:22:12 +00:00
{
2014-03-30 08:55:06 +00:00
return FS_OpenTCPSocket ( TCP_OpenStream ( & adr ) , true , name ) ;
2006-03-23 19:22:12 +00:00
}
else
2006-03-14 01:25:46 +00:00
return NULL ;
}
2012-04-24 07:59:11 +00:00
# elif 0 //defined(HAVE_WEBSOCKCL)
This code is disabled .
2012-07-14 17:25:21 +00:00
I cannot provide a reliable mechanism over chrome / nacls websockets at this time .
2012-04-24 07:59:11 +00:00
Some module within the ppapi / nacl / chrome stack refuses to forward the data when stressed .
All I can determine is that the connection has a gap .
Hopefully this should be fixed by pepper_19 .
2012-07-14 17:25:21 +00:00
As far as Im aware , this and the relevent code in QTV should be functionally complete .
2012-04-24 07:59:11 +00:00
typedef struct
{
vfsfile_t funcs ;
PP_Resource sock ;
unsigned char readbuffer [ 65536 ] ;
int readbuffered ;
qboolean havepacket ;
struct PP_Var incomingpacket ;
qboolean failed ;
} tcpfile_t ;
static void tcp_websocketgot ( void * user_data , int32_t result )
{
tcpfile_t * wsc = user_data ;
if ( result = = PP_OK )
{
if ( wsc - > incomingpacket . type = = PP_VARTYPE_UNDEFINED )
{
Con_Printf ( " ERROR: %s: var was not set by PPAPI. Data has been lost. \n " , __func__ ) ;
wsc - > failed = true ;
}
wsc - > havepacket = true ;
}
else
{
Sys_Printf ( " %s: %i \n " , __func__ , result ) ;
wsc - > failed = true ;
}
}
static void tcp_websocketconnected ( void * user_data , int32_t result )
{
tcpfile_t * wsc = user_data ;
if ( result = = PP_OK )
{
int res ;
//we got a successful connection, enable reception.
struct PP_CompletionCallback ccb = { tcp_websocketgot , wsc , PP_COMPLETIONCALLBACK_FLAG_NONE } ;
res = ppb_websocket_interface - > ReceiveMessage ( wsc - > sock , & wsc - > incomingpacket , ccb ) ;
if ( res ! = PP_OK_COMPLETIONPENDING )
tcp_websocketgot ( wsc , res ) ;
}
else
{
Sys_Printf ( " %s: %i \n " , __func__ , result ) ;
//some sort of error connecting, make it timeout now
wsc - > failed = true ;
}
}
static void tcp_websocketclosed ( void * user_data , int32_t result )
{
tcpfile_t * wsc = user_data ;
wsc - > failed = true ;
if ( wsc - > havepacket )
{
wsc - > havepacket = false ;
ppb_var_interface - > Release ( wsc - > incomingpacket ) ;
}
ppb_core - > ReleaseResource ( wsc - > sock ) ;
wsc - > sock = 0 ;
// Z_Free(wsc);
}
void VFSTCP_Close ( struct vfsfile_s * file )
{
/*meant to free the memory too, in this case we get the callback to do it*/
tcpfile_t * wsc = ( void * ) file ;
struct PP_CompletionCallback ccb = { tcp_websocketclosed , wsc , PP_COMPLETIONCALLBACK_FLAG_NONE } ;
ppb_websocket_interface - > Close ( wsc - > sock , PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE , PP_MakeUndefined ( ) , ccb ) ;
}
int VFSTCP_ReadBytes ( struct vfsfile_s * file , void * buffer , int bytestoread )
{
tcpfile_t * wsc = ( void * ) file ;
int res ;
if ( wsc - > havepacket & & wsc - > readbuffered < bytestoread + 1024 )
{
if ( wsc - > incomingpacket . type = = PP_VARTYPE_UNDEFINED )
Con_Printf ( " PPAPI bug: var is still undefined after being received \n " ) ;
else
{
int len = 0 ;
unsigned char * utf8 = ( unsigned char * ) ppb_var_interface - > VarToUtf8 ( wsc - > incomingpacket , & len ) ;
unsigned char * out = ( unsigned char * ) wsc - > readbuffer + wsc - > readbuffered ;
wsc - > havepacket = false ;
Con_Printf ( " Len: %i \n " , len ) ;
while ( len & & out < wsc - > readbuffer + sizeof ( wsc - > readbuffer ) )
{
if ( ( * utf8 & 0xe0 ) = = 0xc0 & & len > 1 )
{
* out = ( ( utf8 [ 0 ] & 0x1f ) < < 6 ) | ( ( utf8 [ 1 ] & 0x3f ) < < 0 ) ;
utf8 + = 2 ;
len - = 2 ;
}
else if ( * utf8 & 0x80 )
{
* out = ' ? ' ;
utf8 + + ;
len - = 1 ;
}
else
{
* out = utf8 [ 0 ] ;
utf8 + + ;
len - = 1 ;
}
out + + ;
}
if ( len )
{
Con_Printf ( " oh noes! buffer not big enough! \n " ) ;
wsc - > failed = true ;
}
Con_Printf ( " Old: %i \n " , wsc - > readbuffered ) ;
wsc - > readbuffered = out - wsc - > readbuffer ;
Con_Printf ( " New: %i \n " , wsc - > readbuffered ) ;
ppb_var_interface - > Release ( wsc - > incomingpacket ) ;
wsc - > incomingpacket = PP_MakeUndefined ( ) ;
}
if ( ! wsc - > failed )
{
//get the next one
struct PP_CompletionCallback ccb = { tcp_websocketgot , wsc , PP_COMPLETIONCALLBACK_FLAG_NONE } ;
res = ppb_websocket_interface - > ReceiveMessage ( wsc - > sock , & wsc - > incomingpacket , ccb ) ;
if ( res ! = PP_OK_COMPLETIONPENDING )
tcp_websocketgot ( wsc , res ) ;
}
}
if ( wsc - > readbuffered )
{
// Con_Printf("Reading %i bytes of %i\n", bytestoread, wsc->readbuffered);
if ( bytestoread > wsc - > readbuffered )
bytestoread = wsc - > readbuffered ;
memcpy ( buffer , wsc - > readbuffer , bytestoread ) ;
memmove ( wsc - > readbuffer , wsc - > readbuffer + bytestoread , wsc - > readbuffered - bytestoread ) ;
wsc - > readbuffered - = bytestoread ;
}
else if ( wsc - > failed )
bytestoread = - 1 ; /*signal eof*/
else
bytestoread = 0 ;
return bytestoread ;
}
int VFSTCP_WriteBytes ( struct vfsfile_s * file , const void * buffer , int bytestowrite )
{
tcpfile_t * wsc = ( void * ) file ;
int res ;
int outchars = 0 ;
unsigned char outdata [ bytestowrite * 2 + 1 ] ;
unsigned char * out = outdata ;
const unsigned char * in = buffer ;
if ( wsc - > failed )
return 0 ;
for ( res = 0 ; res < bytestowrite ; res + + )
{
/*FIXME: do we need this code?*/
if ( ! * in )
{
* out + + = 0xc0 | ( 0x100 > > 6 ) ;
* out + + = 0x80 | ( 0x100 & 0x3f ) ;
}
else if ( * in > = 0x80 )
{
* out + + = 0xc0 | ( * in > > 6 ) ;
* out + + = 0x80 | ( * in & 0x3f ) ;
}
else
* out + + = * in ;
in + + ;
outchars + + ;
}
* out = 0 ;
struct PP_Var str = ppb_var_interface - > VarFromUtf8 ( outdata , out - outdata ) ;
res = ppb_websocket_interface - > SendMessage ( wsc - > sock , str ) ;
// Sys_Printf("FTENET_WebSocket_SendPacket: result %i\n", res);
ppb_var_interface - > Release ( str ) ;
if ( res = = PP_OK )
return bytestowrite ;
return 0 ;
}
qboolean VFSTCP_Seek ( struct vfsfile_s * file , unsigned long pos )
{
//no seeking allowed
tcpfile_t * wsc = ( void * ) file ;
Con_Printf ( " tcp seek? \n " ) ;
wsc - > failed = true ;
return false ;
}
unsigned long VFSTCP_Tell ( struct vfsfile_s * file )
{
//no telling allowed
tcpfile_t * wsc = ( void * ) file ;
Con_Printf ( " tcp tell? \n " ) ;
wsc - > failed = true ;
return 0 ;
}
unsigned long VFSTCP_GetLen ( struct vfsfile_s * file )
{
return 0 ;
}
/*nacl websockets implementation...*/
2013-03-31 04:21:08 +00:00
vfsfile_t * FS_OpenTCP ( const char * name , int defaultport )
2012-04-24 07:59:11 +00:00
{
tcpfile_t * newf ;
netadr_t adr ;
if ( ! ppb_websocket_interface )
{
return NULL ;
}
2013-03-31 04:21:08 +00:00
if ( ! NET_StringToAdr ( name , defaultport , & adr ) )
2012-04-24 07:59:11 +00:00
return NULL ; //couldn't resolve the name
newf = Z_Malloc ( sizeof ( * newf ) ) ;
if ( newf )
{
struct PP_CompletionCallback ccb = { tcp_websocketconnected , newf , PP_COMPLETIONCALLBACK_FLAG_NONE } ;
newf - > sock = ppb_websocket_interface - > Create ( pp_instance ) ;
struct PP_Var str = ppb_var_interface - > VarFromUtf8 ( adr . address . websocketurl , strlen ( adr . address . websocketurl ) ) ;
ppb_websocket_interface - > Connect ( newf - > sock , str , NULL , 0 , ccb ) ;
ppb_var_interface - > Release ( str ) ;
newf - > funcs . Close = VFSTCP_Close ;
newf - > funcs . Flush = NULL ;
newf - > funcs . GetLen = VFSTCP_GetLen ;
newf - > funcs . ReadBytes = VFSTCP_ReadBytes ;
newf - > funcs . Seek = VFSTCP_Seek ;
newf - > funcs . Tell = VFSTCP_Tell ;
newf - > funcs . WriteBytes = VFSTCP_WriteBytes ;
newf - > funcs . seekingisabadplan = true ;
return & newf - > funcs ;
}
return NULL ;
}
2012-04-09 19:12:12 +00:00
# else
2013-03-31 04:21:08 +00:00
vfsfile_t * FS_OpenTCP ( const char * name , int defaultport )
2012-04-09 19:12:12 +00:00
{
return NULL ;
}
# endif