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