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 along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 For msghdr.msg_control in Solaris 10
29 #ifndef __EXTENSIONS__
30 #define __EXTENSIONS__
34 #define PIM_MROUTE_MIN_TTL (1)
38 #include <netinet/in.h>
39 #if defined(HAVE_LINUX_MROUTE_H)
40 #include <linux/mroute.h>
42 #include "linux/mroute.h"
45 typedef struct vifctl pim_vifctl
;
46 typedef struct igmpmsg kernmsg
;
47 typedef struct sioc_sg_req pim_sioc_sg_req
;
49 #define vc_vifi vifc_vifi
50 #define vc_flags vifc_flags
51 #define vc_threshold vifc_threshold
52 #define vc_rate_limit vifc_rate_limit
53 #define vc_lcl_addr vifc_lcl_addr
54 #define vc_lcl_ifindex vifc_lcl_ifindex
55 #define vc_rmt_addr vifc_rmt_addr
57 #define msg_im_msgtype im_msgtype
58 #define msg_im_vif im_vif
59 #define msg_im_src im_src
60 #define msg_im_dst im_dst
62 #ifndef IGMPMSG_WRVIFWHOLE
63 #define IGMPMSG_WRVIFWHOLE 4 /* For PIM processing */
67 #define GMMSG_NOCACHE IGMPMSG_NOCACHE /* For PIM processing */
68 #define GMMSG_WHOLEPKT IGMPMSG_WHOLEPKT /* For PIM processing */
69 #define GMMSG_WRONGVIF IGMPMSG_WRONGVIF /* For PIM processing */
70 #define GMMSG_WRVIFWHOLE IGMPMSG_WRVIFWHOLE /* For PIM processing */
74 #define PIM_IPPROTO IPPROTO_IP
76 #ifndef PIM_SIOCGETSGCNT
77 #define PIM_SIOCGETSGCNT SIOCGETSGCNT
80 #else /* PIM_IPV != 4 */
82 #include <netinet/ip6.h>
84 #if defined(HAVE_LINUX_MROUTE6_H)
85 #include <linux/mroute6.h>
87 #include "linux/mroute6.h"
91 #define MRT_BASE MRT6_BASE
92 #define MRT_INIT MRT6_INIT
93 #define MRT_DONE MRT6_DONE
94 #define MRT_ADD_VIF MRT6_ADD_MIF
95 #define MRT_DEL_VIF MRT6_DEL_MIF
96 #define MRT_ADD_MFC MRT6_ADD_MFC
97 #define MRT_DEL_MFC MRT6_DEL_MFC
98 #define MRT_VERSION MRT6_VERSION
99 #define MRT_ASSERT MRT6_ASSERT
100 #define MRT_PIM MRT6_PIM
101 #define MRT_TABLE MRT6_TABLE
105 #define PIM_IPPROTO IPPROTO_IPV6
108 #ifndef PIM_SIOCGETSGCNT
109 #define PIM_SIOCGETSGCNT SIOCGETSGCNT_IN6
112 #ifndef MRT6MSG_WRMIFWHOLE
113 #define MRT6MSG_WRMIFWHOLE 4 /* For PIM processing */
116 #ifndef GMMSG_NOCACHE
117 #define GMMSG_NOCACHE MRT6MSG_NOCACHE /* For PIM processing */
118 #define GMMSG_WHOLEPKT MRT6MSG_WHOLEPKT /* For PIM processing */
119 #define GMMSG_WRONGVIF MRT6MSG_WRONGMIF /* For PIM processing */
120 #define GMMSG_WRVIFWHOLE MRT6MSG_WRMIFWHOLE /* For PIM processing */
123 typedef struct mif6ctl pim_vifctl
;
124 typedef struct mrt6msg kernmsg
;
125 typedef mifi_t vifi_t
;
126 typedef struct sioc_sg_req6 pim_sioc_sg_req
;
128 #define vc_vifi mif6c_mifi
129 #define vc_flags mif6c_flags
130 #define vc_threshold vifc_threshold
131 #define vc_pifi mif6c_pifi
132 #define vc_rate_limit vifc_rate_limit
134 #define msg_im_msgtype im6_msgtype
135 #define msg_im_vif im6_mif
136 #define msg_im_src im6_src
137 #define msg_im_dst im6_dst
140 #define MAXVIFS IF_SETSIZE
143 #define VIFF_REGISTER MIFF_REGISTER
148 Above: from <linux/mroute.h>
154 int pim_mroute_socket_enable(struct pim_instance
*pim
);
155 int pim_mroute_socket_disable(struct pim_instance
*pim
);
157 int pim_mroute_add_vif(struct interface
*ifp
, pim_addr ifaddr
,
158 unsigned char flags
);
159 int pim_mroute_del_vif(struct interface
*ifp
);
161 int pim_upstream_mroute_add(struct channel_oil
*c_oil
, const char *name
);
162 int pim_upstream_mroute_iif_update(struct channel_oil
*c_oil
, const char *name
);
163 int pim_static_mroute_add(struct channel_oil
*c_oil
, const char *name
);
164 void pim_static_mroute_iif_update(struct channel_oil
*c_oil
,
167 int pim_mroute_del(struct channel_oil
*c_oil
, const char *name
);
169 void pim_mroute_update_counters(struct channel_oil
*c_oil
);
170 bool pim_mroute_allow_iif_in_oil(struct channel_oil
*c_oil
,
172 int pim_mroute_msg(struct pim_instance
*pim
, const char *buf
, size_t buf_size
,
174 int pim_mroute_msg_nocache(int fd
, struct interface
*ifp
, const kernmsg
*msg
);
175 int pim_mroute_msg_wholepkt(int fd
, struct interface
*ifp
, const char *buf
,
177 int pim_mroute_msg_wrongvif(int fd
, struct interface
*ifp
, const kernmsg
*msg
);
178 int pim_mroute_msg_wrvifwhole(int fd
, struct interface
*ifp
, const char *buf
,
180 int pim_mroute_set(struct pim_instance
*pim
, int enable
);
181 #endif /* PIM_MROUTE_H */