/***************************************************************************
                   Interface Server Header ( InterfaceServer.h )
                -----------------------------------------

	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_SERVER_H__
#define __INTERFACE_SERVER_H__

#include <pthread.h>
#include "ServiceInfoUpdater.h"
#include "DataQueue.h"

class CInterfaceServer
{
public:
	CInterfaceServer ();
	~CInterfaceServer();
	
	int bind(int nPort );
	void Init(CQueue<CLoginInfo> *pQueueLoginInfo, CServiceInfoUpdater *pobjServiceInfoUpdater);
	int start();
	void stop();
	void SslCtx_Free();

protected:
	virtual void *entry();
	int RunClient(int nClientfd, string sz_ClientIP);

	int			Accept();
	int			Acceptv6();
	
	bool m_ipv6;
	int m_listenfd;

private:
	static void *_entry_func(void *arg);

private:
	pthread_t m_threadid;
	bool m_done;

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

#endif // __INTERFACE_SERVER_H__
