15 enum WebSocketFrameOpcode
    17   WebSocketContinuationFrame  = 0x00,
    18   WebSocketTextFrame          = 0x01,
    19   WebSocketBinaryFrame        = 0x02,
    21   WebSocketConnectionClose    = 0x08,
    25   WebSocketUnknownFrame       = 0x10
    30   WebSocketStateNotConnected    = 0,
    31   WebSocketStateHandshaking     = 1,
    32   WebSocketStateConnected       = 2,
    33   WebSocketStateClosing         = 3,
    34   WebSocketStateClosed          = 4
    37 enum WebSocketCloseReason
    39   WebSocketCloseNormal          = 1000,
    40   WebSocketCloseLeaving         = 1001,
    41   WebSocketCloseProtocolError   = 1002,
    42   WebSocketCloseInvalidData     = 1003,
    43   WebSocketCloseFrameTooLarge   = 1004,
    46   WebSocketCloseInvalidUtf8     = 1007
    53   CWebSocketFrame(WebSocketFrameOpcode opcode, 
const char* data = NULL, uint32_t length = 0, 
bool final = 
true, 
bool masked = 
false, int32_t mask = 0, int8_t extension = 0);
    56   virtual bool IsValid()
 const { 
return m_valid; }
    57   virtual uint64_t GetFrameLength()
 const { 
return m_lengthFrame; }
    58   virtual bool IsFinal()
 const { 
return m_final; }
    59   virtual int8_t GetExtension()
 const { 
return m_extension; }
    60   virtual WebSocketFrameOpcode GetOpcode()
 const { 
return m_opcode; }
    61   virtual bool IsControlFrame()
 const { 
return (m_valid && (m_opcode & 0x8) == 0x8); }
    62   virtual bool IsMasked()
 const { 
return m_masked; }
    63   virtual uint64_t GetLength()
 const { 
return m_length; }
    64   virtual int32_t GetMask()
 const { 
return m_mask; }
    65   virtual const char* GetFrameData()
 const { 
return m_data; }
    66   virtual const char* GetApplicationData()
 const { 
return m_applicationData; }
    71   uint64_t m_lengthFrame;
    76   WebSocketFrameOpcode m_opcode;
    79   char *m_applicationData;
    93   virtual bool IsFragmented()
 const { 
return m_fragmented; }
    94   virtual bool IsComplete()
 const { 
return m_complete; }
    97   virtual const std::vector<const CWebSocketFrame *>& GetFrames()
 const { 
return m_frames; }
   102   std::vector<const CWebSocketFrame *> m_frames;
   110   CWebSocket() { m_state = WebSocketStateNotConnected; m_message = NULL; }
   117   int GetVersion() { 
return m_version; }
   118   WebSocketState GetState() { 
return m_state; }
   120   virtual bool Handshake(
const char* data, 
size_t length, std::string &response) = 0;
   121   virtual const CWebSocketMessage* Handle(
const char* &buffer, 
size_t &length, 
bool &send);
   122   virtual const CWebSocketMessage* Send(WebSocketFrameOpcode opcode, 
const char* data = NULL, uint32_t length = 0);
   123   virtual const CWebSocketFrame* Ping(
const char* data = NULL) 
const = 0;
   124   virtual const CWebSocketFrame* Pong(
const char* data, uint32_t length) 
const = 0;
   125   virtual const CWebSocketFrame* Close(WebSocketCloseReason reason = WebSocketCloseNormal, 
const std::string &message = 
"") = 0;
   126   virtual void Fail() = 0;
   130   WebSocketState m_state;
   133   virtual CWebSocketFrame* GetFrame(
const char* data, uint64_t length) = 0;
   134   virtual CWebSocketFrame* GetFrame(WebSocketFrameOpcode opcode, 
const char* data = NULL, uint32_t length = 0, 
bool final = 
true, 
bool masked = 
false, int32_t mask = 0, int8_t extension = 0) = 0;
 Definition: WebSocket.h:107
Definition: WebSocket.h:87
Definition: WebSocket.h:49