package mirage-types
TCPv4 stack
A TCPv4 stack that can send and receive reliable streams using the TCP protocol.
type buffer = Cstruct.t
Abstract type for a memory buffer that may not be page aligned.
type ipv4addr = Ipaddr.V4.t
Abstract type for an IPv4 address representation.
An input function continuation to pass onto the underlying ipv4
stack. This will normally be a NOOP for a conventional kernel, but a direct implementation will parse the buffer.
type error = [
| `Unknown of string
(*an undiagnosed error.
*)| `Timeout
(*connection attempt did not get a valid response.
*)| `Refused
(*connection attempt was actively refused via an RST.
*)
]
IO operation errors
Get the destination IPv4 address and destination port that a flow is currently connected to.
read flow
will block until it either successfully reads a segment of data from the current flow, receives an Eof
signifying that the connection is now closed, or an Error
.
write flow buffer
will block until the contents of buffer
are transmitted to the remote endpoint. The contents may be transmitted in separate packets, depending on the underlying transport.
writev flow buffers
will block until the contents of buffer list
are all successfully transmitted to the remote endpoint.
write_nodelay flow
will block until the contents of buffer list
are all successfully transmitted to the remote endpoint. Buffering within the stack is minimized in this mode. Note that this API will change in a future revision to be a per-flow attribute instead of a separately exposed function.
writev_nodelay flow
will block until the contents of buffer list
are all successfully transmitted to the remote endpoint. Buffering within the stack is minimized in this mode. Note that this API will change in a future revision to be a per-flow attribute instead of a separately exposed function.
close flow
will signal to the remote endpoint that the flow is now shutdown. The caller should not perform any writes after this call.
create_connection t (addr,port)
will open a TCPv4 connection to the specified endpoint.