annotate seobeo/s_websocket_common.c @ 160:948de3f54cea

[ThirdParty] Added libuv
author June Park <parkjune1995@gmail.com>
date Wed, 14 Jan 2026 19:39:52 -0800
parents f236c895604e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
125
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
1 #include "seobeo/seobeo.h"
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
2 #include "seobeo/seobeo_internal.h"
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
3
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
4 // Mask/unmask data with XOR operation (same for both directions)
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
5 void Seobeo_WebSocket_Mask_Data(uint8 *data, size_t length, const uint8 *mask)
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
6 {
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
7 for (size_t i = 0; i < length; i++)
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
8 {
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
9 data[i] ^= mask[i % 4];
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
10 }
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
11 }
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
12
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
13 // Destroy a WebSocket message
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
14 void Seobeo_WebSocket_Message_Destroy(Seobeo_WebSocket_Message *p_msg)
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
15 {
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
16 if (!p_msg)
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
17 return;
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
18
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
19 if (p_msg->data)
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
20 free(p_msg->data);
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
21
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
22 free(p_msg);
f236c895604e [MrJuneJune] Added web socket for chat to this.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
23 }