Module pueue_lib::network::protocol[][src]

Expand description

This is a higher-level abstraction layer used for simple communication This is probably the most interesting part for you.

Traits

Listener

A new trait, which can be used to represent Unix- and TcpListeners.
This is necessary to easily write generic functions where both types can be used.

Stream

A new trait, which can be used to represent Unix- and Tls encrypted TcpStreams.
This is necessary to write generic functions where both types can be used.

Functions

get_client_stream

Get a new stream for the client.
This can either be a UnixStream or a Tls encrypted TCPStream, depending on the parameters.

get_listener

Get a new listener for the daemon.
This can either be a UnixListener or a TCPlistener, depending on the parameters.

receive_bytes

Receive a byte stream.
This is the basic protocol beneath all pueue communication.

receive_message

Convenience wrapper that receives a message and converts it into a Message.

send_bytes

Send a Vec of bytes. Before the actual bytes are send, the size of the message is transmitted in an header of fixed size (u64).

send_message

Convenience wrapper around send_bytes. Deserialize a message and feed the bytes into send_bytes.

socket_cleanup

Unix specific cleanup handling when getting a SIGINT/SIGTERM.

Type Definitions

GenericListener

Convenience type, so we don’t have type write Box<dyn Listener> all the time.

GenericStream

Convenience type, so we don’t have type write Box<dyn Stream> all the time.
This also prevents name collisions, since Stream is imported in many preludes.