Mercurial
annotate seobeo/s_websocket_common.c @ 215:c3df85159b31
removed a python library that isn't used for much.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Sat, 28 Feb 2026 20:34:18 -0800 |
| parents | f236c895604e |
| children |
| 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 } |