Open Lighting Architecture  0.10.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TransportHeader.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  * TransportHeader.h
17  * Interface for the TransportHeader class.
18  * This holds the source IP of the packet which is used to address replies
19  * correctly. At some point in the future we should try to abtract the
20  * transport protocol (IP/UDP in this case).
21  * Copyright (C) 2011 Simon Newton
22  */
23 
24 #ifndef LIBS_ACN_TRANSPORTHEADER_H_
25 #define LIBS_ACN_TRANSPORTHEADER_H_
26 
28 
29 namespace ola {
30 namespace acn {
31 
32 /*
33  * The header for the transport layer
34  */
36  public:
37  enum TransportType {
38  TCP,
39  UDP,
40  UNDEFINED,
41  };
42 
43  TransportHeader() : m_transport_type(UNDEFINED) {}
45  TransportType type)
46  : m_source(source),
47  m_transport_type(type) {}
48 
49  ~TransportHeader() {}
50  const ola::network::IPV4SocketAddress& Source() const { return m_source; }
51  TransportType Transport() const { return m_transport_type; }
52 
53  bool operator==(const TransportHeader &other) const {
54  return (m_source == other.m_source &&
55  m_transport_type == other.m_transport_type);
56  }
57 
58  void operator=(const TransportHeader &other) {
59  m_source = other.m_source;
60  m_transport_type = other.m_transport_type;
61  }
62 
63  private:
65  TransportType m_transport_type;
66 };
67 } // namespace acn
68 } // namespace ola
69 #endif // LIBS_ACN_TRANSPORTHEADER_H_
Definition: TransportHeader.h:35
Represents Socket Addresses.
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
An IPv4 SocketAddress.
Definition: SocketAddress.h:77