/*----------------------------------------------------------------------
* Copyright	: Video Surveillance(China) Co. Ltd
* Description  : 
* 
* Created On   : 03/05/2007
* Maintained by:
* Modification : 
* 
-----------------------------------------------------------------------*/
#ifndef __SS_GLOBAL_HEADER__
#define __SS_GLOBAL_HEADER__

#include "ssi.h"
#include "table_structs.h"
#include "fileheaders.h"

const U32 MSMSGMAGIC	= 0x49505653;   /* "IPVS" */
const U16 MSMSGMAXSIZE  = 10240;		 /* max msg size */

#define CONNECT_BY_IP		0	//IP访问
#define CONNECT_BY_NAME	1	//域名访问
#define CONNECT_INVALID	2	//不提供访问

/*
 * message interfaces version 
 */
const U8 MC_VER	 = 0x01;
const U8 RTSP_VER   = 0x02;
const U8 AUTH_VER   = 0x04;


/*
 * message interfaces definition
 */
const U8 IF_MC	  = 0x01;
const U8 IF_RTSP	= 0x02;
const U8 IF_AUTH	= 0x03;

/*
 * message version  in common header
 */
const U16 VS_MC_VER   = (IF_MC<<8)   | MC_VER;
const U16 VS_RTSP_VER = (IF_RTSP<<8) | RTSP_VER;
const U16 VS_AUTH_VER = (IF_AUTH<<8) | AUTH_VER;

//携带如下版本号，表示消息采用zlib压缩
const U16 VS_MC_VER_2   = ((IF_MC<<8)   | MC_VER)+ 1;
const U16 VS_RTSP_VER_2 = ((IF_RTSP<<8) | RTSP_VER)+1;
const U16 VS_AUTH_VER_2 = ((IF_AUTH<<8) | AUTH_VER)+1;


/*
 * Message class definition
 */
const U16 MSG_CLS_REQ = 0x0001;
const U16 MSG_CLS_RSP = 0x0002;
const U16 MSG_CLS_NTF = 0x0003;
const U16 MSG_CLS_CFM = 0x0004;

	
typedef struct {
	U32	 magic;	  /* magic number 0x49505653  'IPVS' */
	U16	 version;	/* entity version number, initial value is 0x01*/
	U16	 length;	 /* total packet length, including this common header*/
	U32	 MsgClass;   /* request, confirm, notify, response */
	U32	 MsgType;	/* message type */  
	U32		nSrcInst;	//消息源实例号，不用则填0
	U32		nDestInst;	//消息目的实例号，不用则填0
}MSMsgHead_t;


//时间,用于录像\日志内容的定位
typedef struct
{
	U16 year;
	U16  month; // for data align, change type U8 to U16
	U8  day;
	U8  hour;
	U8  minute;
	U8  second;
} vs_time_t;

//用于录像/日志内容搜索
typedef struct
{
	vs_time_t startTime;
	vs_time_t endTime;
} content_timeinfo_t;

//用于录像/日志查询内容回应
typedef struct
{
	vs_time_t startTime;
	vs_time_t endTime;
	S8 szFilePath[VS_FILE_PATH_LEN];
}content_fileinfo_t;

#define VS_CONTENT_PAGE_SIZE 10	//每页显示内容个数(录像文件/日志等)




#endif /* __SS_GLOBAL_HEADER__ */


