3 Copyright (C) 2008 Everton da Silva Marques
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.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING; if not, write to the
17 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
25 #ifndef PIM_IGMP_JOIN_H
26 #define PIM_IGMP_JOIN_H
28 /* required headers #include'd by caller */
31 #define SOL_IP IPPROTO_IP
34 #ifndef MCAST_JOIN_SOURCE_GROUP
35 #define MCAST_JOIN_SOURCE_GROUP 46
36 struct group_source_req
38 uint32_t gsr_interface
;
39 struct sockaddr_storage gsr_group
;
40 struct sockaddr_storage gsr_source
;
44 static int pim_igmp_join_source(int fd
, ifindex_t ifindex
,
45 struct in_addr group_addr
,
46 struct in_addr source_addr
)
48 struct group_source_req req
;
49 struct sockaddr_in group
;
50 struct sockaddr_in source
;
52 memset(&group
, 0, sizeof(group
));
53 group
.sin_family
= AF_INET
;
54 group
.sin_addr
= group_addr
;
55 group
.sin_port
= htons(0);
56 memcpy(&req
.gsr_group
, &group
, sizeof(struct sockaddr_in
));
58 memset(&source
, 0, sizeof(source
));
59 source
.sin_family
= AF_INET
;
60 source
.sin_addr
= source_addr
;
61 source
.sin_port
= htons(0);
62 memcpy(&req
.gsr_source
, &source
, sizeof(struct sockaddr_in
));
64 req
.gsr_interface
= ifindex
;
66 return setsockopt(fd
, SOL_IP
, MCAST_JOIN_SOURCE_GROUP
,
72 #endif /* PIM_IGMP_JOIN_H */