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)
6
* Copyright (C) 2006 Stephane Este-Gracias (sestegra@free.fr)
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License, or (at your option) any later version.
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23
#ifndef _UCSI_DVB_TARGET_IP_SOURCE_SLASH_DESCRIPTOR
24
#define _UCSI_DVB_TARGET_IP_SOURCE_SLASH_DESCRIPTOR 1
31
#include <libucsi/descriptor.h>
32
#include <libucsi/types.h>
35
* dvb_target_ip_source_slash_descriptor structure.
37
struct dvb_target_ip_source_slash_descriptor {
40
/* struct dvb_ipv4_source_slash ipv4_source_slash[] */
44
* An entry in the ipv4_source_slash field of a dvb_target_ip_source_slash_descriptor.
46
struct dvb_ipv4_source_slash {
47
uint8_t ipv4_source_addr[4];
48
uint8_t ipv4_source_slash;
49
uint8_t ipv4_dest_addr[4];
50
uint8_t ipv4_dest_slash;
54
* Process a dvb_target_ip_source_slash_descriptor.
56
* @param d Generic descriptor structure pointer.
57
* @return dvb_target_ip_source_slash_descriptor pointer, or NULL on error.
59
static inline struct dvb_target_ip_source_slash_descriptor*
60
dvb_target_ip_source_slash_descriptor_codec(struct descriptor* d)
62
uint32_t len = d->len;
64
if (len % sizeof(struct dvb_ipv4_source_slash))
67
return (struct dvb_target_ip_source_slash_descriptor*) d;
71
* Iterator for entries in the ipv4_source_slash field of a dvb_target_ip_source_slash_descriptor.
73
* @param d dvb_target_ip_source_slash_descriptor pointer.
74
* @param pos Variable containing a pointer to the current dvb_ipv4_source_slash.
76
#define dvb_target_ip_source_slash_descriptor_ipv4_source_slash_for_each(d, pos) \
77
for ((pos) = dvb_target_ip_source_slash_descriptor_ipv4_source_slash_first(d); \
79
(pos) = dvb_target_ip_source_slash_descriptor_ipv4_source_slash_next(d, pos))
90
/******************************** PRIVATE CODE ********************************/
91
static inline struct dvb_ipv4_source_slash*
92
dvb_target_ip_source_slash_descriptor_ipv4_source_slash_first(struct dvb_target_ip_source_slash_descriptor *d)
97
return (struct dvb_ipv4_source_slash *)
98
((uint8_t*) d + sizeof(struct dvb_target_ip_source_slash_descriptor));
101
static inline struct dvb_ipv4_source_slash*
102
dvb_target_ip_source_slash_descriptor_ipv4_source_slash_next(struct dvb_target_ip_source_slash_descriptor *d,
103
struct dvb_ipv4_source_slash *pos)
105
uint8_t *end = (uint8_t*) d + 2 + d->d.len;
106
uint8_t *next = (uint8_t *) pos + sizeof(struct dvb_ipv4_source_slash);
111
return (struct dvb_ipv4_source_slash *) next;