/* ipmip_timer.h - ipmip_timer.h */ /* ****************************************************************************** * HEADER FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip_timer.h,v $ $Revision: 1.12 $ * $Source: /home/interpeak/CVSRoot/ipmip/include/private/ipmip_timer.h,v $ * $Author: jhorteli $ $Date: 2011-01-21 15:31:28 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Lennart Bang ****************************************************************************** */ #ifndef IPMIP_TIMER_H #define IPMIP_TIMER_H /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** * Mobile IP timeout mechanism. These functions provide mechanisms to start * a timeout instance, to initiate, cancel or query timers. The timer * functions all require that locks be specified that must be taken prior * to the invocation of the timer. */ /* DESCRIPTION Mobile IP timeout mechanism. These functions provide mechanisms to start a timeout instance, to initiate, cancel or query timers. The timer functions all require that locks be specified that must be taken prior to the invocation of the timer. EXAMPLE This example shows how a timer may be scheduled or cancelled. .CS IP_STATIC int my_mip_timer_callback(int event, struct Ipmip_my_context *ctx, Ipmip_proc_t *proc, struct Ipmip_my_entities *node, void *unused) { /@ Was this function invoked properly? @/ if (event == IPMIP_TIMER_EVENT_RUN) { /@ The timer was properly invoked. @/ /@ Reschedule it @/ return IPMIP_TIMER_RET_REINSERT; } else if (event == IPMIP_TIMER_EVENT_CANCEL) { /@ The timer was cancelled - we should do nothing except perhaps free any resources provided to us as arguments if the pending timer is the only place they are referenced @/ } else if (event == IPMIP_TIMER_EVENT_ABORTED) { /@ The timer was aborted - we should do nothing except perhaps free any resources provided to us as arguments if the pending timer is the only place they are referenced. NOTE HOWEVER that this also indicates that the owning object has been destroyed, in this case that the object pointed to by 'node' may be invalid. Only reference data you know to be valid @/ } /@ This timer is done - finalize processing @/ return IPMIP_TIMER_RET_DONE; } void my_mip_timer(struct Ipmip_my_context *ctx, Ipmip_proc_t *proc, struct Ipmip_my_entities *node) { /@ Cancel any outstanding requests. If there is an outstanding timer scheduled, it will invoke the callback with the value IPMIP_TIMER_EVENT_CANCEL @/ ipmip_timer_cancel(&ctx->ipmip, proc, &node->timer); /@ Schedule a request in 10000ms from now, If the timer is successful it will invoke the callback with IPMIP_TIMER_EVENT_RUN @/ ipmip_timer_request(&ctx->ipmip, proc, &node->timer, node->my_lock, (Ipmip_timer_func_t)my_mip_timer_callback, node, IP_NULL, 10000); /@ If there's outstanding timers pending on this lock, they will be invoked with the event value of IPMIP_TIMER_EVENT_ABORTED @/ ipmip_timer_lock_destroy(&ctx->ipmip, proc, &node->timer); } .CE */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #include #include #include #ifdef __cplusplus extern "C" { #endif /* **************************************************************************** * 4 DEFINES **************************************************************************** */ /* **************************************************************************** * 5 TYPES **************************************************************************** */ struct Ipmip_timer; struct Ipmip_context; struct Ipmip_proc; typedef struct Ipmip_timer_context { Ipcom_block queue_signal; Ipcom_mutex queue_lock; Ipcom_pqueue *queue; struct Ipmip_context *context; struct Ipmip_proc *proc; } Ipmip_timer_context_t; typedef int (*Ipmip_timer_func_t) ( int event, /* Timer event */ struct Ipmip_context *ctx, struct Ipmip_proc *proc, void *arg1, void *arg2 ); typedef void (*Ipmip_timer_lock_event_func_t) ( int event, struct Ipmip_context *ctx, struct Ipmip_proc *proc, void *arg ); typedef struct Ipmip_timer_lock { Ipcom_list timers; Ipcom_list pending; Ipcom_block block; struct Ipmip_timer *lock; Ip_bool destroyed; Ipmip_timer_lock_event_func_t func; void *obj; } Ipmip_timer_lock_t; typedef struct Ipmip_timer { Ipcom_list next; int pqindex; /* The index this entry has in the timeout priority queue */ struct Ip_timeval duration; /* The original timeout duration */ struct Ip_timeval abs; /* Absolute time when this entry expires */ Ipmip_timer_func_t func; /* User callback function. */ Ipmip_timer_lock_t *lock; void *cookie1; /* User timeout cookie. */ void *cookie2; /* User timeout cookie. */ } Ipmip_timer_t; typedef struct Ipmip_timer_retransmit { Ipmip_timer_t timer; Ip_u32 original; Ip_u32 retransmit; Ip_u32 retransmits; Ip_u32 expire; Ip_time_t last; Ip_u32 count; Ip_u32 rate_limit; } Ipmip_timer_retransmit_t; /* Use this macro to initialize a timeout entry. */ #define IPMIP_TIMER_INIT(xxtmo) do { (xxtmo)->pqindex = 0; (xxtmo)->next.head = IP_NULL; } while (0) #define IPMIP_TIMER_EVENT_RUN (0) #define IPMIP_TIMER_EVENT_CANCEL (1) #define IPMIP_TIMER_EVENT_ABORTED (2) #define IPMIP_TIMER_RET_DONE (0) #define IPMIP_TIMER_RET_REINSERT (1) #define IPMIP_TIMER_RET_PENDING (2) #define IPMIP_TIMER_LOCK_EVENT_LOCK (0) /* Locked */ #define IPMIP_TIMER_LOCK_EVENT_UPDATE (1) /* Re-acquired; after block */ #define IPMIP_TIMER_LOCK_EVENT_UNLOCK (2) /* Unlocked */ /* **************************************************************************** * 6 FUNCTIONS **************************************************************************** */ /******************************************************************************* * * ipmip_timer_call - ipmip_timer_call * * Do call processing for a timer. Invoking this function will do the same * lock processing and event processing as an ordinary timer timeout would. * That is, if the func returns IPMIP_TIMER_RET_PENDING the lock will not * be unlocked. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i timer_lock * Must be held. * \i func * The function callback * \i cookie1 * Opaque auxilliary value * \i cookie2 * Opaque auxilliary value * \ie * * RETURNS: No return value * * ERRNO: * * NOMANUAL */ IP_GLOBAL void ipmip_timer_call ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_lock_t *timer_lock, Ipmip_timer_func_t func, void *cookie1, void *cookie2 ); /******************************************************************************* * * ipmip_timer_context_start - ipmip_timer_context_start * * Starts the timeout process. This function is invoked by ipmip_context_start * so it should never have to be invoked directly. * * Parameters: * \is * \i context * Owning context * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \ie * * RETURNS: IP_TRUE on success * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ip_bool ipmip_timer_context_start ( struct Ipmip_context *context, struct Ipmip_proc *proc ); /******************************************************************************* * * ipmip_timer_context_create - ipmip_timer_context_create * * Creates a new timeout process. There should never be any reason * to invoke this function directly, since it is created automatically * by ipmip_context_create. * * Parameters: * \is * \i context * Owning context * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \ie * * RETURNS: IP_NULL if out of memory or a pointer to the new timeout proc. * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ip_bool ipmip_timer_context_create ( struct Ipmip_context *context, struct Ipmip_proc *proc ); /******************************************************************************* * * ipmip_timer_context_stop - ipmip_timer_context_stop * * Stops the timer thread. This function is invoked by ipmip_context_stop * and should not be invoked directly. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \ie * * RETURNS: No return value * * ERRNO: * * NOMANUAL */ IP_GLOBAL void ipmip_timer_context_stop ( struct Ipmip_context *ctx, struct Ipmip_proc *proc ); /******************************************************************************* * * ipmip_timer_context_destroy - ipmip_timer_context_destroy * * Frees all resources helds by a timeout process and terminates * the process. This function is invoked by ipmip_context_destroy and should * never be directly invoked. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \ie * * RETURNS: No return value * * ERRNO: * * NOMANUAL */ IP_GLOBAL void ipmip_timer_context_destroy ( struct Ipmip_context *ctx, struct Ipmip_proc *proc ); /******************************************************************************* * * ipmip_timer_request_timeval - ipmip_timer_request_timeval * * Request a new timeout * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i timer * The timer structure * \i timer_lock * The timer lock * \i func * The function callback * \i cookie1 * Opaque auxilliary value * \i cookie2 * Opaque auxilliary value * \i duration * Timeout. * \ie * * RETURNS: IPCOM_SUCCESS on success, error code otherwise. * * ERRNO: * */ IP_GLOBAL Ip_err ipmip_timer_request_timeval ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_t *timer, Ipmip_timer_lock_t *timer_lock, Ipmip_timer_func_t func, void *cookie1, void *cookie2, IP_CONST struct Ip_timeval *duration ); /******************************************************************************* * * ipmip_timer_request - ipmip_timer_request * * Request a new timeout. The timer function will schedule a timeout based on * the timeout msec value. There is no guarantee that the timer will hit * exactly, since the timeout mechanism also requires the timer_lock to * be acquired prior to invocation. If the timer_lock is held when the timeout * expires, the timer will be queued on the lock and invoked immediately * when the lock is released. * * The timer callback function may return three different values. * IPMIP_TIMER_RET_DONE - Indicates that the timer is done. The lock * will be released and the timer will not be * resceduled. * IPMIP_TIMER_RET_PENDING - Indicates that the timer is done, but the lock * will not be released and the timer will not be * resceduled. It is up to the implementation * to release the lock once processing has been * completed. This is used for example when * one has to verify a request by querying a * third party. The lock will be held until a * response has been returned. * IPMIP_TIMER_RET_REINSERT- Indicates that the timer is done.The lock * will be released and the timer will be * rescheduled with the same parameters as was * originally provided. * * When the timer callback is invoked, it will be provided with an event * parameter. This event parameter indicates as to the reason why the * callback was invoked. * * IPMIP_TIMER_EVENT_RUN - Ordinary timeout event. * IPMIP_TIMER_EVENT_CANCEL - The timeout was cancelled by * ipmip_timer_cancel * IPMIP_TIMER_EVENT_ABORTED - The timeout was killed by the timer lock * being destroyed. Data in timer arguments * may be invalid. Be cautious. * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i timer * The timer structure * \i timer_lock * Lock to be acquired prior to invocation. * \i func * The function callback * \i cookie1 * Opaque auxilliary value * \i cookie2 * Opaque auxilliary value * \i msec * Timeout. * \ie * * RETURNS: IPCOM_SUCCESS on success, error code otherwise. * * ERRNO: * */ #ifndef IP_TIMER_DEBUG IP_GLOBAL Ip_err ipmip_timer_request ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_t *timer, Ipmip_timer_lock_t *timer_lock, Ipmip_timer_func_t func, void *cookie1, void *cookie2, Ip_u32 msec ); #else IP_GLOBAL Ip_err ipmip_timer_request_debug ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_t *timer, Ipmip_timer_lock_t *timer_lock, Ipmip_timer_func_t func, void *cookie1, void *cookie2, Ip_u32 msec, const char *s_file, const char *s_func, int line ); #define ipmip_timer_request(c,p,t,tl,f,c1,c2,m) ipmip_timer_request_debug((c),(p),(t),(tl),(f),(c1),(c2),(m), __FILE__, __FUNCTION__, __LINE__) #endif /******************************************************************************* * * ipmip_timer_prepare - ipmip_timer_prepare * * Prepare to block a particular timer, not releasing the lock. When the * timer is unlocked using 'ipmip_timer_execute' the provided * function will be invoked as if an ordinary timeout event * had occurred. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i timer * Timer * \i timer_lock * The timer lock * \i func * The function callback * \i cookie1 * Opaque auxilliary value * \i cookie2 * Opaque auxilliary value * \ie * * RETURNS: IPCOM_SUCCESS on success * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ip_err ipmip_timer_prepare ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_t *timer, Ipmip_timer_lock_t *timer_lock, Ipmip_timer_func_t func, void *cookie1, void *cookie2 ); /******************************************************************************* * * ipmip_timer_execute - ipmip_timer_execute * * Unblock a previously blocked timer, causing the provided * timer callback function to be invoked and processing to be * continued. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i timer * Timer * \ie * * RETURNS: IP_TRUE if unlocked * * ERRNO: * */ IP_GLOBAL Ip_bool ipmip_timer_execute ( struct Ipmip_context *ctx, Ipmip_timer_t *timer ); /******************************************************************************* * * ipmip_timer_cancel - ipmip_timer_cancel * * Cancel a timeout * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i timer * The timer. * \ie * * RETURNS: IPCOM_SUCCESS if successful, error code otherwise. * * ERRNO: * */ IP_GLOBAL Ip_err ipmip_timer_cancel ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_t *timer ); /******************************************************************************* * * ipmip_timer_lock_alloc - ipmip_timer_lock_alloc * * Allocate a timer lock. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i func * Lock event function [optional] * \i obj * Opaque object * \ie * * RETURNS: The newly allocated lock. * * ERRNO: * */ IP_GLOBAL Ipmip_timer_lock_t * ipmip_timer_lock_alloc ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_lock_event_func_t func, void *obj ); /******************************************************************************* * * ipmip_timer_lock_destroy - ipmip_timer_lock_destroy * * Destroy a timer lock. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i lock * The lock * \ie * * RETURNS: No return value * * ERRNO: * */ IP_GLOBAL void ipmip_timer_lock_destroy ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_lock_t *lock ); /******************************************************************************* * * ipmip_timer_lock_acquire - ipmip_timer_lock_acquire * * Acquire a timer lock. This function is a blocking operation that will * wait until the lock is released. Should only be used where there is no * risk for deadlocking. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i lock * The lock * \ie * * RETURNS: The lock if successful. * * ERRNO: * */ IP_GLOBAL Ipmip_timer_lock_t * ipmip_timer_lock_acquire ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_lock_t *lock ); /******************************************************************************* * * ipmip_timer_lock_try - ipmip_timer_lock_try * * Try to acquire a timer lock. This method should be used when there's a risk * for deadlocking. If the try lock method fails, one should schedule a timer * to acquire the lock and continue processing when possible. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i lock * The lock * \ie * * RETURNS: The lock if successful. * * ERRNO: * */ IP_GLOBAL Ipmip_timer_lock_t * ipmip_timer_lock_try ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_lock_t *lock ); /******************************************************************************* * * ipmip_timer_lock_release - ipmip_timer_lock_release * * Release a timer lock acquired by ipmip_timer_lock_acquire or * ipmip_timer_lock_try. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i lock * The lock * \ie * * RETURNS: No return value * * ERRNO: * */ IP_GLOBAL void ipmip_timer_lock_release ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_lock_t *lock ); /******************************************************************************* * * ipmip_timer_pending - ipmip_timer_pending * * Check whether or not a timer is pending timeout. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i timer * The timer. * \ie * * RETURNS: IP_TRUE if pending * * ERRNO: * */ IP_GLOBAL Ip_bool ipmip_timer_pending ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_t *timer ); /******************************************************************************* * * ipmip_timer_remaining - ipmip_timer_remaining * * The remaining timeout. If successful, the remaining timeout value * will be stored in the 'remaining' parameter provided to the function. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i timer * The timer. * \i remaining * Remaining * \ie * * RETURNS: IP_TRUE if successful * * ERRNO: * */ IP_GLOBAL Ip_bool ipmip_timer_remaining ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_t *timer, struct Ip_timeval *remaining ); /******************************************************************************* * * ipmip_timer_retransmit_init - ipmip_timer_retransmit_init * * Initialize the retransmit timer. IPMIP6 specific function, will be obsoleted. * * Parameters: * \is * \i r * Retransmit block * \i limit * Rate limit * \i original * Original retransmit value * \i initial * Initial retransmit value * \i expire * Expire value * \ie * * RETURNS: No return value * * ERRNO: * * NOMANUAL */ IP_GLOBAL void ipmip_timer_retransmit_init ( Ipmip_timer_retransmit_t *r, Ip_u32 limit, Ip_u32 original, Ip_u32 initial, Ip_u32 expire ); /******************************************************************************* * * ipmip_timer_retransmit_ratelimit - ipmip_timer_retransmit_ratelimit * * Check whether or not a retransmit is valid based on sent packets, outstanding * timers and rate limitations. IPMIP6 specific function, will be obsoleted. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i r * The retransmit timer. * \ie * * RETURNS: IP_TRUE if allowed * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ip_bool ipmip_timer_retransmit_ratelimit ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_retransmit_t *r ); /******************************************************************************* * * ipmip_timer_retransmit_reset - ipmip_timer_retransmit_reset * * Resets a retransmit counter, and removes any outstanding timeouts. * IPMIP6 specific function, will be obsoleted. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i r * The retransmit timer. * \ie * * RETURNS: IP_TRUE if allowed * * ERRNO: * * NOMANUAL */ IP_GLOBAL void ipmip_timer_retransmit_reset ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_retransmit_t *r ); /******************************************************************************* * * ipmip_timer_retransmit_expire - ipmip_timer_retransmit_expire * * Expires a retransmit value. It will handle exponential backoffs * and abide by max values. IPMIP6 specific function, will be obsoleted. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i r * The retransmit timer. * \ie * * RETURNS: IP_TRUE if allowed * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ip_bool ipmip_timer_retransmit_expire ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, Ipmip_timer_retransmit_t *r ); /******************************************************************************* * * ipmip_timer_retransmit_request - ipmip_timer_retransmit_request * * Request a retransmit timeout. IPMIP6 specific function, will be obsoleted. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i r * The retransmit timer structure * \i timer_lock * Lock to be acquired prior to invocation. * \i func * The function callback * \i cookie1 * Opaque auxilliary value * \i cookie2 * Opaque auxilliary value * \ie * * RETURNS: IPCOM_SUCCESS on success, error code otherwise. * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ip_err ipmip_timer_retransmit_request ( struct Ipmip_context *context, struct Ipmip_proc *proc, Ipmip_timer_retransmit_t *r, Ipmip_timer_lock_t *timer_lock, Ipmip_timer_func_t func, void *arg1, void *arg2 ); #ifdef __cplusplus } #endif #endif /* **************************************************************************** * END OF FILE **************************************************************************** */