kodi
PltDatagramStream.h
Go to the documentation of this file.
1 /*****************************************************************
2 |
3 | Platinum - Datagram Stream
4 |
5 | Copyright (c) 2004-2010, Plutinosoft, LLC.
6 | All rights reserved.
7 | http://www.plutinosoft.com
8 |
9 | This program is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU General Public License
11 | as published by the Free Software Foundation; either version 2
12 | of the License, or (at your option) any later version.
13 |
14 | OEMs, ISVs, VARs and other distributors that combine and
15 | distribute commercially licensed software with Platinum software
16 | and do not wish to distribute the source code for the commercially
17 | licensed software under version 2, or (at your option) any later
18 | version, of the GNU General Public License (the "GPL") must enter
19 | into a commercial license agreement with Plutinosoft, LLC.
20 | licensing@plutinosoft.com
21 |
22 | This program is distributed in the hope that it will be useful,
23 | but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | GNU General Public License for more details.
26 |
27 | You should have received a copy of the GNU General Public License
28 | along with this program; see the file LICENSE.txt. If not, write to
29 | the Free Software Foundation, Inc.,
30 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 | http://www.gnu.org/licenses/gpl-2.0.html
32 |
33 ****************************************************************/
34 
39 #ifndef _PLT_DATAGRAM_H_
40 #define _PLT_DATAGRAM_H_
41 
42 /*----------------------------------------------------------------------
43 | includes
44 +---------------------------------------------------------------------*/
45 #include "Neptune.h"
46 
47 /*----------------------------------------------------------------------
48 | PLT_InputDatagramStream
49 +---------------------------------------------------------------------*/
56 {
57 public:
58  // methods
60  NPT_Size buffer_size = 2000);
61  ~PLT_InputDatagramStream() override;
62 
63  NPT_Result GetInfo(NPT_SocketInfo& info);
64 
65  // NPT_InputStream methods
66  NPT_Result Read(void* buffer,
67  NPT_Size bytes_to_read,
68  NPT_Size* bytes_read = 0) override;
69 
70  NPT_Result Seek(NPT_Position offset) override { NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
71  NPT_Result Skip(NPT_Size offset) override { NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
72  NPT_Result Tell(NPT_Position& offset) override{ NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
73  NPT_Result GetSize(NPT_LargeSize& size) override { NPT_COMPILER_UNUSED(size); return NPT_FAILURE; }
74  NPT_Result GetAvailable(NPT_LargeSize& available) override { NPT_COMPILER_UNUSED(available); return NPT_FAILURE; }
75 
76 protected:
77  NPT_UdpSocket* m_Socket;
78  NPT_SocketInfo m_Info;
79  NPT_DataBuffer m_Buffer;
80  NPT_Position m_BufferOffset;
81 };
82 
84 
85 /*----------------------------------------------------------------------
86 | PLT_OutputDatagramStream
87 +---------------------------------------------------------------------*/
94 {
95 public:
96  // methods
98  NPT_Size size = 4096,
99  const NPT_SocketAddress* address = NULL);
100  ~PLT_OutputDatagramStream() override;
101 
102  // NPT_OutputStream methods
103  NPT_Result Write(const void* buffer, NPT_Size bytes_to_write, NPT_Size* bytes_written = NULL) override;
104  NPT_Result Flush() override;
105 
106  NPT_Result Seek(NPT_Position offset) override { NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
107  NPT_Result Tell(NPT_Position& offset) override { NPT_COMPILER_UNUSED(offset); return NPT_FAILURE; }
108 
109 protected:
110  NPT_UdpSocket* m_Socket;
111  NPT_DataBuffer m_Buffer;
112  NPT_SocketAddress* m_Address;
113 };
114 
116 
117 #endif /* _PLT_DATAGRAM_H_ */
Definition: NptStreams.h:60
Definition: NptSockets.h:77
Definition: NptStreams.h:92
The PLT_InputDatagramStream class is a simple buffered input stream used when reading SSDP packets on...
Definition: PltDatagramStream.h:55
Definition: NptSockets.h:115
Definition: NptDataBuffer.h:44
Definition: NptSockets.h:243
The PLT_OutputDatagramStream class is a simple buffered output stream used when writing SSDP packets ...
Definition: PltDatagramStream.h:93