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

📄 olsrd_copy.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_copy.c,v 1.4 2005/05/29 12:47:42 br1 Exp $ */ /* * Dynamic linked library for UniK OLSRd */ /************************************************************* *                 TOOLS COPIED FROM OLSRD                   * *************************************************************/// these functions are copied from the main olsrd source// TODO: there must be a better way!!!#include <string.h>#include "olsrd_plugin.h"#include "olsrd_copy.h"#include "defs.h"/** *Checks if a timer has times out. That means *if it is smaller than present time. *@param timer the timeval struct to evaluate *@return positive if the timer has not timed out, *0 if it matches with present time and negative *if it is timed out. */intolsr_timed_out(struct timeval *timer){  return(timercmp(timer, &now, <));}/** *Initiates a "timer", wich is a timeval structure, *with the value given in time_value. *@param time_value the value to initialize the timer with *@param hold_timer the timer itself *@return nada */voidolsr_init_timer(olsr_u32_t time_value, struct timeval *hold_timer){   olsr_u16_t  time_value_sec;  olsr_u16_t  time_value_msec;  time_value_sec = time_value/1000;  time_value_msec = time_value-(time_value_sec*1000);  hold_timer->tv_sec = time_value_sec;  hold_timer->tv_usec = time_value_msec*1000;   }/** *Generates a timestamp a certain number of milliseconds *into the future. * *@param time_value how many milliseconds from now *@param hold_timer the timer itself *@return nada */voidolsr_get_timestamp(olsr_u32_t delay, struct timeval *hold_timer){   olsr_u16_t  time_value_sec;  olsr_u16_t  time_value_msec;  time_value_sec = delay/1000;  time_value_msec= delay - (delay*1000);    hold_timer->tv_sec = now.tv_sec + time_value_sec;  hold_timer->tv_usec = now.tv_usec + (time_value_msec*1000);   }

⌨️ 快捷键说明

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