Mercurial
comparison seobeo/s_websocket_common.c @ 125:f236c895604e
[MrJuneJune] Added web socket for chat to this.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Thu, 08 Jan 2026 08:46:49 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 124:dbf14f84d51c | 125:f236c895604e |
|---|---|
| 1 #include "seobeo/seobeo.h" | |
| 2 #include "seobeo/seobeo_internal.h" | |
| 3 | |
| 4 // Mask/unmask data with XOR operation (same for both directions) | |
| 5 void Seobeo_WebSocket_Mask_Data(uint8 *data, size_t length, const uint8 *mask) | |
| 6 { | |
| 7 for (size_t i = 0; i < length; i++) | |
| 8 { | |
| 9 data[i] ^= mask[i % 4]; | |
| 10 } | |
| 11 } | |
| 12 | |
| 13 // Destroy a WebSocket message | |
| 14 void Seobeo_WebSocket_Message_Destroy(Seobeo_WebSocket_Message *p_msg) | |
| 15 { | |
| 16 if (!p_msg) | |
| 17 return; | |
| 18 | |
| 19 if (p_msg->data) | |
| 20 free(p_msg->data); | |
| 21 | |
| 22 free(p_msg); | |
| 23 } |