-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathraklib.cpp
More file actions
104 lines (92 loc) · 2.43 KB
/
Copy pathraklib.cpp
File metadata and controls
104 lines (92 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* This file is part of ext-raklib.
* Native C++23 port of pmmp/raklib <https://github.com/pmmp/RakLib>
*
* ext-raklib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
extern "C" {
#include "php.h"
#include "ext/standard/info.h"
#include "php_raklib.h" //this one has to be C always, so the engine can understand it
}
#if PHP_VERSION_ID < 80200
# error "ext-raklib requires PHP 8.2 or later"
#endif
#include "src/PhpExceptions.h"
#include "src/PhpConstants.h"
#include "src/PhpInterfaces.h"
#include "src/PhpProtocolClasses.h"
#include "src/PhpUtils.h"
#include "src/PhpServerSocket.h"
#include "src/PhpServer.h"
/*
* Full native port: shared types (phase 1) + RakNet core in lib/ (phase 3) +
* ServerSocket/Server glue (phase 4). See stubs/ for the exact PHP-visible API contract.
*/
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(raklib)
{
#if defined(ZTS) && defined(COMPILE_DL_RAKLIB)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
REGISTER_STRING_CONSTANT("RAKLIB_EXTENSION_VERSION", (char *) PHP_RAKLIB_VERSION, CONST_CS | CONST_PERSISTENT);
raklib_register_exceptions();
raklib_register_constants();
raklib_register_interfaces();
raklib_register_protocol_classes();
raklib_register_utils(); //needs interfaces (ProtocolAcceptor)
raklib_register_server_socket(); //needs utils (InternetAddress) + exceptions
raklib_register_server(); //needs everything above
return SUCCESS;
}
/* }}} */
/* {{{ PHP_RINIT_FUNCTION
*/
PHP_RINIT_FUNCTION(raklib)
{
#if defined(ZTS) && defined(COMPILE_DL_RAKLIB)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(raklib)
{
php_info_print_table_start();
php_info_print_table_header(2, "raklib support", "enabled");
php_info_print_table_row(2, "raklib version", PHP_RAKLIB_VERSION);
php_info_print_table_end();
}
/* }}} */
/* {{{ raklib_module_entry
*/
zend_module_entry raklib_module_entry = {
STANDARD_MODULE_HEADER,
"raklib",
NULL,
PHP_MINIT(raklib),
NULL, /* MSHUTDOWN */
PHP_RINIT(raklib),
NULL, /* RSHUTDOWN */
PHP_MINFO(raklib),
PHP_RAKLIB_VERSION,
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_RAKLIB
extern "C" {
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(raklib)
}
#endif