💾 Archived View for gmi.noulin.net › gitRepositories › ws › file › ws.h.gmi captured on 2023-07-10 at 18:01:54. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
ws.h (1487B)
1 #pragma once 2 #include <stdbool.h> // bool 3 #include <sys/types.h> // size_t and ssize_t 4 5 typedef enum { 6 WS_OP_CONT = 0x00, 7 WS_OP_TEXT = 0x01, 8 WS_OP_BINARY = 0x02, 9 WS_OP_CLOSE = 0x08, 10 WS_OP_PING = 0x09, 11 WS_OP_PONG = 0x0a 12 } wsOpt; 13 14 #define WS_FINAL true 15 #define WS_NOT_FINAL false 16 17 size_t wsHandshakeSize (char *hostname); 18 int wsHandshake (char *frame, size_t size, char *hostname); 19 bool wsHanskakeCheck (char *frame, size_t size); 20 21 ssize_t wsMaskSize (wsOpt op, size_t pSize); 22 ssize_t wsNoMaskSize (wsOpt op, size_t pSize); 23 ssize_t wsControlMaskSize (void); 24 ssize_t wsControlNoMaskSize(void); 25 26 bool wsMask (char *frame, size_t size, wsOpt op, char *payload, size_t pSize, bool final); 27 bool wsNoMask (char *frame, size_t size, wsOpt op, char *payload, size_t pSize, bool final); 28 bool wsControlMask (char *frame, wsOpt op); 29 bool wsControlNoMask (char *frame, wsOpt op); 30 31 size_t wsDecodeSize (char *frame); 32 void wsDecode (char *data, size_t size, char *frame, size_t fSize); 33 char *wsDecodePayOffset (char *frame); 34 char *wsDecodeInPlace (char *frame, size_t size); 35 bool wsIsFinal (char *frame); 36 bool wsIsMasked (char *frame); 37 wsOpt wsDecodeOp (char *frame); 38 39 #define isWsCompiledWithCurrentLisheepyVersion checkLibsheepyVersionWs(LIBSHEEPY_VERSION) 40 bool checkLibsheepyVersionWs(const char *currentLibsheepyVersion);