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

66 lines
1.5 KiB
C
Raw Normal View History

/*
* socket.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>
#ifdef __FreeBSD__
#include <netinet/in.h>
#endif // __FreeBSD__
class cIptvSocket {
private:
2013-02-23 16:12:46 +01:00
int socketPortM;
protected:
2013-02-23 16:12:46 +01:00
int socketDescM;
struct sockaddr_in sockAddrM;
bool isActiveM;
protected:
2013-02-23 16:12:46 +01:00
bool OpenSocket(const int portP, const bool isUdpP);
void CloseSocket(void);
2013-02-23 16:12:46 +01:00
bool CheckAddress(const char *addrP, in_addr_t *inAddrP);
public:
cIptvSocket();
virtual ~cIptvSocket();
};
class cIptvUdpSocket : public cIptvSocket {
private:
2013-02-23 16:12:46 +01:00
in_addr_t streamAddrM;
in_addr_t sourceAddrM;
bool useIGMPv3M;
public:
cIptvUdpSocket();
virtual ~cIptvUdpSocket();
2013-02-23 16:12:46 +01:00
virtual int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
bool OpenSocket(const int Port);
2013-02-23 16:12:46 +01:00
bool OpenSocket(const int Port, const char *streamAddrP, const char *sourceAddrP, bool useIGMPv3P);
void CloseSocket(void);
bool JoinMulticast(void);
bool DropMulticast(void);
};
class cIptvTcpSocket : public cIptvSocket {
public:
cIptvTcpSocket();
virtual ~cIptvTcpSocket();
2013-02-23 16:12:46 +01:00
virtual int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
bool OpenSocket(const int portP, const char *streamAddrP);
2010-09-15 22:41:25 +02:00
void CloseSocket(void);
bool ConnectSocket(void);
2013-02-23 16:12:46 +01:00
bool ReadChar(char* bufferAddrP, unsigned int timeoutMsP);
bool Write(const char* bufferAddrP, unsigned int bufferLenP);
};
#endif // __IPTV_SOCKET_H