|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
use super::error::{self, SocketError};
|
|
|
use crate::volatile::ReadOnly;
|
|
|
+use bitflags::bitflags;
|
|
|
use core::{
|
|
|
convert::{TryFrom, TryInto},
|
|
|
fmt,
|
|
@@ -17,6 +18,8 @@ use zerocopy::{
|
|
|
pub enum SocketType {
|
|
|
/// Stream sockets provide in-order, guaranteed, connection-oriented delivery without message boundaries.
|
|
|
Stream = 1,
|
|
|
+ /// seqpacket socket type introduced in virtio-v1.2.
|
|
|
+ SeqPacket = 2,
|
|
|
}
|
|
|
|
|
|
impl From<SocketType> for U16<LittleEndian> {
|
|
@@ -182,3 +185,29 @@ impl fmt::Debug for VirtioVsockOp {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+bitflags! {
|
|
|
+ #[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
|
|
|
+ pub(crate) struct Feature: u64 {
|
|
|
+ /// stream socket type is supported.
|
|
|
+ const STREAM = 1 << 0;
|
|
|
+ /// seqpacket socket type is supported.
|
|
|
+ const SEQ_PACKET = 1 << 1;
|
|
|
+
|
|
|
+ // device independent
|
|
|
+ const NOTIFY_ON_EMPTY = 1 << 24; // legacy
|
|
|
+ const ANY_LAYOUT = 1 << 27; // legacy
|
|
|
+ const RING_INDIRECT_DESC = 1 << 28;
|
|
|
+ const RING_EVENT_IDX = 1 << 29;
|
|
|
+ const UNUSED = 1 << 30; // legacy
|
|
|
+ const VERSION_1 = 1 << 32; // detect legacy
|
|
|
+
|
|
|
+ // since virtio v1.1
|
|
|
+ const ACCESS_PLATFORM = 1 << 33;
|
|
|
+ const RING_PACKED = 1 << 34;
|
|
|
+ const IN_ORDER = 1 << 35;
|
|
|
+ const ORDER_PLATFORM = 1 << 36;
|
|
|
+ const SR_IOV = 1 << 37;
|
|
|
+ const NOTIFICATION_DATA = 1 << 38;
|
|
|
+ }
|
|
|
+}
|