⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 olsrd_plugin.c

📁 wifi 无线网络路由协议OLSR linux下C代码
💻 C
字号:
/* * Copyright (c) 2005, Bruno Randolf <bruno.randolf@4g-systems.biz> * Copyright (c) 2004, Andreas T鴑nesen(andreto-at-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: * * * 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 the UniK olsr daemon nor the names of its contributors  *   may be used to endorse or promote products derived from this software  *   without specific prior written permission. * * 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. * *//* $Id: olsrd_plugin.c,v 1.5 2007/09/17 21:57:05 bernd67 Exp $ */ /* * Example plugin for olsrd.org OLSR daemon * Only the bare minimum */#include <stdio.h>#include <string.h>#include "../../../src/olsrd_plugin.h"#include "olsrd_plugin.h"#include "olsr.h"#define PLUGIN_INTERFACE_VERSION 5/**************************************************************************** *                Functions that the plugin MUST provide                    * ****************************************************************************/ /** * Plugin interface version * Used by main olsrd to check plugin interface version */int olsrd_plugin_interface_version(void){    return PLUGIN_INTERFACE_VERSION;}static int set_plugin_test(const char *value, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused))){    printf("\n*** MINI: parameter test: %s\n", value);    return 0;}/** * Register parameters from config file * Called for all plugin parameters */static const struct olsrd_plugin_parameters plugin_parameters[] = {    { .name = "test",   .set_plugin_parameter = &set_plugin_test,      .data = NULL },};void olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size){    *params = plugin_parameters;    *size = sizeof(plugin_parameters)/sizeof(*plugin_parameters);}/** * Initialize plugin * Called after all parameters are passed */intolsrd_plugin_init(void){	printf("*** MINI: plugin_init\n");		/* call a function from main olsrd */	olsr_printf(2, "*** MINI: printed this with olsr_printf\n");		return 1;}/**************************************************************************** *       Optional private constructor and destructor functions              * ****************************************************************************//* attention: make static to avoid name clashes */static void my_init(void) __attribute__ ((constructor));static void my_fini(void) __attribute__ ((destructor));/** * Optional Private Constructor */static void my_init(void){    printf("*** MINI: constructor\n");}/** * Optional Private Destructor */static void my_fini(void){    printf("*** MINI: destructor\n");}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -