Dependents:   SNMPAgent HTTPServer think_speak_a cyassl-client ... more

Committer:
mamezu
Date:
Thu Dec 09 01:33:56 2010 +0000
Revision:
0:0f6c82fcde82

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mamezu 0:0f6c82fcde82 1 /*
mamezu 0:0f6c82fcde82 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
mamezu 0:0f6c82fcde82 3 * All rights reserved.
mamezu 0:0f6c82fcde82 4 *
mamezu 0:0f6c82fcde82 5 * Redistribution and use in source and binary forms, with or without modification,
mamezu 0:0f6c82fcde82 6 * are permitted provided that the following conditions are met:
mamezu 0:0f6c82fcde82 7 *
mamezu 0:0f6c82fcde82 8 * 1. Redistributions of source code must retain the above copyright notice,
mamezu 0:0f6c82fcde82 9 * this list of conditions and the following disclaimer.
mamezu 0:0f6c82fcde82 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
mamezu 0:0f6c82fcde82 11 * this list of conditions and the following disclaimer in the documentation
mamezu 0:0f6c82fcde82 12 * and/or other materials provided with the distribution.
mamezu 0:0f6c82fcde82 13 * 3. The name of the author may not be used to endorse or promote products
mamezu 0:0f6c82fcde82 14 * derived from this software without specific prior written permission.
mamezu 0:0f6c82fcde82 15 *
mamezu 0:0f6c82fcde82 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
mamezu 0:0f6c82fcde82 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mamezu 0:0f6c82fcde82 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
mamezu 0:0f6c82fcde82 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
mamezu 0:0f6c82fcde82 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
mamezu 0:0f6c82fcde82 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mamezu 0:0f6c82fcde82 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mamezu 0:0f6c82fcde82 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
mamezu 0:0f6c82fcde82 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
mamezu 0:0f6c82fcde82 25 * OF SUCH DAMAGE.
mamezu 0:0f6c82fcde82 26 *
mamezu 0:0f6c82fcde82 27 * This file is part of the lwIP TCP/IP stack.
mamezu 0:0f6c82fcde82 28 *
mamezu 0:0f6c82fcde82 29 * Author: Adam Dunkels <adam@sics.se>
mamezu 0:0f6c82fcde82 30 * Simon Goldschmidt
mamezu 0:0f6c82fcde82 31 *
mamezu 0:0f6c82fcde82 32 */
mamezu 0:0f6c82fcde82 33 #ifndef __LWIP_TIMERS_H__
mamezu 0:0f6c82fcde82 34 #define __LWIP_TIMERS_H__
mamezu 0:0f6c82fcde82 35
mamezu 0:0f6c82fcde82 36 #include "lwip/opt.h"
mamezu 0:0f6c82fcde82 37
mamezu 0:0f6c82fcde82 38 /* Timers are not supported when NO_SYS==1 and NO_SYS_NO_TIMERS==1 */
mamezu 0:0f6c82fcde82 39 #define LWIP_TIMERS (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS))
mamezu 0:0f6c82fcde82 40
mamezu 0:0f6c82fcde82 41 #if LWIP_TIMERS
mamezu 0:0f6c82fcde82 42
mamezu 0:0f6c82fcde82 43 #include "lwip/err.h"
mamezu 0:0f6c82fcde82 44 #include "lwip/sys.h"
mamezu 0:0f6c82fcde82 45
mamezu 0:0f6c82fcde82 46 #ifdef __cplusplus
mamezu 0:0f6c82fcde82 47 extern "C" {
mamezu 0:0f6c82fcde82 48 #endif
mamezu 0:0f6c82fcde82 49
mamezu 0:0f6c82fcde82 50 #ifndef LWIP_DEBUG_TIMERNAMES
mamezu 0:0f6c82fcde82 51 #ifdef LWIP_DEBUG
mamezu 0:0f6c82fcde82 52 #define LWIP_DEBUG_TIMERNAMES SYS_DEBUG
mamezu 0:0f6c82fcde82 53 #else /* LWIP_DEBUG */
mamezu 0:0f6c82fcde82 54 #define LWIP_DEBUG_TIMERNAMES 0
mamezu 0:0f6c82fcde82 55 #endif /* LWIP_DEBUG*/
mamezu 0:0f6c82fcde82 56 #endif
mamezu 0:0f6c82fcde82 57
mamezu 0:0f6c82fcde82 58 /** Function prototype for a timeout callback function. Register such a function
mamezu 0:0f6c82fcde82 59 * using sys_timeout().
mamezu 0:0f6c82fcde82 60 *
mamezu 0:0f6c82fcde82 61 * @param arg Additional argument to pass to the function - set up by sys_timeout()
mamezu 0:0f6c82fcde82 62 */
mamezu 0:0f6c82fcde82 63 typedef void (* sys_timeout_handler)(void *arg);
mamezu 0:0f6c82fcde82 64
mamezu 0:0f6c82fcde82 65 struct sys_timeo {
mamezu 0:0f6c82fcde82 66 struct sys_timeo *next;
mamezu 0:0f6c82fcde82 67 u32_t time;
mamezu 0:0f6c82fcde82 68 sys_timeout_handler h;
mamezu 0:0f6c82fcde82 69 void *arg;
mamezu 0:0f6c82fcde82 70 #if LWIP_DEBUG_TIMERNAMES
mamezu 0:0f6c82fcde82 71 const char* handler_name;
mamezu 0:0f6c82fcde82 72 #endif /* LWIP_DEBUG_TIMERNAMES */
mamezu 0:0f6c82fcde82 73 };
mamezu 0:0f6c82fcde82 74
mamezu 0:0f6c82fcde82 75 void sys_timeouts_init(void);
mamezu 0:0f6c82fcde82 76
mamezu 0:0f6c82fcde82 77 #if LWIP_DEBUG_TIMERNAMES
mamezu 0:0f6c82fcde82 78 void sys_timeout_debug(u32_t msecs, sys_timeout_handler handler, void *arg, const char* handler_name);
mamezu 0:0f6c82fcde82 79 #define sys_timeout(msecs, handler, arg) sys_timeout_debug(msecs, handler, arg, #handler)
mamezu 0:0f6c82fcde82 80 #else /* LWIP_DEBUG_TIMERNAMES */
mamezu 0:0f6c82fcde82 81 void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg);
mamezu 0:0f6c82fcde82 82 #endif /* LWIP_DEBUG_TIMERNAMES */
mamezu 0:0f6c82fcde82 83
mamezu 0:0f6c82fcde82 84 void sys_untimeout(sys_timeout_handler handler, void *arg);
mamezu 0:0f6c82fcde82 85 #if NO_SYS
mamezu 0:0f6c82fcde82 86 void sys_check_timeouts(void);
mamezu 0:0f6c82fcde82 87 void sys_restart_timeouts(void);
mamezu 0:0f6c82fcde82 88 #else /* NO_SYS */
mamezu 0:0f6c82fcde82 89 void sys_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg);
mamezu 0:0f6c82fcde82 90 #endif /* NO_SYS */
mamezu 0:0f6c82fcde82 91
mamezu 0:0f6c82fcde82 92
mamezu 0:0f6c82fcde82 93 #ifdef __cplusplus
mamezu 0:0f6c82fcde82 94 }
mamezu 0:0f6c82fcde82 95 #endif
mamezu 0:0f6c82fcde82 96
mamezu 0:0f6c82fcde82 97 #endif /* LWIP_TIMERS */
mamezu 0:0f6c82fcde82 98 #endif /* __LWIP_TIMERS_H__ */