2 * The olsr.org Optimized Link-State Routing daemon(olsrd)
3 * Copyright (c) 2004-2009, the olsr.org team - see HISTORY file
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of olsr.org, olsrd nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
33 * Visit http://www.olsr.org for more information.
35 * If you find this software useful feel free to make a donation
36 * to the project. For more information see the website or contact
37 * the copyright holders.
42 #include <assert.h> /* assert() */
43 #include <stddef.h> /* NULL */
46 #include "olsrd_plugin.h"
47 #include "plugin_util.h"
48 #include "defs.h" /* uint8_t, olsr_cnf */
49 #include "scheduler.h" /* olsr_start_timer() */
50 #include "olsr_cfg.h" /* olsr_cnf() */
51 #include "olsr_cookie.h" /* olsr_alloc_cookie() */
54 #include "mdns.h" /* InitBmf(), CloseBmf() */
55 #include "NetworkInterfaces.h" /* AddNonOlsrBmfIf(), SetBmfInterfaceIp(), ... */
56 #include "Address.h" /* DoLocalBroadcast() */
58 static void __attribute__ ((constructor)) my_init(void);
59 static void __attribute__ ((destructor)) my_fini(void);
61 //static struct olsr_cookie_info *prune_packet_history_timer_cookie;
63 void olsr_plugin_exit(void);
65 /* -------------------------------------------------------------------------
66 * Function : olsrd_plugin_interface_version
67 * Description: Plugin interface version
70 * Return : BMF plugin interface version number
72 * Notes : Called by main OLSRD (olsr_load_dl) to check plugin interface
74 * ------------------------------------------------------------------------- */
76 olsrd_plugin_interface_version(void)
78 return PLUGIN_INTERFACE_VERSION;
81 /* -------------------------------------------------------------------------
82 * Function : olsrd_plugin_init
83 * Description: Plugin initialisation
86 * Return : fail (0) or success (1)
87 * Data Used : olsr_cnf
88 * Notes : Called by main OLSRD (init_olsr_plugin) to initialize plugin
89 * ------------------------------------------------------------------------- */
91 olsrd_plugin_init(void)
93 /* Clear the packet history */
94 //InitPacketHistory();
96 /* Register ifchange function */
97 //add_ifchgf(&InterfaceChange);
99 /* create the cookie */
100 //prune_packet_history_timer_cookie = olsr_alloc_cookie("BMF: Prune Packet History", OLSR_COOKIE_TYPE_TIMER);
102 /* Register the duplicate registration pruning process */
103 //olsr_start_timer(3 * MSEC_PER_SEC, 0, OLSR_TIMER_PERIODIC,
104 // &PrunePacketHistory, NULL, prune_packet_history_timer_cookie->ci_id);
107 return InitMDNS(NULL);
110 /* -------------------------------------------------------------------------
111 * Function : olsr_plugin_exit
112 * Description: Plugin cleanup
117 * Notes : Called by my_fini() at unload of shared object
118 * ------------------------------------------------------------------------- */
120 olsr_plugin_exit(void)
125 static const struct olsrd_plugin_parameters plugin_parameters[] = {
126 {.name = "NonOlsrIf",.set_plugin_parameter = &AddNonOlsrBmfIf,.data = NULL},
127 {.name = "MDNS_TTL", .set_plugin_parameter = &set_MDNS_TTL, .data = NULL },
128 {.name = "FilteredHost", .set_plugin_parameter = &AddFilteredHost, .data = NULL },
129 //{ .name = "DoLocalBroadcast", .set_plugin_parameter = &DoLocalBroadcast, .data = NULL },
130 //{ .name = "BmfInterface", .set_plugin_parameter = &SetBmfInterfaceName, .data = NULL },
131 //{ .name = "BmfInterfaceIp", .set_plugin_parameter = &SetBmfInterfaceIp, .data = NULL },
132 //{ .name = "CapturePacketsOnOlsrInterfaces", .set_plugin_parameter = &SetCapturePacketsOnOlsrInterfaces, .data = NULL },
133 //{ .name = "BmfMechanism", .set_plugin_parameter = &SetBmfMechanism, .data = NULL },
134 //{ .name = "FanOutLimit", .set_plugin_parameter = &SetFanOutLimit, .data = NULL },
135 //{ .name = "BroadcastRetransmitCount", .set_plugin_parameter = &set_plugin_int, .data = &BroadcastRetransmitCount},
138 /* -------------------------------------------------------------------------
139 * Function : olsrd_get_plugin_parameters
140 * Description: Return the parameter table and its size
142 * Output : params - the parameter table
143 * size - its size in no. of entries
145 * Data Used : plugin_parameters
146 * Notes : Called by main OLSR (init_olsr_plugin) for all plugins
147 * ------------------------------------------------------------------------- */
149 olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size)
151 *params = plugin_parameters;
152 *size = ARRAYSIZE(plugin_parameters);
155 /* -------------------------------------------------------------------------
157 * Description: Plugin constructor
162 * Notes : Called at load of shared object
163 * ------------------------------------------------------------------------- */
167 /* Print plugin info to stdout */
168 printf("%s\n", MOD_DESC);
173 /* -------------------------------------------------------------------------
175 * Description: Plugin destructor
180 * Notes : Called at unload of shared object
181 * ------------------------------------------------------------------------- */
191 * indent-tabs-mode: nil