MirOS Manual: ppsratecheck(9)

PPSRATECHECK(9)               BSD Kernel Manual                PPSRATECHECK(9)


     ppsratecheck - function to help implement rate-limited actions


     #include <sys/time.h>

     ppsratecheck(struct timeval *lasttime, int *curpps, int maxpps);


     The ppsratecheck() function provides an easy way to perform packet-per-
     sec, or event-per-sec, rate limitation. The motivation for implementing
     ppsratecheck() was to provide a mechanism that could be used to add rate
     limitation to network packet output. For certain network packets, we may
     want to impose rate limitation, to avoid denial-of-service attack possi-

     maxpps specifies maximum permitted packets, or events, per second. If
     ppsratecheck() is called more than maxpps times in a given one second
     period, the function will return 0, indicating that we exceeded the lim-
     it. If we are below the limit, the function will return 1. If maxpps is
     set to 0, the function will always return 0 (no packets/events are
     permitted). Negative maxpps indicates that rate limitation is disabled,
     and ppsratecheck() will always return 1.

     curpps and lasttime are used to maintain the number of recent calls.
     curpps will be incremented every time ppsratecheck() is called, and will
     be reset whenever necessary.


     log(9), printf(9), ratecheck(9), time(9)


     The ppsratecheck() function appeared in NetBSD 1.5.

MirOS BSD #10-current           August 3, 2000                               1

Generated on 2017-04-03 16:26:17 by $MirOS: src/scripts/roff2htm,v 1.88 2017/01/29 00:51:06 tg Exp $

These manual pages and other documentation are copyrighted by their respective writers; their source is available at our CVSweb, AnonCVS, and other mirrors. The rest is Copyright © 2002–2017 The MirOS Project, Germany.
This product includes material provided by mirabilos.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.