-
Notifications
You must be signed in to change notification settings - Fork 8
/
OhmSocket.h
76 lines (59 loc) · 1.64 KB
/
OhmSocket.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef HEADER_OHM_SOCKET
#define HEADER_OHM_SOCKET
#include <OpenHome/OhNetTypes.h>
#include <OpenHome/Buffer.h>
#include <OpenHome/Private/Stream.h>
#include <OpenHome/Private/Network.h>
#include "Ohm.h"
namespace OpenHome {
class Environment;
namespace Av {
class OhmSocket : public IReaderSource, public INonCopyable
{
static const TUint kSendBufBytes = 16392;
static const TUint kReceiveBufBytes = 16392;
public:
OhmSocket(Environment& aEnv);
void OpenUnicast(TIpAddress aInterface, TUint aTtl);
void OpenMulticast(TIpAddress aInterface, TUint aTtl, const Endpoint& aEndpoint);
Endpoint This() const;
Endpoint Sender() const;
void Send(const Brx& aBuffer, const Endpoint& aEndpoint);
void Close();
~OhmSocket();
public:
// IReaderSource
virtual void Read(Bwx& aBuffer);
virtual void ReadFlush();
virtual void ReadInterrupt();
private:
Environment& iEnv;
SocketUdpBase* iRxSocket;
SocketUdpBase* iTxSocket;
UdpReader* iReader;
Endpoint iThis;
};
class OhzSocket : public IReaderSource, public INonCopyable
{
static const TUint kSendBufBytes = 1024;
public:
OhzSocket(Environment& aEnv);
const Endpoint& This() const;
void Open(TIpAddress aInterface, TUint aTtl);
void Send(const Brx& aBuffer);
void Close();
// IReaderSource
virtual void Read(Bwx& aBuffer);
virtual void ReadFlush();
virtual void ReadInterrupt();
~OhzSocket();
private:
Environment& iEnv;
SocketUdpMulticast* iRxSocket;
SocketUdp* iTxSocket;
Endpoint iEndpoint;
UdpReader* iReader;
};
} // namespace Av
} // namespace OpenHome
#endif // HEADER_OHM_SOCKET