Added first sketch of a generic retry timer mechanism. The idea is to use

these timer objects in AoE and UDP protocols (where there is no underlying
retransmission mechanism) without requiring each protocol to implement its
own individual retry logic.  Eventually, we should be able to use the same
timer code for TCP retransmissions as well.
This commit is contained in:
Michael Brown
2006-05-29 14:55:07 +00:00
parent 6541338897
commit 1db1a6dad3
2 changed files with 166 additions and 0 deletions

36
src/include/gpxe/retry.h Normal file
View File

@@ -0,0 +1,36 @@
#ifndef _GPXE_RETRY_H
#define _GPXE_RETRY_H
/** @file
*
* Retry timers
*
*/
#include <gpxe/list.h>
/** Effective maximum retry count for exponential backoff calculation */
#define BACKOFF_LIMIT 5
/** A retry timer */
struct retry_timer {
/** List of active timers */
struct list_head list;
/** Base timeout (in ticks) */
unsigned int base;
/** Retry count */
unsigned int retries;
/** Expiry time (in ticks) */
unsigned long expiry;
/** Timer expired callback
*
* @v timer Retry timer
*/
void ( * expired ) ( struct retry_timer *timer );
};
extern void start_timer ( struct retry_timer *timer );
extern void reset_timer ( struct retry_timer *timer );
extern void stop_timer ( struct retry_timer *timer );
#endif /* _GPXE_RETRY_H */