10b2e6644SGerard Garcia #ifndef _UAPI_VSOCKMON_H 20b2e6644SGerard Garcia #define _UAPI_VSOCKMON_H 30b2e6644SGerard Garcia 40b2e6644SGerard Garcia #include <linux/virtio_vsock.h> 50b2e6644SGerard Garcia 60b2e6644SGerard Garcia /* 70b2e6644SGerard Garcia * vsockmon is the AF_VSOCK packet capture device. Packets captured have the 80b2e6644SGerard Garcia * following layout: 90b2e6644SGerard Garcia * 100b2e6644SGerard Garcia * +-----------------------------------+ 110b2e6644SGerard Garcia * | vsockmon header | 120b2e6644SGerard Garcia * | (struct af_vsockmon_hdr) | 130b2e6644SGerard Garcia * +-----------------------------------+ 140b2e6644SGerard Garcia * | transport header | 150b2e6644SGerard Garcia * | (af_vsockmon_hdr->len bytes long) | 160b2e6644SGerard Garcia * +-----------------------------------+ 170b2e6644SGerard Garcia * | payload | 180b2e6644SGerard Garcia * | (until end of packet) | 190b2e6644SGerard Garcia * +-----------------------------------+ 200b2e6644SGerard Garcia * 210b2e6644SGerard Garcia * The vsockmon header is a transport-independent description of the packet. 220b2e6644SGerard Garcia * It duplicates some of the information from the transport header so that 230b2e6644SGerard Garcia * no transport-specific knowledge is necessary to process packets. 240b2e6644SGerard Garcia * 250b2e6644SGerard Garcia * The transport header is useful for low-level transport-specific packet 260b2e6644SGerard Garcia * analysis. Transport type is given in af_vsockmon_hdr->transport and 270b2e6644SGerard Garcia * transport header length is given in af_vsockmon_hdr->len. 280b2e6644SGerard Garcia * 290b2e6644SGerard Garcia * If af_vsockmon_hdr->op is AF_VSOCK_OP_PAYLOAD then the payload follows the 300b2e6644SGerard Garcia * transport header. Other ops do not have a payload. 310b2e6644SGerard Garcia */ 320b2e6644SGerard Garcia 330b2e6644SGerard Garcia struct af_vsockmon_hdr { 340b2e6644SGerard Garcia __le64 src_cid; 350b2e6644SGerard Garcia __le64 dst_cid; 360b2e6644SGerard Garcia __le32 src_port; 370b2e6644SGerard Garcia __le32 dst_port; 380b2e6644SGerard Garcia __le16 op; /* enum af_vsockmon_op */ 390b2e6644SGerard Garcia __le16 transport; /* enum af_vsockmon_transport */ 400b2e6644SGerard Garcia __le16 len; /* Transport header length */ 410b2e6644SGerard Garcia __u8 reserved[2]; 420b2e6644SGerard Garcia }; 430b2e6644SGerard Garcia 440b2e6644SGerard Garcia enum af_vsockmon_op { 450b2e6644SGerard Garcia AF_VSOCK_OP_UNKNOWN = 0, 460b2e6644SGerard Garcia AF_VSOCK_OP_CONNECT = 1, 470b2e6644SGerard Garcia AF_VSOCK_OP_DISCONNECT = 2, 480b2e6644SGerard Garcia AF_VSOCK_OP_CONTROL = 3, 490b2e6644SGerard Garcia AF_VSOCK_OP_PAYLOAD = 4, 500b2e6644SGerard Garcia }; 510b2e6644SGerard Garcia 520b2e6644SGerard Garcia enum af_vsockmon_transport { 530b2e6644SGerard Garcia AF_VSOCK_TRANSPORT_UNKNOWN = 0, 540b2e6644SGerard Garcia AF_VSOCK_TRANSPORT_NO_INFO = 1, /* No transport information */ 550b2e6644SGerard Garcia 560b2e6644SGerard Garcia /* Transport header type: struct virtio_vsock_hdr */ 570b2e6644SGerard Garcia AF_VSOCK_TRANSPORT_VIRTIO = 2, 580b2e6644SGerard Garcia }; 590b2e6644SGerard Garcia 600b2e6644SGerard Garcia #endif 61