diff options
| author | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
|---|---|---|
| committer | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
| commit | 76424950e373d3b04ac3dd13019151bfba3e8423 (patch) | |
| tree | 4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/common/networking.h | |
Add the files
Diffstat (limited to 'src/common/networking.h')
| -rw-r--r-- | src/common/networking.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/common/networking.h b/src/common/networking.h new file mode 100644 index 0000000..2554e22 --- /dev/null +++ b/src/common/networking.h @@ -0,0 +1,38 @@ +#pragma once + +#include "common/thread.h" +#include "common/FFstrbuf.h" + +#ifdef _WIN32 + #include <minwindef.h> +#endif + +struct addrinfo; + +typedef struct FFNetworkingState { +#ifdef _WIN32 + uintptr_t sockfd; + OVERLAPPED overlapped; +#else + int sockfd; + struct addrinfo* addr; + + #ifdef FF_HAVE_THREADS + FFThreadType thread; + #endif +#endif + + FFstrbuf command; + uint32_t timeout; + bool ipv6; + bool compression; // if true, HTTP content compression will be enabled if supported + bool tfo; // if true, TCP Fast Open will be attempted first, and fallback to traditional connection if it fails +} FFNetworkingState; + +const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers); +const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer); + +#ifdef FF_HAVE_ZLIB +const char* ffNetworkingLoadZlibLibrary(void); +bool ffNetworkingDecompressGzip(FFstrbuf* buffer, char* headerEnd); +#endif |