1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* PathportPackets.h
* Datagram definitions for libpathport
* Copyright (C) 2006 Simon Newton
*/
#ifndef PLUGINS_PATHPORT_PATHPORTPACKETS_H_
#define PLUGINS_PATHPORT_PATHPORTPACKETS_H_
#include <sys/types.h>
#include <stdint.h>
#include "ola/network/IPV4Address.h"
namespace ola {
namespace plugin {
namespace pathport {
/*
* Pathport opcodes
*/
// We can't use the PACK macro for enums
#ifdef _WIN32
#pragma pack(push, 1)
#endif // _WIN32
enum pathport_packet_type_e {
PATHPORT_DATA = 0x0100,
PATHPORT_PATCH = 0x0200,
PATHPORT_PATCHREP = 0x0210,
PATHPORT_GET = 0x0222,
PATHPORT_GET_REPLY = 0x0223,
PATHPORT_ARP_REQUEST = 0x0301,
PATHPORT_ARP_REPLY = 0x0302,
PATHPORT_SET = 0x0400,
#ifdef _WIN32
};
#pragma pack(pop)
#else
} __attribute__((packed));
#endif // _WIN32
typedef enum pathport_packet_type_e pathport_packet_type_t;
/*
* Pathport xDmx
*/
PACK(
struct pathport_pdu_data_s {
uint16_t type;
uint16_t channel_count;
uint8_t universe; // not used, set to 0
uint8_t start_code;
uint16_t offset;
uint8_t data[0];
});
typedef struct pathport_pdu_data_s pathport_pdu_data;
/*
* Pathport get request
*/
PACK(
struct pathport_pdu_get_s {
uint16_t params[0];
});
typedef struct pathport_pdu_get_s pathport_pdu_get;
/*
* Pathport get reply
*/
PACK(
struct pathport_pdu_getrep_s {
uint8_t params[0];
});
typedef struct pathport_pdu_getrep_s pathport_pdu_getrep;
struct pathport_pdu_getrep_alv_s {
uint16_t type;
uint16_t len;
uint8_t val[0];
};
typedef struct pathport_pdu_getrep_alv_s pathport_pdu_getrep_alv;
/*
* Pathport arp reply
*/
PACK(
struct pathport_pdu_arp_reply_s {
uint32_t id;
uint8_t ip[ola::network::IPV4Address::LENGTH];
uint8_t manufacturer_code; // manufacturer code
uint8_t device_class; // device class
uint8_t device_type; // device type
uint8_t component_count; // number of dmx components
});
typedef struct pathport_pdu_arp_reply_s pathport_pdu_arp_reply;
PACK(
struct pathport_pdu_header_s {
uint16_t type; // pdu type
uint16_t len; // length
});
typedef struct pathport_pdu_header_s pathport_pdu_header;
/*
* PDU Header
*/
PACK(
struct pathport_packet_pdu_s {
pathport_pdu_header head;
union {
pathport_pdu_data data;
pathport_pdu_get get;
pathport_pdu_getrep getrep;
pathport_pdu_arp_reply arp_reply;
} d; // pdu data
});
typedef struct pathport_packet_pdu_s pathport_packet_pdu;
/*
* A complete Pathport packet
*/
PACK(
struct pathport_packet_header_s {
uint16_t protocol;
uint8_t version_major;
uint8_t version_minor;
uint16_t sequence;
uint8_t reserved[6]; // set to 0
uint32_t source; // src id
uint32_t destination; // dst id
});
typedef struct pathport_packet_header_s pathport_packet_header;
/*
* The complete pathport packet
*/
PACK(
struct pathport_packet_s {
pathport_packet_header header;
union {
uint8_t data[1480]; // 1500 - header size
pathport_packet_pdu pdu;
} d;
});
} // namespace pathport
} // namespace plugin
} // namespace ola
#endif // PLUGINS_PATHPORT_PATHPORTPACKETS_H_
|