Classes | |
| struct | AcceptOptions |
| What a reader takes. More... | |
| class | RingWriter |
| class | RingReader |
| class | StreamWriter |
| The writing end of one channel of a stream. More... | |
| class | StreamReader |
| The reading end of one channel of a stream. More... | |
| class | Stream |
Enumerations | |
| enum class | WriteResult { Written , WouldBlock , TooLarge , Closed } |
| enum class | ReadResult { Frame , Empty , Closed , Corrupt } |
Functions | |
| PHOSPHORCHANNEL_EXPORT bool | validCodec (std::string_view codec) |
| 1 to MaxCodecBytes of printable ASCII without spaces, such as "afterglow.state.v1". | |
| PHOSPHORCHANNEL_EXPORT std::string | versionMismatch (std::uint32_t theirs) |
| The message for two protocol versions that do not match. | |
| PHOSPHORCHANNEL_EXPORT bool | offerRing (int socket, RingWriter &ring, int timeoutMs, std::string *error) |
Sends ring over socket and waits for the answer. | |
| PHOSPHORCHANNEL_EXPORT std::unique_ptr< RingReader > | acceptRing (int socket, const AcceptOptions &options, int timeoutMs, std::string *error) |
Receives a ring over socket, maps it, and answers whether it took it. | |
Variables | |
| constexpr std::uint32_t | ProtocolVersion = 1 |
| Covers the handshakes, the stream's packets and the ring's layout. | |
| constexpr std::size_t | MaxCodecBytes = 64 |
| The longest codec tag, in bytes. | |
|
strong |
|
strong |
| PHOSPHORCHANNEL_EXPORT std::unique_ptr< RingReader > PhosphorChannel::acceptRing | ( | int | socket, |
| const AcceptOptions & | options, | ||
| int | timeoutMs, | ||
| std::string * | error ) |
Receives a ring over socket, maps it, and answers whether it took it.
Nullptr with error when it was refused or failed.
| PHOSPHORCHANNEL_EXPORT bool PhosphorChannel::offerRing | ( | int | socket, |
| RingWriter & | ring, | ||
| int | timeoutMs, | ||
| std::string * | error ) |
Sends ring over socket and waits for the answer.
A ring is offered once, whatever the answer. False with error when the reader refused it, the socket failed or the time ran out.
| PHOSPHORCHANNEL_EXPORT bool PhosphorChannel::validCodec | ( | std::string_view | codec | ) |
1 to MaxCodecBytes of printable ASCII without spaces, such as "afterglow.state.v1".
| PHOSPHORCHANNEL_EXPORT std::string PhosphorChannel::versionMismatch | ( | std::uint32_t | theirs | ) |
The message for two protocol versions that do not match.
|
inlineconstexpr |
The longest codec tag, in bytes.
|
inlineconstexpr |
Covers the handshakes, the stream's packets and the ring's layout.
Two ends with different versions refuse each other, with a message that names both. The codec tag, not this, versions a payload.