LibVNCServer/LibVNCClient
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
websockets.c File Reference
#include <rfb/rfb.h>
#include <resolv.h>
#include <errno.h>
#include <byteswap.h>
#include <string.h>
#include "rfbconfig.h"
#include "rfbssl.h"
#include "rfbcrypto.h"
+ Include dependency graph for websockets.c:

Go to the source code of this file.

Data Structures

struct  ws_ctx_t
 
union  ws_mask_t
 

Macros

#define WS_NTOH64(n)   bswap_64(n)
 
#define WS_NTOH32(n)   bswap_32(n)
 
#define WS_NTOH16(n)   bswap_16(n)
 
#define WS_HTON64(n)   bswap_64(n)
 
#define WS_HTON16(n)   bswap_16(n)
 
#define B64LEN(__x)   (((__x + 2) / 3) * 12 / 3)
 
#define WSHLENMAX   14 /* 2 + sizeof(uint64_t) + sizeof(uint32_t) */
 
#define FLASH_POLICY_RESPONSE   "<cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" /></cross-domain-policy>\n"
 
#define SZ_FLASH_POLICY_RESPONSE   93
 
#define GUID   "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
 
#define SERVER_HANDSHAKE_HIXIE   "HTTP/1.1 101 Web Socket Protocol Handshake\r\n\Upgrade: WebSocket\r\n\Connection: Upgrade\r\n\%sWebSocket-Origin: %s\r\n\%sWebSocket-Location: %s://%s%s\r\n\%sWebSocket-Protocol: %s\r\n\\r\n%s"
 
#define SERVER_HANDSHAKE_HYBI   "HTTP/1.1 101 Switching Protocols\r\n\Upgrade: websocket\r\n\Connection: Upgrade\r\n\Sec-WebSocket-Accept: %s\r\n\Sec-WebSocket-Protocol: %s\r\n\\r\n"
 
#define WEBSOCKETS_CLIENT_CONNECT_WAIT_MS   100
 
#define WEBSOCKETS_CLIENT_SEND_WAIT_MS   100
 
#define WEBSOCKETS_MAX_HANDSHAKE_LEN   4096
 

Typedefs

typedef int(* wsEncodeFunc )(rfbClientPtr cl, const char *src, int len, char **dst)
 
typedef int(* wsDecodeFunc )(rfbClientPtr cl, char *dst, int len)
 

Enumerations

enum  { WEBSOCKETS_VERSION_HIXIE, WEBSOCKETS_VERSION_HYBI }
 
enum  {
  WS_OPCODE_CONTINUATION = 0x0, WS_OPCODE_TEXT_FRAME, WS_OPCODE_BINARY_FRAME, WS_OPCODE_CLOSE = 0x8,
  WS_OPCODE_PING, WS_OPCODE_PONG
}
 

Functions

struct __attribute__ ((__packed__))
 
void webSocketsGenMd5 (char *target, char *key1, char *key2, char *key3)
 
rfbBool webSocketsCheck (rfbClientPtr cl)
 
int webSocketsEncode (rfbClientPtr cl, const char *src, int len, char **dst)
 
int webSocketsDecode (rfbClientPtr cl, char *dst, int len)
 
rfbBool webSocketCheckDisconnect (rfbClientPtr cl)
 

Variables

 ws_header_t
 

Macro Definition Documentation

#define B64LEN (   __x)    (((__x + 2) / 3) * 12 / 3)

Definition at line 54 of file websockets.c.

#define FLASH_POLICY_RESPONSE   "<cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" /></cross-domain-policy>\n"

Definition at line 117 of file websockets.c.

#define GUID   "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"

Definition at line 124 of file websockets.c.

#define SERVER_HANDSHAKE_HIXIE   "HTTP/1.1 101 Web Socket Protocol Handshake\r\n\Upgrade: WebSocket\r\n\Connection: Upgrade\r\n\%sWebSocket-Origin: %s\r\n\%sWebSocket-Location: %s://%s%s\r\n\%sWebSocket-Protocol: %s\r\n\\r\n%s"

Definition at line 126 of file websockets.c.

#define SERVER_HANDSHAKE_HYBI   "HTTP/1.1 101 Switching Protocols\r\n\Upgrade: websocket\r\n\Connection: Upgrade\r\n\Sec-WebSocket-Accept: %s\r\n\Sec-WebSocket-Protocol: %s\r\n\\r\n"

Definition at line 134 of file websockets.c.

#define SZ_FLASH_POLICY_RESPONSE   93

Definition at line 118 of file websockets.c.

#define WEBSOCKETS_CLIENT_CONNECT_WAIT_MS   100

Definition at line 142 of file websockets.c.

#define WEBSOCKETS_CLIENT_SEND_WAIT_MS   100

Definition at line 143 of file websockets.c.

#define WEBSOCKETS_MAX_HANDSHAKE_LEN   4096

Definition at line 144 of file websockets.c.

#define WS_HTON16 (   n)    bswap_16(n)

Definition at line 51 of file websockets.c.

#define WS_HTON64 (   n)    bswap_64(n)

Definition at line 50 of file websockets.c.

#define WS_NTOH16 (   n)    bswap_16(n)

Definition at line 49 of file websockets.c.

#define WS_NTOH32 (   n)    bswap_32(n)

Definition at line 48 of file websockets.c.

#define WS_NTOH64 (   n)    bswap_64(n)

Definition at line 47 of file websockets.c.

#define WSHLENMAX   14 /* 2 + sizeof(uint64_t) + sizeof(uint32_t) */

Definition at line 55 of file websockets.c.

Typedef Documentation

typedef int(* wsDecodeFunc)(rfbClientPtr cl, char *dst, int len)

Definition at line 70 of file websockets.c.

typedef int(* wsEncodeFunc)(rfbClientPtr cl, const char *src, int len, char **dst)

Definition at line 69 of file websockets.c.

Enumeration Type Documentation

anonymous enum
Enumerator
WEBSOCKETS_VERSION_HIXIE 
WEBSOCKETS_VERSION_HYBI 

Definition at line 57 of file websockets.c.

anonymous enum
Enumerator
WS_OPCODE_CONTINUATION 
WS_OPCODE_TEXT_FRAME 
WS_OPCODE_BINARY_FRAME 
WS_OPCODE_CLOSE 
WS_OPCODE_PING 
WS_OPCODE_PONG 

Definition at line 107 of file websockets.c.

Function Documentation

struct __attribute__ ( (__packed__)  )

Definition at line 91 of file websockets.c.

rfbBool webSocketCheckDisconnect ( rfbClientPtr  cl)

Definition at line 839 of file websockets.c.

+ Here is the call graph for this function:

rfbBool webSocketsCheck ( rfbClientPtr  cl)

Definition at line 186 of file websockets.c.

+ Here is the call graph for this function:

int webSocketsDecode ( rfbClientPtr  cl,
char *  dst,
int  len 
)

Definition at line 827 of file websockets.c.

+ Here is the caller graph for this function:

int webSocketsEncode ( rfbClientPtr  cl,
const char *  src,
int  len,
char **  dst 
)

Definition at line 821 of file websockets.c.

+ Here is the caller graph for this function:

void webSocketsGenMd5 ( char *  target,
char *  key1,
char *  key2,
char *  key3 
)

Definition at line 424 of file websockets.c.

+ Here is the call graph for this function:

Variable Documentation

ws_header_t

Definition at line 105 of file websockets.c.