1
0
mirror of https://github.com/rofafor/vdr-plugin-iptv.git synced 2023-10-10 13:37:03 +02:00
vdr-plugin-iptv/socket.h
2010-12-02 17:32:02 +02:00

57 lines
1.3 KiB
C++

/*
* protocoludp.h: IPTV plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
*/
#ifndef __IPTV_SOCKET_H
#define __IPTV_SOCKET_H
#include <arpa/inet.h>
class cIptvSocket {
protected:
int socketDesc;
int socketPort;
struct sockaddr_in sockAddr;
bool isActive;
protected:
bool OpenSocket(const int Port, const bool isUdp);
void CloseSocket(void);
public:
cIptvSocket();
virtual ~cIptvSocket();
};
class cIptvUdpSocket : public cIptvSocket {
private:
in_addr_t sourceAddr;
public:
cIptvUdpSocket();
virtual ~cIptvUdpSocket();
virtual int Read(unsigned char* BufferAddr, unsigned int BufferLen);
bool OpenSocket(const int Port, const in_addr_t SourceAddr = INADDR_ANY);
void CloseSocket(void);
bool JoinMulticast(const in_addr_t StreamAddr);
bool DropMulticast(const in_addr_t StreamAddr);
};
class cIptvTcpSocket : public cIptvSocket {
public:
cIptvTcpSocket();
virtual ~cIptvTcpSocket();
virtual int Read(unsigned char* BufferAddr, unsigned int BufferLen);
bool OpenSocket(const int Port, const char *StreamAddr);
void CloseSocket(void);
bool ConnectSocket(void);
bool ReadChar(char* BufferAddr, unsigned int TimeoutMs);
bool Write(const char* BufferAddr, unsigned int BufferLen);
};
#endif // __IPTV_SOCKET_H