📄 mpls_timer.h
字号:
#ifndef MPLS_TIMER_H
#define MPLS_TIMER_H
#include <stdlib.h>
#include "mpls_cmn.h"
#include "ldp.h"
#include "_noalign.h"
/******************************************************************************/
/*
* mpls module memory process macros
*
*/
/******************************************************************************/
#ifndef MPLS_P
#define MPLS_P(x) x
#endif
/******************************************************************************/
/*
* MPLS external MACROS
*/
/******************************************************************************/
/****************************************************************************/
/* Product Name: MPLS PACK1.0
* Module Name: COMMON
* File Name: mpls_timer.h
* Author Name: weng.qing shi.zhaohui hu.yonghong
* Creat Date: 2002-6-18
* Version : 1.0
* Input : mpls_timeout_q *,local process Timer management Queue
* Output : void
* Function : local Timer management init macro
* Note : in local process, the Q should be global
*/
/****************************************************************************/
#define MPLS_TIMER_INIT(Q) \
{ \
mpls_callout_init(&Q); \
}
/****************************************************************************/
/* Product Name: MPLS PACK1.0
* Module Name: COMMON
* File Name: mpls_timer.h
* Author Name: weng.qing shi.zhaohui hu.yonghong
* Creat Date: 2002-6-18
* Version : 1.0
* Input : int, timer delay time
* mpls_timeout_q *, timer management Queue
* Output : void
* Function : local Timer management init macro
* Note : this function should be get, whem the timer source
*/
/****************************************************************************/
#define MPLS_AGE_TIMER(D,Q) \
{ \
mpls_age_callout_queue(D,&Q); \
}
/****************************************************************************/
/* Product Name: MPLS PACK1.0
* Module Name: COMMON
* File Name: mpls_timer.h
* Author Name: weng.qing shi.zhaohui hu.yonghong
* Creat Date: 2002-6-18
* Version : 1.0
* Input : mpls_timeout_q *, timer management Queue
* Output : void
* Function : free all timer in the Queue macro
* Note : this macro only is responsible for release timer
* the memory release is the responsibility of function
*/
/****************************************************************************/
#define MPLS_FREE_TIMERS(Q) \
{ \
mpls_free_all_callouts(&Q); \
}
/****************************************************************************/
/* Product Name: MPLS PACK1.0
* Module Name: COMMON
* File Name: mpls_timer.h
* Author Name: weng.qing shi.zhaohui hu.yonghong
* Creat Date: 2002-6-18
* Version : 1.0
* Input : mpls_timeout_q *, timer management Queue
* unsigned long , timer index
* unsigned long , output deleted timer index
* Output : void
* Function : free all timer in the Queue macro
* Note : this macro only is responsible for release timer
* the memory release is the responsibility of function
*/
/****************************************************************************/
#define MPLS_CLEAR_TIMER(I,Q,R) \
{ \
R = mpls_timer_clearTimer(I,&Q); \
}
/****************************************************************************/
/* Product Name: MPLS PACK1.0
* Module Name: COMMON
* File Name: mpls_timer.h
* Author Name: weng.qing shi.zhaohui hu.yonghong
* Creat Date: 2002-6-18
* Version : 1.0
* Input : mpls_timeout_q *, timer management Queue
* unsigned short , delay time
* void * , timer timeout callback function
* void * , callback function parameter pointer
* unsigned long , output timer index
* Output : void
* Function : free all timer in the Queue macro
* Note : this macro only is responsible for release timer
* the memory release is the responsibility of function
*/
/****************************************************************************/
#define MPLS_SET_TIMER(DL,A,DA,Q,R) \
{ \
R = mpls_timer_setTimer(DL,A,DA,&Q); \
}
typedef void (*mpls_cfunc_t) MPLS_P((void*));
struct mpls_timeout_q {
struct mpls_timeout_q *next; /* next event */
unsigned int id;
mpls_cfunc_t func; /* function to call */
void *data; /* func's data */
int time; /* time offset to next event*/
};
/******************************************************************************/
/*
* mpls timer process function
*/
/******************************************************************************/
void mpls_callout_init(struct mpls_timeout_q **Q);
void mpls_free_all_callouts(struct mpls_timeout_q **Q);
void mpls_age_callout_queue(int elapsed_time,struct mpls_timeout_q **Q);
int mpls_timer_nextTimer(struct mpls_timeout_q **Q);
unsigned int mpls_timer_setTimer(int delay, \
mpls_cfunc_t action,\
void * data, \
struct mpls_timeout_q ** Q);
int mpls_timer_leftTimer(unsigned int timer_id,struct mpls_timeout_q **Q);
int mpls_timer_clearTimer(unsigned int timer_id,struct mpls_timeout_q **Q);
#include "_restore.h"
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -