Blame


1 31ba2236 2022-01-05 thomas /*
2 31ba2236 2022-01-05 thomas * Copyright (c) 2022 Stefan Sperling <stsp@openbsd.org>
3 31ba2236 2022-01-05 thomas *
4 31ba2236 2022-01-05 thomas * Permission to use, copy, modify, and distribute this software for any
5 31ba2236 2022-01-05 thomas * purpose with or without fee is hereby granted, provided that the above
6 31ba2236 2022-01-05 thomas * copyright notice and this permission notice appear in all copies.
7 31ba2236 2022-01-05 thomas *
8 31ba2236 2022-01-05 thomas * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 31ba2236 2022-01-05 thomas * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 31ba2236 2022-01-05 thomas * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 31ba2236 2022-01-05 thomas * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 31ba2236 2022-01-05 thomas * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 31ba2236 2022-01-05 thomas * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 31ba2236 2022-01-05 thomas * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 31ba2236 2022-01-05 thomas */
16 31ba2236 2022-01-05 thomas
17 31ba2236 2022-01-05 thomas struct got_ratelimit {
18 31ba2236 2022-01-05 thomas struct timespec last;
19 31ba2236 2022-01-05 thomas struct timespec interval;
20 31ba2236 2022-01-05 thomas };
21 31ba2236 2022-01-05 thomas
22 31ba2236 2022-01-05 thomas void got_ratelimit_init(struct got_ratelimit *, time_t, unsigned int);
23 31ba2236 2022-01-05 thomas const struct got_error *got_ratelimit_check(int *, struct got_ratelimit *);