28 lines
718 B
C++
28 lines
718 B
C++
#pragma once
|
|
|
|
#include <netinet/in.h>
|
|
|
|
namespace ts {
|
|
namespace connection {
|
|
class RawUdpSocket {
|
|
public:
|
|
RawUdpSocket();
|
|
~RawUdpSocket();
|
|
|
|
bool setup(sockaddr_in*);
|
|
|
|
int read(char* buffer, size_t size);
|
|
int write(const char* buffer, size_t size);
|
|
uint16_t buildCheckSum(uint16_t* buffer, size_t size);
|
|
|
|
int getSocketDescriptor(){ return socketDescriptor; }
|
|
private:
|
|
int socketDescriptor;
|
|
sockaddr_in* remoteAdress = nullptr;
|
|
sockaddr_in* localAdress = nullptr;
|
|
};
|
|
|
|
|
|
typedef RawUdpSocket UdpSocket;
|
|
}
|
|
} |