2
* section and descriptor parser
4
* Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
5
* Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22
#ifndef _UCSI_DVB_DATA_BROADCAST_ID_DESCRIPTOR
23
#define _UCSI_DVB_DATA_BROADCAST_ID_DESCRIPTOR 1
30
#include <libucsi/descriptor.h>
31
#include <libucsi/endianops.h>
34
* Possible values for data_broadcast_id.
37
DVB_BROADCAST_ID_DATA_PIPE = 0X0001,
38
DVB_BROADCAST_ID_ASYNCHRONOUS_DATA_STREAM = 0X0002,
39
DVB_BROADCAST_ID_SYNCHRONOUS_DATA_STREAM = 0X0003,
40
DVB_BROADCAST_ID_SYNCHRONISED_DATA_STREAM = 0X0004,
41
DVB_BROADCAST_ID_MULTI_PROTOCOL_ENCAPSULATION = 0X0005,
42
DVB_BROADCAST_ID_DATA_CAROUSEL = 0X0006,
43
DVB_BROADCAST_ID_OBJECT_CAROUSEL = 0X0007,
44
DVB_BROADCAST_ID_DVB_ATM_STREAMS = 0X0008,
45
DVB_BROADCAST_ID_HIGHER_PROTOCOLS = 0X0009,
46
DVB_BROADCAST_ID_SOFTWARE_UPDATE = 0x000A,
47
DVB_BROADCAST_ID_IP_MAC_NOTIFICATION_TABLE = 0x000B,
51
* dvb_data_broadcast_id_descriptor structure.
53
struct dvb_data_broadcast_id_descriptor {
56
uint16_t data_broadcast_id;
57
/* uint8_t id_selector_byte[] */
61
* id_selector_byte for 0x000b data_broadcast_id (IP/MAC Notification Table).
63
struct dvb_id_selector_byte_000b {
64
uint8_t platform_id_data_length;
65
/* struct dvb_ip_mac_notification_info infos[] */
66
/* uint8_t private_data[] */
70
* Entries in the infos field of a dvb_id_selector_byte_0b.
72
struct dvb_ip_mac_notification_info {
73
EBIT2(uint32_t platform_id : 24; ,
74
uint8_t action_type : 8; );
75
EBIT3(uint8_t reserved : 2; ,
76
uint8_t INT_versioning_flag : 1; ,
77
uint8_t INT_version : 5; );
81
* Process a dvb_data_broadcast_id_descriptor.
83
* @param d Generic descriptor structure.
84
* @return dvb_data_broadcast_id_descriptor pointer, or NULL on error.
86
static inline struct dvb_data_broadcast_id_descriptor*
87
dvb_data_broadcast_id_descriptor_codec(struct descriptor* d)
89
if (d->len < (sizeof(struct dvb_data_broadcast_id_descriptor) - 2))
92
bswap16((uint8_t*) d + 2);
94
return (struct dvb_data_broadcast_id_descriptor*) d;
98
* Accessor for the selector_byte field of a dvb_data_broadcast_id_descriptor.
100
* @param d dvb_data_broadcast_id_descriptor pointer.
101
* @return Pointer to the field.
103
static inline uint8_t *
104
dvb_data_broadcast_id_descriptor_id_selector_byte(struct dvb_data_broadcast_id_descriptor *d)
106
return (uint8_t *) d + sizeof(struct dvb_data_broadcast_id_descriptor);
110
* Determine the length of the selector_byte field of a dvb_data_broadcast_id_descriptor.
112
* @param d dvb_data_broadcast_id_descriptor pointer.
113
* @return Length of the field in bytes.
116
dvb_data_broadcast_id_descriptor_id_selector_byte_length(struct dvb_data_broadcast_id_descriptor *d)
122
* Accessor for a dvb_id_selector_byte_000b pointer.
124
* @param d dvb_data_broadcast_id_descriptor pointer.
125
* @return Pointer to the data field.
127
static inline struct dvb_id_selector_byte_000b *
128
dvb_id_selector_byte_000b(struct dvb_data_broadcast_id_descriptor *d)
130
if (d->data_broadcast_id != DVB_BROADCAST_ID_IP_MAC_NOTIFICATION_TABLE)
132
return (struct dvb_id_selector_byte_000b *) dvb_data_broadcast_id_descriptor_id_selector_byte(d);
136
* Iterator for the dvb_ip_mac_notification_info field of a dvb_id_selector_byte_000b.
138
* @param id_selector_byte dvb_id_selector_byte_000b pointer.
139
* @param pos Variable containing a pointer to the current dvb_ip_mac_notification_info.
141
#define dvb_id_selector_byte_000b_ip_mac_notification_info_for_each(id_selector_byte, pos) \
142
for ((pos) = dvb_ip_mac_notification_info_first(id_selector_byte); \
144
(pos) = dvb_ip_mac_notification_info_next(id_selector_byte, pos))
147
* Length of the private_data field of a dvb_id_selector_byte_000b.
149
* @param d descriptor pointer.
150
* @param i dvb_id_selector_byte_000b pointer.
151
* @return Length of the field.
153
static inline uint8_t
154
dvb_id_selector_byte_000b_private_data_length(struct descriptor *d,
155
struct dvb_id_selector_byte_000b *i)
157
return (uint8_t) (d->len -
158
sizeof(struct descriptor) -
159
i->platform_id_data_length -
160
sizeof(struct dvb_id_selector_byte_000b));
164
* Accessor for the private_data field of a dvb_id_selector_byte_000b.
166
* @param d descriptor pointer.
167
* @param i dvb_id_selector_byte_000b pointer.
168
* @return Pointer to the field.
170
static inline uint8_t *
171
dvb_id_selector_byte_000b_private_data(struct descriptor *d,
172
struct dvb_id_selector_byte_000b *i)
174
if (dvb_id_selector_byte_000b_private_data_length(d, i) <= 0)
177
return (uint8_t *) i + i->platform_id_data_length + sizeof(struct dvb_id_selector_byte_000b);
186
/******************************** PRIVATE CODE ********************************/
187
static inline struct dvb_ip_mac_notification_info *
188
dvb_ip_mac_notification_info_first(struct dvb_id_selector_byte_000b *d)
190
if (d->platform_id_data_length == 0)
193
bswap32((uint8_t *) d + sizeof(struct dvb_id_selector_byte_000b));
195
return (struct dvb_ip_mac_notification_info *) ((uint8_t *) d + sizeof(struct dvb_id_selector_byte_000b));
198
static inline struct dvb_ip_mac_notification_info *
199
dvb_ip_mac_notification_info_next(struct dvb_id_selector_byte_000b *d,
200
struct dvb_ip_mac_notification_info *pos)
202
uint8_t *end = (uint8_t *) d + d->platform_id_data_length;
203
uint8_t *next = (uint8_t *) pos +
204
sizeof(struct dvb_id_selector_byte_000b) +
205
sizeof(struct dvb_ip_mac_notification_info);
212
return (struct dvb_ip_mac_notification_info *) next;
221
#include <libucsi/dvb/mhp_data_broadcast_id_descriptor.h>