#pragma once
#include "acl_cpp/stream/aio_listen_stream.hpp"
#include "acl_cpp/stream/aio_socket_stream.hpp"

/**
* 첽ͻĻص
*/
class CAcceptedClientCallback : public acl::aio_callback
{
public:
	CAcceptedClientCallback(acl::aio_socket_stream* client);

	~CAcceptedClientCallback();

	/**
	* ʵָе麯ͻĶɹص
	* @param data {char*} ݵַ
	* @param len {int} ݳ
	* @return {bool}  true ʾϣرո첽
	*/
	bool read_callback(char* data, int len);

	/**
	* ʵָе麯ͻдɹص
	* @return {bool}  true ʾϣرո첽
	*/
	bool write_callback();

	/**
	* ʵָе麯ͻĳʱص
	*/
	void close_callback();

	/**
	* ʵָе麯ͻĳʱص
	* @return {bool}  true ʾϣرո첽
	*/
	bool timeout_callback();

private:
	acl::aio_socket_stream* client_;
	int   i_;
};

/**
* 첽Ļص
*/
class CServerCallback : public acl::aio_accept_callback
{
public:
	CServerCallback();
	~CServerCallback();

	/**
	* 麯ӵô˻ص
	* @param client {aio_socket_stream*} 첽ͻ
	* @return {bool}  true ֪ͨ
	*/
	bool accept_callback(acl::aio_socket_stream* client);
};
