Blame


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