Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
UDPTransport.h
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU Library General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15 *
16 * UDPTransport.h
17 * Interface for the UDPTransport class
18 * Copyright (C) 2007 Simon Newton
19 */
20
21#ifndef LIBS_ACN_UDPTRANSPORT_H_
22#define LIBS_ACN_UDPTRANSPORT_H_
23
24#include "ola/acn/ACNPort.h"
26#include "ola/network/Socket.h"
27#include "libs/acn/PDU.h"
28#include "libs/acn/PreamblePacker.h"
29#include "libs/acn/Transport.h"
30
31namespace ola {
32namespace acn {
33
34/*
35 * The OutgoingUDPTransport is a small shim that provides the options to
36 * UDPTransportImpl.
37 */
39 public:
41 const ola::network::IPV4Address &destination,
42 uint16_t port = ola::acn::ACN_PORT)
43 : m_impl(impl),
44 m_destination(destination, port) {
45 }
47
48 bool Send(const PDUBlock<PDU> &pdu_block);
49
50 private:
51 class OutgoingUDPTransportImpl *m_impl;
53
56};
57
58
63 public:
65 PreamblePacker *packer = NULL)
66 : m_socket(socket),
67 m_packer(packer),
68 m_free_packer(false) {
69 if (!m_packer) {
70 m_packer = new PreamblePacker();
71 m_free_packer = true;
72 }
73 }
75 if (m_free_packer)
76 delete m_packer;
77 }
78
79 bool Send(const PDUBlock<PDU> &pdu_block,
80 const ola::network::IPV4SocketAddress &destination);
81
82 private:
84 PreamblePacker *m_packer;
85 bool m_free_packer;
86};
87
88
95 public:
97 class BaseInflator *inflator);
99 if (m_recv_buffer)
100 delete[] m_recv_buffer;
101 }
102
103 void Receive();
104
105 private:
106 ola::network::UDPSocket *m_socket;
107 class BaseInflator *m_inflator;
108 uint8_t *m_recv_buffer;
109};
110} // namespace acn
111} // namespace ola
112#endif // LIBS_ACN_UDPTRANSPORT_H_
The TCP / UDP Ports used for transporting ACN.
Represents an IPv4 Address.
Definition BaseInflator.h:63
Definition UDPTransport.h:94
Definition Transport.h:37
Definition UDPTransport.h:38
Definition UDPTransport.h:62
Definition PDU.h:103
Definition PreamblePacker.h:35
Represents a IPv4 Address.
Definition IPV4Address.h:55
An IPv4 SocketAddress.
Definition SocketAddress.h:78
Definition Socket.h:239
const uint16_t ACN_PORT
The port used for E1.31 & SDT communication.
Definition ACNPort.h:57
The namespace containing all OLA symbols.
Definition Credentials.cpp:44