Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
0003  * anyone can use the definitions to implement compatible drivers/servers:
0004  *
0005  *
0006  * Redistribution and use in source and binary forms, with or without
0007  * modification, are permitted provided that the following conditions
0008  * are met:
0009  * 1. Redistributions of source code must retain the above copyright
0010  *    notice, this list of conditions and the following disclaimer.
0011  * 2. Redistributions in binary form must reproduce the above copyright
0012  *    notice, this list of conditions and the following disclaimer in the
0013  *    documentation and/or other materials provided with the distribution.
0014  * 3. Neither the name of IBM nor the names of its contributors
0015  *    may be used to endorse or promote products derived from this software
0016  *    without specific prior written permission.
0017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
0018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0020  * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
0021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0027  * SUCH DAMAGE.
0028  *
0029  * Copyright (C) Red Hat, Inc., 2013-2015
0030  * Copyright (C) Asias He <asias@redhat.com>, 2013
0031  * Copyright (C) Stefan Hajnoczi <stefanha@redhat.com>, 2015
0032  */
0033 
0034 #ifndef _UAPI_LINUX_VIRTIO_VSOCK_H
0035 #define _UAPI_LINUX_VIRTIO_VSOCK_H
0036 
0037 #include <linux/types.h>
0038 #include <linux/virtio_ids.h>
0039 #include <linux/virtio_config.h>
0040 
0041 /* The feature bitmap for virtio vsock */
0042 #define VIRTIO_VSOCK_F_SEQPACKET    1   /* SOCK_SEQPACKET supported */
0043 
0044 struct virtio_vsock_config {
0045     __le64 guest_cid;
0046 } __attribute__((packed));
0047 
0048 enum virtio_vsock_event_id {
0049     VIRTIO_VSOCK_EVENT_TRANSPORT_RESET = 0,
0050 };
0051 
0052 struct virtio_vsock_event {
0053     __le32 id;
0054 } __attribute__((packed));
0055 
0056 struct virtio_vsock_hdr {
0057     __le64  src_cid;
0058     __le64  dst_cid;
0059     __le32  src_port;
0060     __le32  dst_port;
0061     __le32  len;
0062     __le16  type;       /* enum virtio_vsock_type */
0063     __le16  op;     /* enum virtio_vsock_op */
0064     __le32  flags;
0065     __le32  buf_alloc;
0066     __le32  fwd_cnt;
0067 } __attribute__((packed));
0068 
0069 enum virtio_vsock_type {
0070     VIRTIO_VSOCK_TYPE_STREAM = 1,
0071     VIRTIO_VSOCK_TYPE_SEQPACKET = 2,
0072 };
0073 
0074 enum virtio_vsock_op {
0075     VIRTIO_VSOCK_OP_INVALID = 0,
0076 
0077     /* Connect operations */
0078     VIRTIO_VSOCK_OP_REQUEST = 1,
0079     VIRTIO_VSOCK_OP_RESPONSE = 2,
0080     VIRTIO_VSOCK_OP_RST = 3,
0081     VIRTIO_VSOCK_OP_SHUTDOWN = 4,
0082 
0083     /* To send payload */
0084     VIRTIO_VSOCK_OP_RW = 5,
0085 
0086     /* Tell the peer our credit info */
0087     VIRTIO_VSOCK_OP_CREDIT_UPDATE = 6,
0088     /* Request the peer to send the credit info to us */
0089     VIRTIO_VSOCK_OP_CREDIT_REQUEST = 7,
0090 };
0091 
0092 /* VIRTIO_VSOCK_OP_SHUTDOWN flags values */
0093 enum virtio_vsock_shutdown {
0094     VIRTIO_VSOCK_SHUTDOWN_RCV = 1,
0095     VIRTIO_VSOCK_SHUTDOWN_SEND = 2,
0096 };
0097 
0098 /* VIRTIO_VSOCK_OP_RW flags values */
0099 enum virtio_vsock_rw {
0100     VIRTIO_VSOCK_SEQ_EOM = 1,
0101     VIRTIO_VSOCK_SEQ_EOR = 2,
0102 };
0103 
0104 #endif /* _UAPI_LINUX_VIRTIO_VSOCK_H */