summaryrefslogtreecommitdiff
path: root/accel-pppd/include/connlimit.h
blob: 2b2f0f4d59f6927c643f9f09bc1b50e9ed285e7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef __CONNLIMIT_H
#define __CONNLIMIT_H

#include <stdint.h>
#include <string.h>

static inline uint64_t cl_key_from_ipv4(uint32_t ip)
{
	return ip;
}

static inline uint64_t cl_key_from_mac(uint8_t hw[6])
{
	union {
		uint8_t hw[6];
		uint64_t key;
	} key = {{ 0 }};

	memcpy(key.hw, hw, sizeof(key.hw));

	return key.key;
}

int connlimit_check(uint64_t key);

#endif