Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/linux/vm_sockets.h
$ cat -n /usr/include/linux/vm_sockets.h 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * VMware vSockets Driver 4 * 5 * Copyright (C) 2007-2013 VMware, Inc. All rights reserved. 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by the Free 9 * Software Foundation version 2 and no later version. 10 * 11 * This program is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 * more details. 15 */ 16 17 #ifndef _VM_SOCKETS_H 18 #define _VM_SOCKETS_H 19 20 #include
/* for struct sockaddr and sa_family_t */ 21 22 #include
23 #include
24 25 /* Option name for STREAM socket buffer size. Use as the option name in 26 * setsockopt(3) or getsockopt(3) to set or get an unsigned long long that 27 * specifies the size of the buffer underlying a vSockets STREAM socket. 28 * Value is clamped to the MIN and MAX. 29 */ 30 31 #define SO_VM_SOCKETS_BUFFER_SIZE 0 32 33 /* Option name for STREAM socket minimum buffer size. Use as the option name 34 * in setsockopt(3) or getsockopt(3) to set or get an unsigned long long that 35 * specifies the minimum size allowed for the buffer underlying a vSockets 36 * STREAM socket. 37 */ 38 39 #define SO_VM_SOCKETS_BUFFER_MIN_SIZE 1 40 41 /* Option name for STREAM socket maximum buffer size. Use as the option name 42 * in setsockopt(3) or getsockopt(3) to set or get an unsigned long long 43 * that specifies the maximum size allowed for the buffer underlying a 44 * vSockets STREAM socket. 45 */ 46 47 #define SO_VM_SOCKETS_BUFFER_MAX_SIZE 2 48 49 /* Option name for socket peer's host-specific VM ID. Use as the option name 50 * in getsockopt(3) to get a host-specific identifier for the peer endpoint's 51 * VM. The identifier is a signed integer. 52 * Only available for hypervisor endpoints. 53 */ 54 55 #define SO_VM_SOCKETS_PEER_HOST_VM_ID 3 56 57 /* Option name for determining if a socket is trusted. Use as the option name 58 * in getsockopt(3) to determine if a socket is trusted. The value is a 59 * signed integer. 60 */ 61 62 #define SO_VM_SOCKETS_TRUSTED 5 63 64 /* Option name for STREAM socket connection timeout. Use as the option name 65 * in setsockopt(3) or getsockopt(3) to set or get the connection 66 * timeout for a STREAM socket. 67 */ 68 69 #define SO_VM_SOCKETS_CONNECT_TIMEOUT_OLD 6 70 71 /* Option name for using non-blocking send/receive. Use as the option name 72 * for setsockopt(3) or getsockopt(3) to set or get the non-blocking 73 * transmit/receive flag for a STREAM socket. This flag determines whether 74 * send() and recv() can be called in non-blocking contexts for the given 75 * socket. The value is a signed integer. 76 * 77 * This option is only relevant to kernel endpoints, where descheduling the 78 * thread of execution is not allowed, for example, while holding a spinlock. 79 * It is not to be confused with conventional non-blocking socket operations. 80 * 81 * Only available for hypervisor endpoints. 82 */ 83 84 #define SO_VM_SOCKETS_NONBLOCK_TXRX 7 85 86 #define SO_VM_SOCKETS_CONNECT_TIMEOUT_NEW 8 87 88 #if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__)) 89 #define SO_VM_SOCKETS_CONNECT_TIMEOUT SO_VM_SOCKETS_CONNECT_TIMEOUT_OLD 90 #else 91 #define SO_VM_SOCKETS_CONNECT_TIMEOUT \ 92 (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_VM_SOCKETS_CONNECT_TIMEOUT_OLD : SO_VM_SOCKETS_CONNECT_TIMEOUT_NEW) 93 #endif 94 95 /* The vSocket equivalent of INADDR_ANY. This works for the svm_cid field of 96 * sockaddr_vm and indicates the context ID of the current endpoint. 97 */ 98 99 #define VMADDR_CID_ANY -1U 100 101 /* Bind to any available port. Works for the svm_port field of 102 * sockaddr_vm. 103 */ 104 105 #define VMADDR_PORT_ANY -1U 106 107 /* Use this as the destination CID in an address when referring to the 108 * hypervisor. VMCI relies on it being 0, but this would be useful for other 109 * transports too. 110 */ 111 112 #define VMADDR_CID_HYPERVISOR 0 113 114 /* Use this as the destination CID in an address when referring to the 115 * local communication (loopback). 116 * (This was VMADDR_CID_RESERVED, but even VMCI doesn't use it anymore, 117 * it was a legacy value from an older release). 118 */ 119 120 #define VMADDR_CID_LOCAL 1 121 122 /* Use this as the destination CID in an address when referring to the host 123 * (any process other than the hypervisor). VMCI relies on it being 2, but 124 * this would be useful for other transports too. 125 */ 126 127 #define VMADDR_CID_HOST 2 128 129 /* The current default use case for the vsock channel is the following: 130 * local vsock communication between guest and host and nested VMs setup. 131 * In addition to this, implicitly, the vsock packets are forwarded to the host 132 * if no host->guest vsock transport is set. 133 * 134 * Set this flag value in the sockaddr_vm corresponding field if the vsock 135 * packets need to be always forwarded to the host. Using this behavior, 136 * vsock communication between sibling VMs can be setup. 137 * 138 * This way can explicitly distinguish between vsock channels created for 139 * different use cases, such as nested VMs (or local communication between 140 * guest and host) and sibling VMs. 141 * 142 * The flag can be set in the connect logic in the user space application flow. 143 * In the listen logic (from kernel space) the flag is set on the remote peer 144 * address. This happens for an incoming connection when it is routed from the 145 * host and comes from the guest (local CID and remote CID > VMADDR_CID_HOST). 146 */ 147 #define VMADDR_FLAG_TO_HOST 0x01 148 149 /* Invalid vSockets version. */ 150 151 #define VM_SOCKETS_INVALID_VERSION -1U 152 153 /* The epoch (first) component of the vSockets version. A single byte 154 * representing the epoch component of the vSockets version. 155 */ 156 157 #define VM_SOCKETS_VERSION_EPOCH(_v) (((_v) & 0xFF000000) >> 24) 158 159 /* The major (second) component of the vSockets version. A single byte 160 * representing the major component of the vSockets version. Typically 161 * changes for every major release of a product. 162 */ 163 164 #define VM_SOCKETS_VERSION_MAJOR(_v) (((_v) & 0x00FF0000) >> 16) 165 166 /* The minor (third) component of the vSockets version. Two bytes representing 167 * the minor component of the vSockets version. 168 */ 169 170 #define VM_SOCKETS_VERSION_MINOR(_v) (((_v) & 0x0000FFFF)) 171 172 /* Address structure for vSockets. The address family should be set to 173 * AF_VSOCK. The structure members should all align on their natural 174 * boundaries without resorting to compiler packing directives. The total size 175 * of this structure should be exactly the same as that of struct sockaddr. 176 */ 177 178 struct sockaddr_vm { 179 __kernel_sa_family_t svm_family; 180 unsigned short svm_reserved1; 181 unsigned int svm_port; 182 unsigned int svm_cid; 183 __u8 svm_flags; 184 unsigned char svm_zero[sizeof(struct sockaddr) - 185 sizeof(sa_family_t) - 186 sizeof(unsigned short) - 187 sizeof(unsigned int) - 188 sizeof(unsigned int) - 189 sizeof(__u8)]; 190 }; 191 192 #define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9) 193 194 /* MSG_ZEROCOPY notifications are encoded in the standard error format, 195 * sock_extended_err. See Documentation/networking/msg_zerocopy.rst in 196 * kernel source tree for more details. 197 */ 198 199 /* 'cmsg_level' field value of 'struct cmsghdr' for notification parsing 200 * when MSG_ZEROCOPY flag is used on transmissions. 201 */ 202 203 #define SOL_VSOCK 287 204 205 /* 'cmsg_type' field value of 'struct cmsghdr' for notification parsing 206 * when MSG_ZEROCOPY flag is used on transmissions. 207 */ 208 209 #define VSOCK_RECVERR 1 210 211 #endif /* _VM_SOCKETS_H */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2026 MyWebUniversity.com ™