Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  *
16  * PathportPackets.h
17  * Datagram definitions for libpathport
18  * Copyright (C) 2006-2009 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>
26 #include "ola/network/IPV4Address.h"
27 
28 namespace ola {
29 namespace plugin {
30 namespace pathport {
31 
32 
33 /*
34  * Pathport opcodes
35  */
36 enum pathport_packet_type_e {
37  PATHPORT_DATA = 0x0100,
38  PATHPORT_PATCH = 0x0200,
39  PATHPORT_PATCHREP = 0x0210,
40  PATHPORT_GET = 0x0222,
41  PATHPORT_GET_REPLY = 0x0223,
42  PATHPORT_ARP_REQUEST = 0x0301,
43  PATHPORT_ARP_REPLY = 0x0302,
44  PATHPORT_SET = 0x0400,
45 }__attribute__((packed));
46 
47 typedef enum pathport_packet_type_e pathport_packet_type_t;
48 
49 
50 /*
51  * Pathport xDmx
52  */
54  uint16_t type;
55  uint16_t channel_count;
56  uint8_t universe; // not used, set to 0
57  uint8_t start_code;
58  uint16_t offset;
59  uint8_t data[0];
60 }__attribute__((packed));
61 
63 
64 
65 /*
66  * Pathport get request
67  */
69  uint16_t params[0];
70 } __attribute__((packed));
71 
73 
74 
75 /*
76  * Pathport get reply
77  */
79  uint8_t params[0];
80 } __attribute__((packed));
81 
83 
84 
86  uint16_t type;
87  uint16_t len;
88  uint8_t val[0];
89 };
91 
92 
93 /*
94  * Pathport arp reply
95  */
97  uint32_t id;
98  uint8_t ip[ola::network::IPV4Address::LENGTH];
99  uint8_t manufacturer_code; // manufacturer code
100  uint8_t device_class; // device class
101  uint8_t device_type; // device type
102  uint8_t component_count; // number of dmx components
103 }__attribute__((packed));
104 
106 
107 
109  uint16_t type; // pdu type
110  uint16_t len; // length
111 }__attribute__((packed));
112 
114 
115 /*
116  * PDU Header
117  */
119  pathport_pdu_header head;
120  union {
121  pathport_pdu_data data;
122  pathport_pdu_get get;
123  pathport_pdu_getrep getrep;
124  pathport_pdu_arp_reply arp_reply;
125  } d; // pdu data
126 }__attribute__((packed));
127 
129 
130 
131 /*
132  * A complete Pathport packet
133  */
135  uint16_t protocol;
136  uint8_t version_major;
137  uint8_t version_minor;
138  uint16_t sequence;
139  uint8_t reserved[6]; // set to 0
140  uint32_t source; // src id
141  uint32_t destination; // dst id
142 }__attribute__((packed));
143 
145 
146 
147 /*
148  * The complete pathport packet
149  */
151  pathport_packet_header header;
152  union {
153  uint8_t data[1480]; // 1500 - header size
155  } d;
156 }__attribute__((packed));
157 } // namespace pathport
158 } // namespace plugin
159 } // namespace ola
160 #endif // PLUGINS_PATHPORT_PATHPORTPACKETS_H_