Vendored from viosock/inc/vio_sockets.h in kvm-guest-drivers-windows (d76a29c1), reformatted to QEMU coding style (SPDX tag, comment rewrapping, brace placement, include guard).
The upstream BSD-3-Clause license was retained because no significant changes were made. Signed-off-by: Polina Vishneva <[email protected]> --- MAINTAINERS | 1 + include/system/vio_sockets.h | 57 ++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 include/system/vio_sockets.h diff --git a/MAINTAINERS b/MAINTAINERS index 93df53d87f..3ff59ec0a7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3868,6 +3868,7 @@ Sockets M: Daniel P. Berrange <[email protected]> S: Maintained F: include/qemu/sockets.h +F: include/system/vio_sockets.h F: util/qemu-sockets.c F: qapi/sockets.json diff --git a/include/system/vio_sockets.h b/include/system/vio_sockets.h new file mode 100644 index 0000000000..480df24d37 --- /dev/null +++ b/include/system/vio_sockets.h @@ -0,0 +1,57 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Core definitions for virtio VSOCK address family, based on + * linux/vm_sockets.h and kvm-guest-drivers-windows (d76a29c1). + * + * Copyright (c) 2019 Virtuozzo International GmbH + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met : + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and / or other materials provided with the distribution. + * 3. Neither the names of the copyright holders nor the names of their + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef VIO_SOCKETS_H +#define VIO_SOCKETS_H + +#include <ws2def.h> + +#ifndef AF_VSOCK +#define AF_VSOCK 40 +#endif + +#ifndef PF_VSOCK +#define PF_VSOCK AF_VSOCK +#endif + +/* + * Address structure for virtio vsockets. The address family should be set to + * AF_VSOCK. The structure members should all align on their natural + * boundaries without resorting to compiler packing directives. + */ +typedef struct sockaddr_vm { + ADDRESS_FAMILY svm_family; /* Address family: AF_VSOCK */ + USHORT svm_reserved1; + UINT svm_port; /* Port # in host byte order */ + UINT svm_cid; /* Address in host byte order */ +} SOCKADDR_VM, *PSOCKADDR_VM; + +#endif /* VIO_SOCKETS_H */ -- 2.54.0
