-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphp_aokex.c
103 lines (84 loc) · 1.74 KB
/
php_aokex.c
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
/*
* AOChat -- library for talking with the Anarchy Online chat servers
*
* Copyright (c) 2002-2005, Oskari Saarenmaa <[email protected]>
*
* This file is under the 2-clause BSD license.
* See the file `LICENSE` for details.
*
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif /* HAVE_CONFIG_H */
#include "php.h"
#if HAVE_AOKEX
#include <stdio.h>
#include "ext/standard/info.h"
#include "aokex.h"
#include "php_aokex.h"
ZEND_DECLARE_MODULE_GLOBALS(aokex)
function_entry aokex_functions[] =
{
PHP_FE(aokex_login_key, NULL)
{NULL,NULL,NULL}
};
zend_module_entry aokex_module_entry =
{
STANDARD_MODULE_HEADER,
"aokex",
aokex_functions,
PHP_MINIT(aokex),
NULL,
PHP_RINIT(aokex),
NULL,
PHP_MINFO(aokex),
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_AOKEX
ZEND_GET_MODULE(aokex)
#endif
PHP_MINFO_FUNCTION(aokex)
{
php_info_print_table_start();
php_info_print_table_row(2, "aokex support", "enabled");
php_info_print_table_end();
}
PHP_MINIT_FUNCTION(aokex)
{
return SUCCESS;
}
PHP_RINIT_FUNCTION(aokex)
{
return SUCCESS;
}
void *
aokex_malloc(size_t n)
{
return emalloc(n);
}
void *
aokex_realloc(void *p, size_t on, size_t nn)
{
return erealloc(p, nn);
}
void
aokex_free(void *p, size_t n)
{
efree(p);
}
PHP_FUNCTION(aokex_login_key)
{
zval **username_arg, **password_arg, **serverseed_arg;
char *result;
if (ZEND_NUM_ARGS() != 3 ||
zend_get_parameters_ex(3, &serverseed_arg, &username_arg, &password_arg) == FAILURE)
{
WRONG_PARAM_COUNT;
}
result = aokex_login_key(Z_STRVAL_PP(serverseed_arg),
Z_STRVAL_PP(username_arg),
Z_STRVAL_PP(password_arg));
RETURN_STRINGL(result, strlen(result), 1);
}
#endif /* HAVE_AOKEX */