public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob 0e97afa1128051e6caac96b6b463363797348bde 1347 bytes (raw)

 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 
/* 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

union inany_addr;
union sockaddr_inany;

/**
 * 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 "?";
}

static inline const char *pif_name(uint8_t pif)
{
	return pif_type(pif);
}

/**
 * pif_is_socket() - Is interface implemented via L4 sockets?
 * @pif:     pif to check
 *
 * Return: true of @pif is an L4 socket based interface, otherwise false
 */
static inline bool pif_is_socket(uint8_t pif)
{
	return pif == PIF_HOST || pif == PIF_SPLICE;
}

bool pif_sockaddr(const struct ctx *c, union sockaddr_inany *sa, socklen_t *sl,
		  uint8_t pif, const union inany_addr *addr, in_port_t port);

#endif /* PIF_H */

debug log:

solving 0e97afa1 ...
found 0e97afa1 in https://archives.passt.top/passt-dev/20240705020724.3447719-3-david@gibson.dropbear.id.au/
found ca85b349 in https://passt.top/passt
preparing index
index prepared:
100644 ca85b3497f9b2de5406c88d1d0f74938798d1919	pif.h

applying [1/1] https://archives.passt.top/passt-dev/20240705020724.3447719-3-david@gibson.dropbear.id.au/
diff --git a/pif.h b/pif.h
index ca85b349..0e97afa1 100644

Checking patch pif.h...
Applied patch pif.h cleanly.

index at:
100644 0e97afa1128051e6caac96b6b463363797348bde	pif.h

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).