/***************************************************************************************
 *
 *  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
 *
 *  By downloading, copying, installing or using the software you agree to this license.
 *  If you do not agree to this license, do not download, install, 
 *  copy or use the software.
 *
 *  Copyright (C) 2014-2024, Happytimesoft Corporation, all rights reserved.
 *
 *  Redistribution and use in binary forms, with or without modification, are permitted.
 *
 *  Unless required by applicable law or agreed to in writing, software distributed 
 *  under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 *  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
 *  language governing permissions and limitations under the License.
 *
****************************************************************************************/

#ifndef RTSP_WS_H
#define RTSP_WS_H

#include "sys_inc.h"

/**************************************************************************************/

#define WS_VERSION          13                  // websocket version
#define WS_PROTOCOL         "rtsp.onvif.org"    // websocket protocol
#define WS_MAXMESSAGE       1048576             // Max size message = 1MB

/**************************************************************************************/

typedef struct 
{
    uint32 finbit   : 1;
    uint32 opcode   : 4;
    uint32 reserved : 27;
    
	char   mask[4];
	int    skip;
	uint32 buff_len;
	uint32 rcv_len;
	uint32 msg_len;
	char * buff;
} WSMSG;

#ifdef __cplusplus
extern "C" {
#endif

int  rtsp_ws_decode_data(WSMSG * p_msg);
int  rtsp_ws_encode_data(uint8 * p_data, int len, uint8 opcode, uint8 have_mask);

#ifdef __cplusplus
}
#endif


#endif



