Implement WebSocket reverse proxy
This commit is contained in:
36
src/lib/websocket.h
Normal file
36
src/lib/websocket.h
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Necronda Web Server
|
||||
* WebSocket reverse proxy (header file)
|
||||
* src/lib/websocket.h
|
||||
* Lorenz Stechauner, 2022-08-16
|
||||
*/
|
||||
|
||||
#ifndef NECRONDA_SERVER_WEBSOCKET_H
|
||||
#define NECRONDA_SERVER_WEBSOCKET_H
|
||||
|
||||
#include "sock.h"
|
||||
|
||||
#define WS_TIMEOUT 3600
|
||||
|
||||
const char *ws_key_uuid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
||||
|
||||
typedef struct {
|
||||
unsigned char f_fin:1;
|
||||
unsigned char f_rsv1:1;
|
||||
unsigned char f_rsv2:1;
|
||||
unsigned char f_rsv3:1;
|
||||
unsigned char opcode:4;
|
||||
unsigned char f_mask:1;
|
||||
unsigned long len;
|
||||
char masking_key[4];
|
||||
} ws_frame;
|
||||
|
||||
int ws_calc_accept_key(const char *key, char *accept_key);
|
||||
|
||||
int ws_recv_frame_header(sock *s, ws_frame *frame);
|
||||
|
||||
int ws_send_frame_header(sock *s, ws_frame *frame);
|
||||
|
||||
int ws_handle_connection(sock *s1, sock *s2);
|
||||
|
||||
#endif // NECRONDA_SERVER_WEBSOCKET_H
|
Reference in New Issue
Block a user