1 /*
2  * The olsr.org Optimized Link-State Routing daemon (olsrd)
3  *
4  * (c) by the OLSR project
5  *
6  * See our Git repository to find out who worked on this file
7  * and thus is a copyright holder on it.
8  *
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  *
15  * * Redistributions of source code must retain the above copyright
16  *   notice, this list of conditions and the following disclaimer.
17  * * Redistributions in binary form must reproduce the above copyright
18  *   notice, this list of conditions and the following disclaimer in
19  *   the documentation and/or other materials provided with the
20  *   distribution.
21  * * Neither the name of olsr.org, olsrd nor the names of its
22  *   contributors may be used to endorse or promote products derived
23  *   from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  *
38  * Visit http://www.olsr.org for more information.
39  *
40  * If you find this software useful feel free to make a donation
41  * to the project. For more information see the website or contact
42  * the copyright holders.
43  *
44  */
45 
46 #ifndef _BMF_BMF_H
47 #define _BMF_BMF_H
48 
49 /* -------------------------------------------------------------------------
50  * File       : Bmf.h
51  * Description: Multicast forwarding functions
52  * Created    : 29 Jun 2006
53  *
54  * ------------------------------------------------------------------------- */
55 
56 #include "olsrd_plugin.h" /* union set_plugin_parameter_addon */
57 #include "interfaces.h"   /* enum olsr_ifchg_flag */
58 
59 /* BMF plugin data */
60 #define PLUGIN_NAME              "OLSRD bmf plugin"
61 #define PLUGIN_NAME_SHORT        "BMF"
62 #define PLUGIN_INTERFACE_VERSION 5
63 
64 /* UDP-Port on which multicast packets are encapsulated */
65 #define BMF_ENCAP_PORT 50698
66 
67 /* Forward declaration of OLSR interface type */
68 struct interface_olsr;
69 
70 extern int FanOutLimit;
71 extern int BroadcastRetransmitCount;
72 
73 void BMF_handle_captureFd(int skfd, void *data, unsigned int);
74 void BMF_handle_listeningFd(int skfd, void *data, unsigned int);
75 void BMF_handle_encapsulatingFd(int skfd, void *data, unsigned int);
76 void BMF_handle_tuntapFd(int, void*, unsigned int);
77 
78 void BmfPError(const char* format, ...) __attribute__((format(printf, 1, 2)));
79 union olsr_ip_addr* MainAddressOf(union olsr_ip_addr* ip);
80 void InterfaceChange(int, struct interface_olsr * interf, enum olsr_ifchg_flag action);
81 int SetFanOutLimit(const char* value, void* data, set_plugin_parameter_addon addon);
82 int InitBmf(struct interface_olsr * skipThisIntf);
83 void CloseBmf(void);
84 
85 #endif /* _BMF_BMF_H */
86