#ifndef TRANSPORT_H
#define TRANSPORT_H

#include <winsock2.h> // For SOCKET

// Transport abstraction
typedef struct {
    void* handle; // Opaque pointer to underlying connection (WOLFSSL* or SOCKET or Schannel context)
    int (*send) (void* handle, char* data, size_t len);
    int (*recv) (void* handle, char* buffer, size_t len);
    int (*recv_alloc)(void* handle, char* buffer1, unsigned char** buffer2, size_t len1, size_t* len2);  // New function pointer, only for http transport
    void (*cleanup) (void* handle);
} Transport;

Transport* InitTransport(char* domain, unsigned short port);
void CleanupTransport(Transport* transport);
char* GetNextDomain();

#if USE_SCHANNEL
    extern Transport* InitSchannelTransport(char* domain, unsigned short port, char* sni_hostname);
#elif USE_HTTP
    extern Transport* InitHTTPTransport(char* domain, unsigned short port);
#else
    extern Transport* InitTCPTransport(char* domain, unsigned short port);
#endif

#endif // TRANSPORT_H