aboutsummaryrefslogtreecommitdiff
path: root/src/Limiter/RateLimit.h
blob: fabd05d912b98311f1d3f7bc4e504a5d9eb041d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef RATE_LIMIT_H
#define RATE_LIMIT_H

#include <stddef.h>

typedef struct {
  int max_requests;
  int interval_seconds;
} RateLimitConfig;

typedef struct {
  int limited;
  int retry_after_seconds;
} RateLimitResult;

void rate_limit_get_client_key(char *client_key, size_t client_key_size);
RateLimitResult rate_limit_check(const char *scope,
                                 const RateLimitConfig *config);

#endif