2022-07-25 14:48:59 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2022-11-02 17:29:43 +08:00
|
|
|
#include "common/thread.h"
|
2022-07-25 14:48:59 +02:00
|
|
|
#include "util/FFstrbuf.h"
|
|
|
|
|
|
2022-10-14 16:39:48 +08:00
|
|
|
#ifdef _WIN32
|
2022-11-02 01:03:01 +08:00
|
|
|
#include <minwindef.h>
|
2022-10-12 19:35:23 +08:00
|
|
|
#endif
|
|
|
|
|
|
2022-11-02 01:03:01 +08:00
|
|
|
typedef struct FFNetworkingState {
|
|
|
|
|
#ifdef _WIN32
|
2022-11-02 17:29:43 +08:00
|
|
|
uintptr_t sockfd;
|
|
|
|
|
OVERLAPPED overlapped;
|
2022-11-02 01:03:01 +08:00
|
|
|
#else
|
2022-11-02 17:29:43 +08:00
|
|
|
int sockfd;
|
|
|
|
|
FFstrbuf host;
|
|
|
|
|
FFstrbuf command;
|
|
|
|
|
|
|
|
|
|
#ifdef FF_HAVE_THREADS
|
|
|
|
|
FFThreadType thread;
|
|
|
|
|
#endif
|
2022-11-02 01:03:01 +08:00
|
|
|
#endif
|
|
|
|
|
} FFNetworkingState;
|
|
|
|
|
|
2024-03-20 13:52:39 +08:00
|
|
|
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers);
|
|
|
|
|
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer, uint32_t timeout);
|