aboutgitcodebugslistschat
path: root/pif.h
blob: bd52936496597a68c5bcd5ddf2b3069795661496 (plain) (blame)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright Red Hat
 * Author: David Gibson <david@gibson.dropbear.id.au>
 *
 * Passt/pasta interface types and IDs
 */
#ifndef PIF_H
#define PIF_H

/**
 * enum pif_type - Type of passt/pasta interface ("pif")
 *
 * pifs can be an L4 level channel (sockets) or an L2 level channel (tap device
 * or qemu socket).
 */
enum pif_type {
	/* Invalid or not present pif */
	PIF_NONE = 0,
	/* Host socket interface */
	PIF_HOST,
	/* Qemu socket or namespace tuntap interface */
	PIF_TAP,
	/* Namespace socket interface for splicing */
	PIF_SPLICE,

	PIF_NUM_TYPES,
};

#define PIF_NAMELEN	8

extern const char *pif_type_str[];

static inline const char *pif_type(enum pif_type pt)
{
	if (pt < PIF_NUM_TYPES)
		return pif_type_str[pt];
	else
		return "?";
}

/* cppcheck-suppress unusedFunction */
static inline const char *pif_name(uint8_t pif)
{
	return pif_type(pif);
}

#endif /* PIF_H */