Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
PathportPackets.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 * PathportPackets.h
17 * Datagram definitions for libpathport
18 * Copyright (C) 2006 Simon Newton
19 */
20
21#ifndef PLUGINS_PATHPORT_PATHPORTPACKETS_H_
22#define PLUGINS_PATHPORT_PATHPORTPACKETS_H_
23
24#include <sys/types.h>
25#include <stdint.h>
27
28namespace ola {
29namespace plugin {
30namespace pathport {
31
32
33/*
34 * Pathport opcodes
35 */
36// We can't use the PACK macro for enums
37#ifdef _WIN32
38#pragma pack(push, 1)
39#endif // _WIN32
40enum pathport_packet_type_e {
41 PATHPORT_DATA = 0x0100,
42 PATHPORT_PATCH = 0x0200,
43 PATHPORT_PATCHREP = 0x0210,
44 PATHPORT_GET = 0x0222,
45 PATHPORT_GET_REPLY = 0x0223,
46 PATHPORT_ARP_REQUEST = 0x0301,
47 PATHPORT_ARP_REPLY = 0x0302,
48 PATHPORT_SET = 0x0400,
49#ifdef _WIN32
50};
51#pragma pack(pop)
52#else
53} __attribute__((packed));
54#endif // _WIN32
55
56typedef enum pathport_packet_type_e pathport_packet_type_t;
57
58
59/*
60 * Pathport xDmx
61 */
62PACK(
63struct pathport_pdu_data_s {
64 uint16_t type;
65 uint16_t channel_count;
66 uint8_t universe; // not used, set to 0
67 uint8_t start_code;
68 uint16_t offset;
69 uint8_t data[0];
70});
71
72typedef struct pathport_pdu_data_s pathport_pdu_data;
73
74
75/*
76 * Pathport get request
77 */
78PACK(
79struct pathport_pdu_get_s {
80 uint16_t params[0];
81});
82
83typedef struct pathport_pdu_get_s pathport_pdu_get;
84
85
86/*
87 * Pathport get reply
88 */
89PACK(
90struct pathport_pdu_getrep_s {
91 uint8_t params[0];
92});
93
94typedef struct pathport_pdu_getrep_s pathport_pdu_getrep;
95
96
98 uint16_t type;
99 uint16_t len;
100 uint8_t val[0];
101};
103
104
105/*
106 * Pathport arp reply
107 */
108PACK(
109struct pathport_pdu_arp_reply_s {
110 uint32_t id;
111 uint8_t ip[ola::network::IPV4Address::LENGTH];
112 uint8_t manufacturer_code; // manufacturer code
113 uint8_t device_class; // device class
114 uint8_t device_type; // device type
115 uint8_t component_count; // number of dmx components
116});
117
118typedef struct pathport_pdu_arp_reply_s pathport_pdu_arp_reply;
119
120PACK(
121struct pathport_pdu_header_s {
122 uint16_t type; // pdu type
123 uint16_t len; // length
124});
125
126typedef struct pathport_pdu_header_s pathport_pdu_header;
127
128/*
129 * PDU Header
130 */
131PACK(
132struct pathport_packet_pdu_s {
133 pathport_pdu_header head;
134 union {
135 pathport_pdu_data data;
136 pathport_pdu_get get;
137 pathport_pdu_getrep getrep;
138 pathport_pdu_arp_reply arp_reply;
139 } d; // pdu data
140});
141
142typedef struct pathport_packet_pdu_s pathport_packet_pdu;
143
144
145/*
146 * A complete Pathport packet
147 */
148PACK(
149struct pathport_packet_header_s {
150 uint16_t protocol;
151 uint8_t version_major;
152 uint8_t version_minor;
153 uint16_t sequence;
154 uint8_t reserved[6]; // set to 0
155 uint32_t source; // src id
156 uint32_t destination; // dst id
157});
158
159typedef struct pathport_packet_header_s pathport_packet_header;
160
161
162/*
163 * The complete pathport packet
164 */
165PACK(
166struct pathport_packet_s {
167 pathport_packet_header header;
168 union {
169 uint8_t data[1480]; // 1500 - header size
170 pathport_packet_pdu pdu;
171 } d;
172});
173} // namespace pathport
174} // namespace plugin
175} // namespace ola
176#endif // PLUGINS_PATHPORT_PATHPORTPACKETS_H_
Represents an IPv4 Address.
#define PACK(__Declaration__)
Pack structures.
Definition Macro.h:171
The namespace containing all OLA symbols.
Definition Credentials.cpp:44