X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=dummynet2%2Finclude%2Fsys%2Fsystm.h;fp=dummynet2%2Finclude%2Fsys%2Fsystm.h;h=238a7d3727671b8a3dd9fe9b5eca430da1074f7d;hb=10f6855044ac2d3a12f19eddbbbb24b59cbbf1fb;hp=0000000000000000000000000000000000000000;hpb=7f9fafbbf8a2c3d7a4b9aab56d63d9ee6f4bed82;p=ipfw.git diff --git a/dummynet2/include/sys/systm.h b/dummynet2/include/sys/systm.h new file mode 100644 index 0000000..238a7d3 --- /dev/null +++ b/dummynet2/include/sys/systm.h @@ -0,0 +1,73 @@ +#ifndef _SYS_SYSTM_H_ +#define _SYS_SYSTM_H_ + +#ifndef _WIN32 /* this is the linux version */ +/* callout support, in on FreeBSD */ +/* + * callout support on linux module is done using timers + */ +#include +#ifdef LINUX_24 +#include /* jiffies definition is here in 2.4 */ +#endif +#define callout timer_list +static __inline int +callout_reset(struct callout *co, int ticks, void (*fn)(void *), void *arg) +{ + co->expires = jiffies + ticks; + co->function = (void (*)(unsigned long))fn; + co->data = (unsigned long)arg; + add_timer(co); + return 0; +} + +#define callout_init(co, safe) init_timer(co) +#define callout_drain(co) del_timer(co) +#define callout_stop(co) del_timer(co) + +#define CALLOUT_ACTIVE 0x0002 /* callout is currently active */ +#define CALLOUT_MPSAFE 0x0008 /* callout handler is mp safe */ + +#else /* _WIN32 */ + +/* This is the windows part for callout support */ +struct callout { + int dummy; +}; +static __inline int +callout_reset(struct callout *co, int ticks, void (*fn)(void *), void *arg) +{ + return 0; +} + +#define callout_init(co, safe) +#define callout_drain(co) +#define callout_stop(co) +#endif /* !_WIN32 */ + + +#if 0 +/* add out timer to the kernel global timer list */ +NTSTATUS + IoInitializeTimer( + IN PDEVICE_OBJECT DeviceObject, + IN PIO_TIMER_ROUTINE TimerRoutine, + IN PVOID Context + ); + +/* see differences : +IoInitializeDpcRequest + http://dsrg.mff.cuni.cz/~ceres/sch/osy/text/ch04s01s01.php + example http://www.beyondlogic.org/interrupts/winnt_isr_dpc.htm +KeInitializeDpc IRQL: Any level +IoInitializeTimer IRQL: Passive level +KeInitializeTimer */ +VOID + KeInitializeDpc( + IN PRKDPC Dpc, + IN PKDEFERRED_ROUTINE DeferredRoutine, + IN PVOID DeferredContext + ); +#endif /* commented out */ + +#endif /* _SYS_SYSTM_H_ */