blob: 4725d2a2dafd399df1980bae5567d880f2b96606 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/*
* Adapted from
* MP3/MPlayer plugin to VDR (C++)
* (C) 2001,2002 Stefan Huelswitt <huels@iname.com>
*/
#ifndef ___NETWORK_H
#define ___NETWORK_H
#include <thread.h>
#include <ringbuffer.h>
#include <config.h>
class cRingBufferLinear;
// ----------------------------------------------------------------
class mgNet:public cRingBufferLinear, cThread
{
private:
int m_fd;
bool m_connected, m_netup;
int m_deferedErrno;
int m_rwTimeout, m_conTimeout;
unsigned char m_lineBuff[4096];
int m_count;
//
void close (void);
int ringRead (unsigned char *dest, int len);
void copyFromBuff (unsigned char *dest, int n);
protected:
virtual void action (void);
public:
mgNet (int size, int ConTimeoutMs, int RwTimeoutMs);
~mgNet ();
bool connect (const char *hostname, const int port);
void disconnect (void);
bool connected (void)
{
return m_connected;
}
int gets (char *dest, int len);
int puts (char *dest);
int read (unsigned char *dest, int len);
int write (unsigned char *dest, int len);
};
#endif //___NETWORK_H
|