X-Git-Url: http://olsr.org/git/?p=olsrd.git;a=blobdiff_plain;f=src%2Fplugin_loader.h;h=95db105d9d5a0363823faccf12b9d2021e3c2d16;hp=d6952cd4b75156562ece12d1b664c8542ccd5aa0;hb=bee92c7e710a52c9790484318ee4d776ec4c7ab1;hpb=7a5d8ded932fadcc1be8c029f96f1a165a709c60 diff --git a/src/plugin_loader.h b/src/plugin_loader.h index d6952cd4..95db105d 100644 --- a/src/plugin_loader.h +++ b/src/plugin_loader.h @@ -1,86 +1,100 @@ + /* - * OLSR ad-hoc routing table management protocol - * Copyright (C) 2004 Andreas Tønnesen (andreto@ifi.uio.no) + * The olsr.org Optimized Link-State Routing daemon(olsrd) + * Copyright (c) 2004, Andreas Tonnesen(andreto@olsr.org) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: * - * This file is part of olsrd-unik. + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of olsr.org, olsrd nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. * - * UniK olsrd is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. * - * UniK olsrd is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Visit http://www.olsr.org for more information. * - * You should have received a copy of the GNU General Public License - * along with olsrd-unik; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * If you find this software useful feel free to make a donation + * to the project. For more information see the website or contact + * the copyright holders. * */ #ifndef _OLSR_PLUGIN_LOADER #define _OLSR_PLUGIN_LOADER -#include -#include -#include "olsr_protocol.h" +#include "olsrd_plugin.h" +#include "olsr_types.h" +#include "olsr_cfg.h" -#define MAX_LIBS 10 +#ifndef OLSR_PLUGIN -#define PLUGIN_INTERFACE_VERSION 1 +/* all */ +typedef int (*plugin_init_func) (void); +typedef int (*get_interface_version_func) (void); -/* Data to sent to the plugin with the register_olsr_function call */ -struct olsr_plugin_data -{ - int ipversion; - union olsr_ip_addr *main_addr; - int (*olsr_plugin_io)(int, void *, size_t); -}; +#if defined SUPPORT_OLD_PLUGIN_VERSIONS && SUPPORT_OLD_PLUGIN_VERSIONS + +/* version 4 */ +typedef int (*register_param_func) (char *, char *); +#endif /* defined SUPPORT_OLD_PLUGIN_VERSIONS && SUPPORT_OLD_PLUGIN_VERSIONS */ +/* version 5 */ +typedef void (*get_plugin_parameters_func) (const struct olsrd_plugin_parameters ** params, unsigned int *size); -struct olsr_plugin -{ +struct olsr_plugin { /* The handle */ void *dlhandle; - int (*register_olsr_data)(struct olsr_plugin_data *); - - /* Multi - purpose function */ - int (*plugin_io)(int, void *, size_t); - - struct olsr_plugin *next; -}; + struct plugin_param *params; + int plugin_interface_version; +#if defined SUPPORT_OLD_PLUGIN_VERSIONS && SUPPORT_OLD_PLUGIN_VERSIONS + /* version 4 */ + register_param_func register_param; +#endif /* defined SUPPORT_OLD_PLUGIN_VERSIONS && SUPPORT_OLD_PLUGIN_VERSIONS */ + plugin_init_func plugin_init; -struct olsr_plugin *olsr_plugins; + /* version 5 */ + const struct olsrd_plugin_parameters *plugin_parameters; + unsigned int plugin_parameters_size; - -struct plugin_to_load -{ - char name[FILENAME_MAX]; - struct plugin_to_load *next; + struct olsr_plugin *next; }; -struct plugin_to_load *plugins_to_load; - -void -olsr_init_plugin_loader(); - -void -olsr_add_plugin(char *); +void olsr_load_plugins(void); -int -olsr_load_plugins(); +void olsr_close_plugins(void); -void -init_olsr_plugin(struct olsr_plugin *); +int olsr_plugin_io(int, void *, size_t); -int -olsr_load_dl(char *); +#endif /* OLSR_PLUGIN */ +#endif /* _OLSR_PLUGIN_LOADER */ -void -olsr_close_plugins(); - -#endif +/* + * Local Variables: + * mode: c + * style: linux + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */