$69 GRAYBYTE WORDPRESS FILE MANAGER $29

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.157
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/alt/php82/usr/include/php/ext/swoole/ext-src/

HOME
Current File : /opt/alt/php82/usr/include/php/ext/swoole/ext-src//php_swoole_server.h
/*
 +----------------------------------------------------------------------+
 | Swoole                                                               |
 +----------------------------------------------------------------------+
 | Copyright (c) 2012-2015 The Swoole Group                             |
 +----------------------------------------------------------------------+
 | This source file is subject to version 2.0 of the Apache license,    |
 | that is bundled with this package in the file LICENSE, and is        |
 | available through the world-wide-web at the following url:           |
 | http://www.apache.org/licenses/LICENSE-2.0.html                      |
 | If you did not receive a copy of the Apache2.0 license and are unable|
 | to obtain it through the world-wide-web, please send a note to       |
 | [email protected] so we can mail you a copy immediately.            |
 +----------------------------------------------------------------------+
 | Author: Tianfeng Han  <[email protected]>                             |
 +----------------------------------------------------------------------+
 */

#pragma once

#include "php_swoole_cxx.h"
#include "swoole_server.h"

#include <unordered_map>
#include <list>
#include <vector>

//--------------------------------------------------------
enum php_swoole_server_callback_type {
    SW_SERVER_CB_onStart,           // master
    SW_SERVER_CB_onBeforeShutdown,  // master
    SW_SERVER_CB_onShutdown,        // master
    SW_SERVER_CB_onWorkerStart,     // worker(event & task)
    SW_SERVER_CB_onWorkerStop,      // worker(event & task)
    SW_SERVER_CB_onBeforeReload,    // manager
    SW_SERVER_CB_onAfterReload,     // manager
    SW_SERVER_CB_onTask,            // worker(task)
    SW_SERVER_CB_onFinish,          // worker(event & task)
    SW_SERVER_CB_onWorkerExit,      // worker(event)
    SW_SERVER_CB_onWorkerError,     // manager
    SW_SERVER_CB_onManagerStart,    // manager
    SW_SERVER_CB_onManagerStop,     // manager
    SW_SERVER_CB_onPipeMessage,     // worker(event & task)
};
//--------------------------------------------------------
enum php_swoole_server_port_callback_type {
    SW_SERVER_CB_onConnect,                  // stream, worker(event)
    SW_SERVER_CB_onReceive,                  // stream, worker(event)
    SW_SERVER_CB_onClose,                    // stream, worker(event)
    SW_SERVER_CB_onPacket,                   // dgram, worker(event)
    SW_SERVER_CB_onRequest,                  // http, worker(event)
    SW_SERVER_CB_onHandshake,                // websocket, worker(event)
    SW_SERVER_CB_onBeforeHandshakeResponse,  // websocket, worker(event)
    SW_SERVER_CB_onOpen,                     // websocket, worker(event)
    SW_SERVER_CB_onMessage,                  // websocket, worker(event)
    SW_SERVER_CB_onDisconnect,               // websocket (non websocket connection), worker(event)
    SW_SERVER_CB_onBufferFull,               // worker(event)
    SW_SERVER_CB_onBufferEmpty,              // worker(event)
};

#define PHP_SWOOLE_SERVER_CALLBACK_NUM (SW_SERVER_CB_onPipeMessage + 1)
#define PHP_SWOOLE_SERVER_PORT_CALLBACK_NUM (SW_SERVER_CB_onBufferEmpty + 1)

namespace swoole {
struct TaskCo;

struct ServerPortProperty {
    zval *callbacks[PHP_SWOOLE_SERVER_PORT_CALLBACK_NUM];
    zend_fcall_info_cache *caches[PHP_SWOOLE_SERVER_PORT_CALLBACK_NUM];
    zval _callbacks[PHP_SWOOLE_SERVER_PORT_CALLBACK_NUM];
    Server *serv;
    ListenPort *port;
    zval *zsetting;
};

struct ServerProperty {
    std::vector<zval *> ports;
    std::vector<zval *> user_processes;
    ServerPortProperty *primary_port;
    zend_fcall_info_cache *callbacks[PHP_SWOOLE_SERVER_CALLBACK_NUM];
    std::unordered_map<TaskId, zend_fcall_info_cache> task_callbacks;
    std::unordered_map<TaskId, TaskCo *> task_coroutine_map;
    std::unordered_map<SessionId, std::list<Coroutine *> *> send_coroutine_map;
    std::vector<zend_fcall_info_cache *> command_callbacks;
};

struct ServerObject {
    Server *serv;
    ServerProperty *property;
    zend_object std;

    zend_class_entry *get_ce() {
        return Z_OBJCE_P(get_object());
    }

    zval *get_object() {
        return (zval *) serv->private_data_2;
    }

    bool isset_callback(ListenPort *port, int event_type) {
        ServerPortProperty *port_property = (ServerPortProperty *) port->ptr;
        return (port_property->callbacks[event_type] || property->primary_port->callbacks[event_type]);
    }

    zend_bool is_websocket_server() {
        return instanceof_function(get_ce(), swoole_websocket_server_ce);
    }

    zend_bool is_http_server() {
        return instanceof_function(get_ce(), swoole_http_server_ce);
    }

    zend_bool is_redis_server() {
        return instanceof_function(get_ce(), swoole_redis_server_ce);
    }

    void register_callback();
    void on_before_start();
};

struct TaskCo {
    Coroutine *co;
    int *list;
    uint32_t count;
    zval *result;
};
void register_admin_server_commands(Server *serv);
}  // namespace swoole

void php_swoole_server_register_callbacks(swServer *serv);
zend_fcall_info_cache *php_swoole_server_get_fci_cache(swServer *serv, int server_fd, int event_type);
int php_swoole_create_dir(const char *path, size_t length);
void php_swoole_server_before_start(swServer *serv, zval *zobject);
bool php_swoole_server_isset_callback(swServer *serv, swListenPort *port, int event_type);
void php_swoole_server_send_yield(swServer *serv, swoole::SessionId sesion_id, zval *zdata, zval *return_value);
void php_swoole_get_recv_data(swServer *serv, zval *zdata, swRecvData *req);
void php_swoole_server_onConnect(swServer *, swDataHead *);
int php_swoole_server_onReceive(swServer *, swRecvData *);
int php_swoole_http_server_onReceive(swServer *, swRecvData *);
void php_swoole_http_server_onClose(swServer *serv, swDataHead *info);
int php_swoole_redis_server_onReceive(swServer *serv, swRecvData *req);
int php_swoole_server_onPacket(swServer *, swRecvData *);
void php_swoole_server_onClose(swServer *, swDataHead *);
void php_swoole_server_onBufferFull(swServer *, swDataHead *);
void php_swoole_server_onBufferEmpty(swServer *, swDataHead *);

swServer *php_swoole_server_get_and_check_server(zval *zobject);
void php_swoole_server_port_deref(zend_object *object);
swoole::ServerObject *php_swoole_server_get_zend_object(swoole::Server *serv);
zval *php_swoole_server_get_zval_object(swoole::Server *serv);


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
1 Apr 2025 8.38 AM
root / linksafe
0755
php_swoole_call_stack.h
1.816 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_client.h
1.349 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_coroutine.h
9.792 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_coroutine_system.h
1.875 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_curl.h
4.86 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_cxx.h
20.887 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_http.h
13.289 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_http_server.h
3.754 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_library.h
370.718 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_mysql_proto.h
31.419 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_odbc.h
5.672 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_oracle.h
3.333 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_pgsql.h
2.599 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_private.h
42.995 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_process.h
1.341 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_server.h
6.299 KB
12 Mar 2025 1.51 PM
root / linksafe
0644
php_swoole_sqlite.h
2.583 KB
12 Mar 2025 1.51 PM
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF