Module Eio_net_chaos.OpSource

The operations a wrapper sees.

type kind = [
  1. | `Connect
    (*

    A connect, a refused one included.

    *)
  2. | `Accept
    (*

    An accept of a connection.

    *)
  3. | `Read
    (*

    A read from a connection.

    *)
  4. | `Write
    (*

    A write to a connection.

    *)
  5. | `Recv
    (*

    A datagram taken by a receive.

    *)
]

The type for operation kinds.

type t = {
  1. index : int;
    (*

    The operation's place among all of them, from 1.

    *)
  2. kind : kind;
  3. socket : int;
    (*

    The connection or datagram socket, numbered from 1 in the order the network made them, a refused connect included.

    *)
  4. side : [ `Client | `Server ];
    (*

    The end of a connection: the one that connected, or the one that accepted. A datagram socket is a `Client.

    *)
  5. family : [ `Inet | `Unix ];
    (*

    The address family of the socket: TCP or UDP over IP, or a Unix-domain socket, which loses, reorders and garbles nothing.

    *)
  6. offset : int;
    (*

    The bytes this end read or wrote before, the datagrams this socket took before, or the connects or accepts before.

    *)
  7. length : int;
    (*

    The bytes a read asks for or a write offers, or the size of the datagram received.

    *)
}

The type for operations.

val pp : t Fmt.t

pp formats an operation for logs and reports, as #4 write 1s @0+5: its index, its kind, its socket and side, c for the end that connected and s for the one that accepted, then @ its offset and, for a read or a write, + its length.