phpsocks5/Workerman/Events/EventInterface.php

87 lines
1.5 KiB
PHP
Raw Normal View History

2015-04-04 21:46:31 +08:00
<?php
2016-09-20 21:27:41 +08:00
/**
* This file is part of workerman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
2015-04-04 21:46:31 +08:00
namespace Workerman\Events;
interface EventInterface
{
/**
2016-09-20 21:27:41 +08:00
* Read event.
*
2015-04-04 21:46:31 +08:00
* @var int
*/
const EV_READ = 1;
2016-09-20 21:27:41 +08:00
2015-04-04 21:46:31 +08:00
/**
2016-09-20 21:27:41 +08:00
* Write event.
*
2015-04-04 21:46:31 +08:00
* @var int
*/
const EV_WRITE = 2;
2016-09-20 21:27:41 +08:00
2015-04-04 21:46:31 +08:00
/**
2016-09-20 21:27:41 +08:00
* Signal event.
*
2015-04-04 21:46:31 +08:00
* @var int
*/
const EV_SIGNAL = 4;
2016-09-20 21:27:41 +08:00
2015-04-04 21:46:31 +08:00
/**
2016-09-20 21:27:41 +08:00
* Timer event.
*
2015-04-04 21:46:31 +08:00
* @var int
*/
const EV_TIMER = 8;
2016-09-20 21:27:41 +08:00
2015-04-04 21:46:31 +08:00
/**
2016-09-20 21:27:41 +08:00
* Timer once event.
*
* @var int
2015-04-04 21:46:31 +08:00
*/
const EV_TIMER_ONCE = 16;
2016-09-20 21:27:41 +08:00
2015-04-04 21:46:31 +08:00
/**
2016-09-20 21:27:41 +08:00
* Add event listener to event loop.
*
* @param mixed $fd
* @param int $flag
2015-04-04 21:46:31 +08:00
* @param callable $func
2016-09-20 21:27:41 +08:00
* @param mixed $args
2015-04-04 21:46:31 +08:00
* @return bool
*/
public function add($fd, $flag, $func, $args = null);
2016-09-20 21:27:41 +08:00
2015-04-04 21:46:31 +08:00
/**
2016-09-20 21:27:41 +08:00
* Remove event listener from event loop.
*
* @param mixed $fd
* @param int $flag
2015-04-04 21:46:31 +08:00
* @return bool
*/
public function del($fd, $flag);
2016-09-20 21:27:41 +08:00
2015-04-04 21:46:31 +08:00
/**
2016-09-20 21:27:41 +08:00
* Remove all timers.
*
2015-04-04 21:46:31 +08:00
* @return void
*/
public function clearAllTimer();
2016-09-20 21:27:41 +08:00
2015-04-04 21:46:31 +08:00
/**
2016-09-20 21:27:41 +08:00
* Main loop.
*
2015-04-04 21:46:31 +08:00
* @return void
*/
public function loop();
}