|
cwebs 0.2.1
WebSocket wire protocol
|
Web Socket wire protocol (out-bound) for C. More...
Go to the source code of this file.
Functions | |
| void | ws_owire_init (struct ws_owire *stream) |
| Initialize a writer. | |
| void | ws_owire_new_message (struct ws_owire *stream) |
| Start a new message. | |
| void | ws_owire_end_message (struct ws_owire *stream) |
| End a message, clearing the state for the next message. | |
| void | ws_owire_new_frame (struct ws_owire *stream, uint64 size) |
| Start a frame with a size byte payload. | |
| void | ws_owire_end_frame (struct ws_owire *stream) |
| End a frame, clearing the state for the next frame. | |
| void | ws_owire_last (struct ws_owire *stream) |
| Mark the current frame as the last fragment in a message. | |
| void | ws_owire_eval (struct ws_owire *stream, uint8 eval) |
| Set the WebSocket extension code. | |
| void | ws_owire_code (struct ws_owire *stream, uint8 code) |
| Set the WebSocket message opcode. | |
| void | ws_owire_mask (struct ws_owire *stream) |
| Mark the fragment as masked. | |
| uint64 | ws_owire_feed (struct ws_owire *stream, const void *data, uint64 size) |
| Add data to the application payload. | |
| void | ws_owire_put_text (struct ws_owire *stream, const void *data, uint64 size) |
| Send a full text message in a single call. | |
| void | ws_owire_put_data (struct ws_owire *stream, const void *data, uint64 size) |
| Send a full binary data message in a single call. | |
| void | ws_owire_put_kill (struct ws_owire *stream, const void *data, uint64 size) |
| Send a full end-of-stream message in a single call. | |
| void | ws_owire_put_ping (struct ws_owire *stream, const void *data, uint64 size) |
| Send a full ping message in a single call. | |
| void | ws_owire_put_pong (struct ws_owire *stream, const void *data, uint64 size) |
| Send a full pong message in a single call. | |
Web Socket wire protocol (out-bound) for C.
Definition in file owire.c.
Set the WebSocket message opcode.
| stream | The curernt writer state. |
| code | The message opcode. |
This method should not be used unless the WebSocket protocol specification is updated add new control message codes before the library is updated to implement the extended specification. Use the explicit named functions for application clarity.
| void ws_owire_end_frame | ( | struct ws_owire * | stream | ) |
End a frame, clearing the state for the next frame.
| stream | Current writer state. |
| void ws_owire_end_message | ( | struct ws_owire * | stream | ) |
End a message, clearing the state for the next message.
| stream | Current writer state. |
Add data to the application payload.
| stream | The current writer state. |
| data | Array of bytes to write. Accessing past size bytes in this array results in undefined behavior. |
| size | Number of bytes in data to forward. |
You may invoke this function multiple times to reach the total fragment payload size given to ws_owire_new_frame().
| void ws_owire_init | ( | struct ws_owire * | stream | ) |
| void ws_owire_last | ( | struct ws_owire * | stream | ) |
| void ws_owire_mask | ( | struct ws_owire * | stream | ) |
Mark the fragment as masked.
| stream | The current writer state. |
This will indirectly invoke the ws_owire::rand callback to generate a random mask.
Start a frame with a size byte payload.
| stream | Current writer state. |
| size | Size of the frame payload, in bytes. |
| void ws_owire_new_message | ( | struct ws_owire * | stream | ) |
Send a full binary data message in a single call.
| stream | The current writer state. |
| data | Payload data. |
| size | Payload size, in bytes. |
Send a full end-of-stream message in a single call.
| stream | The current writer state. |
| data | Payload data. |
| size | Payload size, in bytes. |
The payload must be UTF-8 encoded text.
ws_owire::auto_fragment setting.Send a full ping message in a single call.
| stream | The current writer state. |
| data | Payload data. |
| size | Payload size, in bytes. |
ws_owire::auto_fragment setting. Send a full pong message in a single call.
| stream | The current writer state. |
| data | Payload data. |
| size | Payload size, in bytes. |
ws_owire::auto_fragment setting. Send a full text message in a single call.
| stream | The current writer state. |
| data | Payload data. |
| size | Payload size, in bytes. |