summary refs log tree commit diff
path: root/vsock.h
blob: 0b7d15737d50efb8d9ab7df602e0b994f2f22d0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2020-2021 Alyssa Ross <hi@alyssa.is>

#include <stdint.h>

// All functions taking `cid'/`port' output parameters will fail with
// EPROTOTYPE if the given file descriptor is not an AF_VSOCK socket.
// The socket is left in an undefined state after this.
//
// `cid'/`port' output parameters can be NULL if the information is
// not required.
//
// A return value of -1 indicates failure.  `errno' can be consulted for
// further information.

int vsock_bind(int fd, uint32_t cid, uint32_t port);
int vsock_accept(int sockfd, uint32_t *cid, uint32_t *port);

int vsock_connect(int fd, uint32_t cid, uint32_t port);
int vsock_open(uint32_t cid, uint32_t port);

int vsock_get_cid_and_port(int fd, uint32_t *cid, uint32_t *port);