1f08c3bdfSopenharmony_ci/******************************************************************************/
2f08c3bdfSopenharmony_ci/*                                                                            */
3f08c3bdfSopenharmony_ci/*   Copyright (c) International Business Machines  Corp., 2006               */
4f08c3bdfSopenharmony_ci/*                                                                            */
5f08c3bdfSopenharmony_ci/*   This program is free software;  you can redistribute it and/or modify    */
6f08c3bdfSopenharmony_ci/*   it under the terms of the GNU General Public License as published by     */
7f08c3bdfSopenharmony_ci/*   the Free Software Foundation; either version 2 of the License, or        */
8f08c3bdfSopenharmony_ci/*   (at your option) any later version.                                      */
9f08c3bdfSopenharmony_ci/*                                                                            */
10f08c3bdfSopenharmony_ci/*   This program is distributed in the hope that it will be useful,          */
11f08c3bdfSopenharmony_ci/*   but WITHOUT ANY WARRANTY;  without even the implied warranty of          */
12f08c3bdfSopenharmony_ci/*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See                */
13f08c3bdfSopenharmony_ci/*   the GNU General Public License for more details.                         */
14f08c3bdfSopenharmony_ci/*                                                                            */
15f08c3bdfSopenharmony_ci/*   You should have received a copy of the GNU General Public License        */
16f08c3bdfSopenharmony_ci/*   along with this program;  if not, write to the Free Software             */
17f08c3bdfSopenharmony_ci/*   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA  */
18f08c3bdfSopenharmony_ci/*                                                                            */
19f08c3bdfSopenharmony_ci/******************************************************************************/
20f08c3bdfSopenharmony_ci
21f08c3bdfSopenharmony_ci
22f08c3bdfSopenharmony_ci/*
23f08c3bdfSopenharmony_ci * File:
24f08c3bdfSopenharmony_ci *	ns-mcast.h
25f08c3bdfSopenharmony_ci *
26f08c3bdfSopenharmony_ci * Description:
27f08c3bdfSopenharmony_ci *	Header file for multicast test.
28f08c3bdfSopenharmony_ci *	This file specifies structures and macors if missing
29f08c3bdfSopenharmony_ci *
30f08c3bdfSopenharmony_ci * Author:
31f08c3bdfSopenharmony_ci *	Mitsuru Chinen <mitch@jp.ibm.com>
32f08c3bdfSopenharmony_ci *
33f08c3bdfSopenharmony_ci * History:
34f08c3bdfSopenharmony_ci *	Apr 21 2006 - Created (Mitsuru Chinen)
35f08c3bdfSopenharmony_ci *---------------------------------------------------------------------------*/
36f08c3bdfSopenharmony_ci
37f08c3bdfSopenharmony_ci#ifndef _NS_MCAST_H
38f08c3bdfSopenharmony_ci#define _NS_MCAST_H 1
39f08c3bdfSopenharmony_ci
40f08c3bdfSopenharmony_ci#include <netinet/in.h>
41f08c3bdfSopenharmony_ci#include <endian.h>
42f08c3bdfSopenharmony_ci
43f08c3bdfSopenharmony_ci
44f08c3bdfSopenharmony_ci#ifndef MLD_LISTENER_QUERY
45f08c3bdfSopenharmony_ci#  define MLD_LISTENER_QUERY          130
46f08c3bdfSopenharmony_ci#endif
47f08c3bdfSopenharmony_ci
48f08c3bdfSopenharmony_ci
49f08c3bdfSopenharmony_ci/* group_req */
50f08c3bdfSopenharmony_ci#ifndef MCAST_JOIN_GROUP
51f08c3bdfSopenharmony_ci# define MCAST_JOIN_GROUP		42
52f08c3bdfSopenharmony_ci# define MCAST_BLOCK_SOURCE		43
53f08c3bdfSopenharmony_ci# define MCAST_UNBLOCK_SOURCE		44
54f08c3bdfSopenharmony_ci# define MCAST_LEAVE_GROUP		45
55f08c3bdfSopenharmony_ci
56f08c3bdfSopenharmony_cistruct group_req
57f08c3bdfSopenharmony_ci{
58f08c3bdfSopenharmony_ci    uint32_t gr_interface;
59f08c3bdfSopenharmony_ci    struct sockaddr_storage gr_group;
60f08c3bdfSopenharmony_ci};
61f08c3bdfSopenharmony_ci
62f08c3bdfSopenharmony_ci#endif	/* MCAST_JOIN_GROUP */
63f08c3bdfSopenharmony_ci
64f08c3bdfSopenharmony_ci
65f08c3bdfSopenharmony_ci/* group_filter */
66f08c3bdfSopenharmony_ci#ifndef MCAST_MSFILTER
67f08c3bdfSopenharmony_ci# define MCAST_MSFILTER			48
68f08c3bdfSopenharmony_ci# define MCAST_EXCLUDE	0
69f08c3bdfSopenharmony_ci# define MCAST_INCLUDE	1
70f08c3bdfSopenharmony_ci
71f08c3bdfSopenharmony_cistruct group_filter
72f08c3bdfSopenharmony_ci{
73f08c3bdfSopenharmony_ci    uint32_t gf_interface;
74f08c3bdfSopenharmony_ci    struct sockaddr_storage gf_group;
75f08c3bdfSopenharmony_ci    uint32_t gf_fmode;
76f08c3bdfSopenharmony_ci    uint32_t gf_numsrc;
77f08c3bdfSopenharmony_ci    struct sockaddr_storage gf_slist[1];
78f08c3bdfSopenharmony_ci};
79f08c3bdfSopenharmony_ci
80f08c3bdfSopenharmony_ci#define GROUP_FILTER_SIZE(numsrc) \
81f08c3bdfSopenharmony_ci	(sizeof(struct group_filter) - sizeof(struct sockaddr_storage) \
82f08c3bdfSopenharmony_ci	+ (numsrc) * sizeof(struct sockaddr_storage))
83f08c3bdfSopenharmony_ci
84f08c3bdfSopenharmony_ci#endif	/* MCAST_MSFILTER */
85f08c3bdfSopenharmony_ci
86f08c3bdfSopenharmony_ci#ifndef IGMP_ALL_HOSTS
87f08c3bdfSopenharmony_ci# define IGMP_ALL_HOSTS		htonl(0xE0000001L)
88f08c3bdfSopenharmony_ci#endif
89f08c3bdfSopenharmony_ci
90f08c3bdfSopenharmony_ci#ifndef IGMPV3_HOST_MEMBERSHIP_REPORT
91f08c3bdfSopenharmony_cistruct igmpv3_query {
92f08c3bdfSopenharmony_ci    uint8_t type;
93f08c3bdfSopenharmony_ci    uint8_t code;
94f08c3bdfSopenharmony_ci    uint16_t csum;
95f08c3bdfSopenharmony_ci    uint32_t group;
96f08c3bdfSopenharmony_ci# if __BYTE_ORDER == __LITTLE_ENDIAN
97f08c3bdfSopenharmony_ci    uint8_t qrv:3;
98f08c3bdfSopenharmony_ci    uint8_t suppress:1;
99f08c3bdfSopenharmony_ci    uint8_t resv:4;
100f08c3bdfSopenharmony_ci# elif __BYTE_ORDER == __BIG_ENDIAN
101f08c3bdfSopenharmony_ci     uint8_t resv:4;
102f08c3bdfSopenharmony_ci     uint8_t suppress:1;
103f08c3bdfSopenharmony_ci     uint8_t qrv:3;
104f08c3bdfSopenharmony_ci# else
105f08c3bdfSopenharmony_ci#  error "Failed to detect endian"
106f08c3bdfSopenharmony_ci#endif
107f08c3bdfSopenharmony_ci    uint8_t qqic;
108f08c3bdfSopenharmony_ci    uint16_t nsrcs;
109f08c3bdfSopenharmony_ci    uint32_t srcs[0];
110f08c3bdfSopenharmony_ci};
111f08c3bdfSopenharmony_ci#endif	/* IGMPV3_HOST_MEMBERSHIP_REPORT */
112f08c3bdfSopenharmony_ci
113f08c3bdfSopenharmony_ci#endif	/* _NS_MCAST_H */
114