/***************************************************************************
                   cc_tsd
                -----------------------------------------

	begin      : 2013/09/16
	copyright  : (C) 2005 Solbox Inc.
	author     : Development 1 Team
					- 2013/09/16
	email      : dev1@solbox.com
	version    : 3.2.0

	CopyRight(C) 2005 Solbox Inc. All Rights reserved.
	Redistribution and use in source and binary forms, with or with out
	modification, are not permitted in outside of Solbox Inc.
***************************************************************************/


#ifndef __INTERFACE_PROCESSOR_H__
#define __INTERFACE_PROCESSOR_H__
#include "BaseSocket.h"
#include "cc_tsd.h"
#include "protocol.h"
#include "ServiceInfoUpdater.h"
#include "DataQueue.h"
class CInterfaceProcessor : public CBaseSocket
{
public:
	CInterfaceProcessor();
	CInterfaceProcessor(int clientsd, string szClientIP,CQueue<CLoginInfo> *pQueueLoginInfo, CServiceInfoUpdater *pobjServiceInfoUpdater);
	~CInterfaceProcessor();

	int Run();

	// cc_timed 의 요청에 대한 응답처리
	int Respose_cctimed(char *_pszRcvdReq );
	
	// 현재 지원하는 모드인지 확인함.
	int CheckRequestMode(MsgHeader* msgHeader);

	// cc_tsd의 요청에 대한 내용을 확인한다.
	// 적당한 응답을 위한 정보를 생성한다.
	int ProcessingJob(MsgHeader *msgHeader);

	// cc_tsd 요청에 대한 응답을 처리한다.
	void SendResult(int nCode, MsgHeader *pmsgHeader);
	
	string m_szClientIP;
	string m_szUserID;
protected:
private:
	static void *_entry_func(void *arg);	
	bool ParseUserInfo(const char *pszRcvd, user_auth_t *pUserAuthInfo);
	bool MakeResponseMessage(MsgHeader *pmsgHeader, CServiceInfoMap *pmapServiceInfo);			

	int	m_sfd;

	// cc_tsd response를 위한 body 구조체
	int m_nBodyLen;
	char* m_responseBody;

	CQueue<CLoginInfo> *m_pQueueLoginInfo;
	CServiceInfoUpdater *m_pobjServiceInfoUpdater;
};

#endif // __INTERFACE_PROCESSOR_H__
