mirror of
https://github.com/danog/libtgvoip.git
synced 2024-12-11 16:49:52 +01:00
510a977ff0
Added device selection on Linux Bugfixes
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
//
|
|
// libtgvoip is free and unencumbered public domain software.
|
|
// For more information, see http://unlicense.org or the UNLICENSE file
|
|
// you should have received with this source code distribution.
|
|
//
|
|
|
|
#ifndef LIBTGVOIP_NETWORKSOCKETWINSOCK_H
|
|
#define LIBTGVOIP_NETWORKSOCKETWINSOCK_H
|
|
|
|
#include "../../NetworkSocket.h"
|
|
#include <stdint.h>
|
|
|
|
namespace tgvoip {
|
|
|
|
class NetworkSocketWinsock : public NetworkSocket{
|
|
public:
|
|
NetworkSocketWinsock();
|
|
virtual ~NetworkSocketWinsock();
|
|
virtual void Send(NetworkPacket* packet);
|
|
virtual void Receive(NetworkPacket* packet);
|
|
virtual void Open();
|
|
virtual void Close();
|
|
virtual std::string GetLocalInterfaceInfo(IPv4Address* v4addr, IPv6Address* v6addr);
|
|
virtual void OnActiveInterfaceChanged();
|
|
virtual uint16_t GetLocalPort();
|
|
|
|
static std::string V4AddressToString(uint32_t address);
|
|
static std::string V6AddressToString(unsigned char address[16]);
|
|
static uint32_t StringToV4Address(std::string address);
|
|
static void StringToV6Address(std::string address, unsigned char* out);
|
|
|
|
protected:
|
|
virtual void SetMaxPriority();
|
|
|
|
private:
|
|
uintptr_t fd;
|
|
bool needUpdateNat64Prefix;
|
|
bool nat64Present;
|
|
double switchToV6at;
|
|
bool isV4Available;
|
|
IPv4Address lastRecvdV4;
|
|
IPv6Address lastRecvdV6;
|
|
bool isAtLeastVista;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif //LIBTGVOIP_NETWORKSOCKETWINSOCK_H
|