summaryrefslogtreecommitdiffstats
path: root/src/nftutils.h
blob: cb584b9ca32b932091c16ac0616a1b929d029f2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef NFTUTILS_H
#define NFTUTILS_H

#include <stdbool.h>
#include <stddef.h>

/* The maximum buffer size for (struct protoent).p_name. It is excessively large,
 * while still reasonably fitting on the stack. Arbitrarily chosen. */
#define NFT_PROTONAME_MAXSIZE 1024

bool nft_getprotobynumber(int number, char *out_name, size_t name_len);
int nft_getprotobyname(const char *name);

/* The maximum buffer size for (struct servent).s_name. It is excessively large,
 * while still reasonably fitting on the stack. Arbitrarily chosen. */
#define NFT_SERVNAME_MAXSIZE 1024

bool nft_getservbyport(int port, const char *proto, char *out_name, size_t name_len);

#endif /* NFTUTILS_H */