/*H***************************************************************************
**
**  Copyright  (c)  2002,  Video Surveillance, Inc.
**		  All Rights Reserved.
**
**  Subsystem:	
**  File:	 	sd_msg.h
**  Created By:   	cham.li
**  Created On:	 09/30/2007
**  
**  Purpose: 
**   pbs director message definition 
**  
**  History:
**  Programmer	  Date	  Rev Number Description
** 
**
***************************************************************************H*/
#ifndef _SD_MSG_H_
#define _SD_MSG_H_

#include "auth_msg.h"

#define SD_MAX_MOUNT_PATH 64
#define SD_MAX_SESSION_NUM 17

//error code
#define SD_ERROR_BASE 4000
#define SD_NO_AVL_SVR   (SD_ERROR_BASE+1)
#define SD_MSG_ERROR	   (SD_ERROR_BASE+2) 
#define SD_VER_ERROR	   (SD_ERROR_BASE+3)
#define SD_NO_RESPONSE	 (SD_ERROR_BASE+4)



/*********main message***********/
struct sd_msg_head
{
	MSMsgHead_t head;
	U32 reqId;
	U32 errCode;
};

struct sd_msg
{
	sd_msg_head head;
	U32 bodyLen;
	U8 body[0];
};

/***********with pbs****************/
enum session_status
{
	SESSION_NULL = 0,
	SESSION_CLOSE = 1,
	SESSION_UP = 2
};

enum sss_status
{
	SSS_NULL = 0,
	SSS_DOWN  = 1,
	SSS_UP = 2
};

// session status
struct sd_session
{
	U32 sessionId;
	U32 bitRate;
	S8 mountPath[SD_MAX_MOUNT_PATH];
	U32 scale;
	U32 frameStoreOption;
};


//get all session request
struct sd_get_all_session_req
{
	U32 sdId;
	U32 sdIP;
	U16 sdPort;
};

//get all session response
struct sd_get_all_session_rsp
{
	U32 sssId;
	U16 sessionTotalNum;
	U16 sessionNum;
	U8 sessionList[0];
};

// heart beat request
struct sd_hb_req
{
	U32 sdId;
	U32 sdIP;
	U16 sdPort;	  
};

// heart beat response
struct sd_hb_rsp
{
	U32 sssId;
	U32 maxCability;
	U32 sssStartTime;
};

// audit request
struct sd_audit_req
{
	U32 sdId;
	U32 sdIP;
	U16 sdPort;	  
	U32 sessionId;
};

// audit response
struct sd_audit_rsp
{
	U32 sssId;
	sd_session session;
	U16 sessionStatus;	
};

// create session notify
struct sd_create_session
{
	U32 sssId;
	sd_session session;
};

//update session notify
struct sd_update_session
{
	U32 sssId;
	sd_session session;
};

// close session notify
struct sd_close_session
{
	U32 sssId;
	U32 sessionId;
};

// server down notify
struct sd_svr_down
{
	U32 sssId;
};


/************with client*****************/
// request for pbs ip 
struct sd_sss_ip_req
{
	S8 strUsrId[AUTH_MAX_USER_ID_LEN];
	U16 clientType;
	S8 strDomainName[AUTH_MAX_DOMAIN_LEN];
};

// response pbs ip
struct sd_sss_ip_rsp
{
	U32 sssIP;
};

/*********local private message*************/
// pbs down
struct sd_priv_sss_down
{
	U32 sssIP;
};

#endif

