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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728
|
#include "php_mod_0.h"
#include "net_endian.h"
#include "net_struct.h"
#include "net_func.h"
#include "net_client.h"
#include "info.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stddef.h>
#include <string.h>
#include <stdio.h>
/* Every user visible function must have an entry in this function. */
const zend_function_entry mod_0_functions [] =
{
PHP_FE(session_open, NULL)
PHP_FE(session_open_result, NULL)
PHP_FE(session_open_result_fetch_array, NULL)
PHP_FE(session_reset, NULL)
PHP_FE(session_reset_result, NULL)
PHP_FE(session_reset_result_fetch_array, NULL)
PHP_FE(session_close, NULL)
PHP_FE(crypto_set_rsa_key, NULL)
PHP_FE(crypto_get_aes_params, NULL)
PHP_FE(crypto_get_aes_params_result, NULL)
PHP_FE(crypto_get_aes_params_result_fetch_array, NULL)
PHP_FE(crypto_begin, NULL)
PHP_FE(crypto_begin_result, NULL)
PHP_FE(crypto_begin_result_fetch_array, NULL)
PHP_FE(crypto_end, NULL)
{NULL, NULL, NULL}
};
/* Module information */
zend_module_entry mod_0_module_entry =
{
#if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER,
#endif
FREEAGE_PHP_MOD_0_EXTNAME,
mod_0_functions, /* Functions */
PHP_MINIT(mod_0), /* MINIT */
PHP_MSHUTDOWN(mod_0), /* MSHUTDOWN */
NULL, /* RINIT */
NULL, /* RSHUTDOWN */
PHP_MINFO(mod_0), /* MINFO */
#if ZEND_MODULE_API_NO >= 20010901
FREEAGE_PHP_MOD_0_EXTVER,
#endif
STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_MOD_0
ZEND_GET_MODULE(mod_0)
#endif
/* Variable and function to register the resource of session_open_result function */
static int le_session_open_result;
#define le_session_open_result_name "session_open_result_name"
static void
session_open_result_dtor ( zend_rsrc_list_entry * rsrc TSRMLS_DC )
{
struct session_open_result * result = (struct session_open_result *) rsrc->ptr;
if (result)
{
efree(result);
}
}
/* Variable and function to register the resource of session_reset_result function */
static int le_session_reset_result;
#define le_session_reset_result_name "session_reset_result_name"
static void
session_reset_result_dtor ( zend_rsrc_list_entry * rsrc TSRMLS_DC )
{
struct session_reset_result * result = (struct session_reset_result *) rsrc->ptr;
if (result)
{
efree(result);
}
}
/* Variable and function to register the resource of crypto_get_aes_params_result function */
static int le_crypto_get_aes_params_result;
#define le_crypto_get_aes_params_result_name "crypto_get_aes_params_result_name"
static void
crypto_get_aes_params_result_dtor ( zend_rsrc_list_entry * rsrc TSRMLS_DC )
{
struct crypto_get_aes_params_result * result = (struct crypto_get_aes_params_result *) rsrc->ptr;
if (result)
{
efree(result);
}
}
/* Variable and function to register the resource of crypto_begin_result function */
static int le_crypto_begin_result;
#define le_crypto_begin_result_name "crypto_begin_result_name"
static void
crypto_begin_result_dtor ( zend_rsrc_list_entry * rsrc TSRMLS_DC )
{
struct crypto_begin_result * result = (struct crypto_begin_result *) rsrc->ptr;
if (result)
{
efree(result);
}
}
/* Function to add php_info module information */
PHP_MINFO_FUNCTION(mod_0)
{
php_info_print_table_start();
php_info_print_table_row(2, "mod_0", "Enabled");
php_info_print_table_row(2, "Infos", "Copyright (c) Artefacts Studio 2009 - All rights reserved.");
php_info_print_table_row(2, "Infos", "This module implement global functions.");
php_info_print_table_end();
php_info_print_table_start();
php_info_print_table_header(1, "Functions");
php_info_print_table_row(1, "session_open");
php_info_print_table_row(1, "session_open_result");
php_info_print_table_row(1, "session_open_result_fetch_array");
php_info_print_table_row(1, "session_reset");
php_info_print_table_row(1, "session_reset_result");
php_info_print_table_row(1, "session_reset_result_fetch_array");
php_info_print_table_row(1, "session_close");
php_info_print_table_row(1, "crypto_set_rsa_key");
php_info_print_table_row(1, "crypto_get_aes_params");
php_info_print_table_row(1, "crypto_get_aes_params_result");
php_info_print_table_row(1, "crypto_get_aes_params_result_fetch_array");
php_info_print_table_row(1, "crypto_begin");
php_info_print_table_row(1, "crypto_begin_result");
php_info_print_table_row(1, "crypto_begin_result_fetch_array");
php_info_print_table_row(1, "crypto_end");
php_info_print_table_end();
}
PHP_MINIT_FUNCTION(mod_0)
{
le_session_open_result = zend_register_list_destructors_ex( session_open_result_dtor, NULL, le_session_open_result_name, module_number );
le_session_reset_result = zend_register_list_destructors_ex( session_reset_result_dtor, NULL, le_session_reset_result_name, module_number );
le_crypto_get_aes_params_result = zend_register_list_destructors_ex( crypto_get_aes_params_result_dtor, NULL, le_crypto_get_aes_params_result_name, module_number );
le_crypto_begin_result = zend_register_list_destructors_ex( crypto_begin_result_dtor, NULL, le_crypto_begin_result_name, module_number );
return SUCCESS;
}
PHP_MSHUTDOWN_FUNCTION(mod_0)
{
return SUCCESS;
}
ZEND_DECLARE_MODULE_GLOBALS(mod_0)
/// session_open result byte swapping function.
/**
* This function byte swap the structure in-place.
* \param target A pointer to the structure.
*/
void
session_open_result_bswap_fn ( struct session_open_result * target );
/// session_open result format definition.
static const struct net_struct session_open_result_format =
{
1, sizeof(struct session_open_result),
NULL, /* not used by client */
NULL, /* not used for results */
(net_struct_bswap_fn_t)session_open_result_bswap_fn,
{
{ NET_TYPE_SESSID, 1, offsetof(struct session_open_result, session_id) }
}
};
void
session_open_result_bswap_fn ( struct session_open_result * target )
{
}
/// session_open function definition.
static const struct net_func session_open_func_def =
{
0,
0,
NULL,
&session_open_result_format
};
/* {{{ Prototype : long instance session_open ( long net_client, ) */
PHP_FUNCTION(session_open)
{
struct net_func_instance * instance;
struct net_client * net_client;
long arg_net_client;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg_net_client) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session_open : A parameter is missing");
RETURN_FALSE;
}
net_client = (struct net_client *) arg_net_client;
instance = net_client_call_function(net_client, &session_open_func_def, NULL);
if (instance == NULL)
{
RETURN_NULL();
}
else
{
RETURN_LONG((long) instance);
}
}
/* }}} */
/* {{{ Prototype : Resource result session_open_result ( long instance ) */
PHP_FUNCTION(session_open_result)
{
struct session_open_result * result;
struct session_open_result * result_new;
struct net_func_instance * instance;
long arg_instance;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg_instance) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session_open_result : A parameter is missing");
RETURN_FALSE;
}
instance = (struct net_func_instance *) arg_instance;
result = (struct session_open_result *) net_func_pop_result(instance);
if (result != NULL)
{
result_new = emalloc(sizeof(struct session_open_result));
result_new->session_id = result->session_id;
ZEND_REGISTER_RESOURCE(return_value, result_new, le_session_open_result);
return;
}
else
{
RETURN_LONG(0);
}
}
/* }}} */
/* {{{ Prototype : Array ["session_id", ] session_open_result_fetch_array ( Resource result ) */
PHP_FUNCTION(session_open_result_fetch_array)
{
struct session_open_result * result;
zval * arg_result;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg_result) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session_open_result_fetch_array : A parameter is missing");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(result, struct session_open_result *, &arg_result, -1, le_session_open_result_name, le_session_open_result);
array_init(return_value);
add_assoc_long(return_value, "session_id", (long) result->session_id);
}
/* }}} */
/// session_reset result byte swapping function.
/**
* This function byte swap the structure in-place.
* \param target A pointer to the structure.
*/
void
session_reset_result_bswap_fn ( struct session_reset_result * target );
/// session_reset result format definition.
static const struct net_struct session_reset_result_format =
{
1, sizeof(struct session_reset_result),
NULL, /* not used by client */
NULL, /* not used for results */
(net_struct_bswap_fn_t)session_reset_result_bswap_fn,
{
{ NET_TYPE_SESSID, 1, offsetof(struct session_reset_result, session_id) }
}
};
void
session_reset_result_bswap_fn ( struct session_reset_result * target )
{
}
/// session_reset function definition.
static const struct net_func session_reset_func_def =
{
0,
1,
NULL,
&session_reset_result_format
};
/* {{{ Prototype : long instance session_reset ( long net_client, ) */
PHP_FUNCTION(session_reset)
{
struct net_func_instance * instance;
struct net_client * net_client;
long arg_net_client;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg_net_client) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session_reset : A parameter is missing");
RETURN_FALSE;
}
net_client = (struct net_client *) arg_net_client;
instance = net_client_call_function(net_client, &session_reset_func_def, NULL);
if (instance == NULL)
{
RETURN_NULL();
}
else
{
RETURN_LONG((long) instance);
}
}
/* }}} */
/* {{{ Prototype : Resource result session_reset_result ( long instance ) */
PHP_FUNCTION(session_reset_result)
{
struct session_reset_result * result;
struct session_reset_result * result_new;
struct net_func_instance * instance;
long arg_instance;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg_instance) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session_reset_result : A parameter is missing");
RETURN_FALSE;
}
instance = (struct net_func_instance *) arg_instance;
result = (struct session_reset_result *) net_func_pop_result(instance);
if (result != NULL)
{
result_new = emalloc(sizeof(struct session_reset_result));
result_new->session_id = result->session_id;
ZEND_REGISTER_RESOURCE(return_value, result_new, le_session_reset_result);
return;
}
else
{
RETURN_LONG(0);
}
}
/* }}} */
/* {{{ Prototype : Array ["session_id", ] session_reset_result_fetch_array ( Resource result ) */
PHP_FUNCTION(session_reset_result_fetch_array)
{
struct session_reset_result * result;
zval * arg_result;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg_result) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session_reset_result_fetch_array : A parameter is missing");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(result, struct session_reset_result *, &arg_result, -1, le_session_reset_result_name, le_session_reset_result);
array_init(return_value);
add_assoc_long(return_value, "session_id", (long) result->session_id);
}
/* }}} */
/// session_close function definition.
static const struct net_func session_close_func_def =
{
0,
2,
NULL,
NULL
};
/* {{{ Prototype : long instance session_close ( long net_client, ) */
PHP_FUNCTION(session_close)
{
struct net_func_instance * instance;
struct net_client * net_client;
long arg_net_client;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg_net_client) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session_close : A parameter is missing");
RETURN_FALSE;
}
net_client = (struct net_client *) arg_net_client;
instance = net_client_call_function(net_client, &session_close_func_def, NULL);
if (instance == NULL)
{
RETURN_NULL();
}
else
{
RETURN_LONG((long) instance);
}
}
/* }}} */
/// crypto_set_rsa_key params formatting function.
/**
* \param target A pointer to the structure.
* \param ap A list of parameters.
*/
void
crypto_set_rsa_key_params_format_fn ( struct crypto_set_rsa_key_params * target, va_list ap );
/// crypto_set_rsa_key params byte swapping function.
/**
* This function byte swap the structure in-place.
* \param target A pointer to the structure.
*/
void
crypto_set_rsa_key_params_bswap_fn ( struct crypto_set_rsa_key_params * target );
/// crypto_set_rsa_key params format definition.
static const struct net_struct crypto_set_rsa_key_params_format =
{
1, sizeof(struct crypto_set_rsa_key_params),
NULL, /* not used by client */
(net_struct_format_fn_t)crypto_set_rsa_key_params_format_fn,
(net_struct_bswap_fn_t)crypto_set_rsa_key_params_bswap_fn,
{
{ NET_TYPE_UBYTE, 128, offsetof(struct crypto_set_rsa_key_params, public_key) }
}
};
void
crypto_set_rsa_key_params_format_fn ( struct crypto_set_rsa_key_params * target, va_list ap )
{
{
unsigned int idx;
const net_ubyte_t * source = va_arg(ap, net_ubyte_t *);
for (idx = 0; idx < 128; ++ idx)
{
target->public_key[idx] = source[idx];
}
}
}
void
crypto_set_rsa_key_params_bswap_fn ( struct crypto_set_rsa_key_params * target )
{
}
/// crypto_set_rsa_key function definition.
static const struct net_func crypto_set_rsa_key_func_def =
{
0,
3,
&crypto_set_rsa_key_params_format,
NULL
};
/* {{{ Prototype : long instance crypto_set_rsa_key ( long net_client, long public_key, ) */
PHP_FUNCTION(crypto_set_rsa_key)
{
struct net_func_instance * instance;
struct net_client * net_client;
long arg_net_client;
net_ubyte_t public_key [128];
long arg_public_key;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &arg_net_client, &arg_public_key) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "crypto_set_rsa_key : A parameter is missing");
RETURN_FALSE;
}
net_client = (struct net_client *) arg_net_client;
memcpy(&public_key, &arg_public_key, sizeof(arg_public_key));
instance = net_client_call_function(net_client, &crypto_set_rsa_key_func_def, NULL, public_key);
if (instance == NULL)
{
RETURN_NULL();
}
else
{
RETURN_LONG((long) instance);
}
}
/* }}} */
/// crypto_get_aes_params result byte swapping function.
/**
* This function byte swap the structure in-place.
* \param target A pointer to the structure.
*/
void
crypto_get_aes_params_result_bswap_fn ( struct crypto_get_aes_params_result * target );
/// crypto_get_aes_params result format definition.
static const struct net_struct crypto_get_aes_params_result_format =
{
2, sizeof(struct crypto_get_aes_params_result),
NULL, /* not used by client */
NULL, /* not used for results */
(net_struct_bswap_fn_t)crypto_get_aes_params_result_bswap_fn,
{
{ NET_TYPE_BOOL, 1, offsetof(struct crypto_get_aes_params_result, error) },
{ NET_TYPE_UBYTE, 128, offsetof(struct crypto_get_aes_params_result, aes_params) }
}
};
void
crypto_get_aes_params_result_bswap_fn ( struct crypto_get_aes_params_result * target )
{
}
/// crypto_get_aes_params function definition.
static const struct net_func crypto_get_aes_params_func_def =
{
0,
4,
NULL,
&crypto_get_aes_params_result_format
};
/* {{{ Prototype : long instance crypto_get_aes_params ( long net_client, ) */
PHP_FUNCTION(crypto_get_aes_params)
{
struct net_func_instance * instance;
struct net_client * net_client;
long arg_net_client;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg_net_client) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "crypto_get_aes_params : A parameter is missing");
RETURN_FALSE;
}
net_client = (struct net_client *) arg_net_client;
instance = net_client_call_function(net_client, &crypto_get_aes_params_func_def, NULL);
if (instance == NULL)
{
RETURN_NULL();
}
else
{
RETURN_LONG((long) instance);
}
}
/* }}} */
/* {{{ Prototype : Resource result crypto_get_aes_params_result ( long instance ) */
PHP_FUNCTION(crypto_get_aes_params_result)
{
struct crypto_get_aes_params_result * result;
struct crypto_get_aes_params_result * result_new;
struct net_func_instance * instance;
long arg_instance;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg_instance) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "crypto_get_aes_params_result : A parameter is missing");
RETURN_FALSE;
}
instance = (struct net_func_instance *) arg_instance;
result = (struct crypto_get_aes_params_result *) net_func_pop_result(instance);
if (result != NULL)
{
result_new = emalloc(sizeof(struct crypto_get_aes_params_result));
result_new->error = result->error;
memcpy(&result_new->aes_params, &result->aes_params, sizeof(result->aes_params));
ZEND_REGISTER_RESOURCE(return_value, result_new, le_crypto_get_aes_params_result);
return;
}
else
{
RETURN_LONG(0);
}
}
/* }}} */
/* {{{ Prototype : Array ["error", "aes_params", ] crypto_get_aes_params_result_fetch_array ( Resource result ) */
PHP_FUNCTION(crypto_get_aes_params_result_fetch_array)
{
struct crypto_get_aes_params_result * result;
zval * arg_result;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg_result) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "crypto_get_aes_params_result_fetch_array : A parameter is missing");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(result, struct crypto_get_aes_params_result *, &arg_result, -1, le_crypto_get_aes_params_result_name, le_crypto_get_aes_params_result);
array_init(return_value);
add_assoc_bool(return_value, "error", result->error);
add_assoc_long(return_value, "aes_params", (long) result->aes_params);
}
/* }}} */
/// crypto_begin result byte swapping function.
/**
* This function byte swap the structure in-place.
* \param target A pointer to the structure.
*/
void
crypto_begin_result_bswap_fn ( struct crypto_begin_result * target );
/// crypto_begin result format definition.
static const struct net_struct crypto_begin_result_format =
{
1, sizeof(struct crypto_begin_result),
NULL, /* not used by client */
NULL, /* not used for results */
(net_struct_bswap_fn_t)crypto_begin_result_bswap_fn,
{
{ NET_TYPE_BOOL, 1, offsetof(struct crypto_begin_result, error) }
}
};
void
crypto_begin_result_bswap_fn ( struct crypto_begin_result * target )
{
}
/// crypto_begin function definition.
static const struct net_func crypto_begin_func_def =
{
0,
5,
NULL,
&crypto_begin_result_format
};
/* {{{ Prototype : long instance crypto_begin ( long net_client, ) */
PHP_FUNCTION(crypto_begin)
{
struct net_func_instance * instance;
struct net_client * net_client;
long arg_net_client;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg_net_client) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "crypto_begin : A parameter is missing");
RETURN_FALSE;
}
net_client = (struct net_client *) arg_net_client;
instance = net_client_call_function(net_client, &crypto_begin_func_def, NULL);
if (instance == NULL)
{
RETURN_NULL();
}
else
{
RETURN_LONG((long) instance);
}
}
/* }}} */
/* {{{ Prototype : Resource result crypto_begin_result ( long instance ) */
PHP_FUNCTION(crypto_begin_result)
{
struct crypto_begin_result * result;
struct crypto_begin_result * result_new;
struct net_func_instance * instance;
long arg_instance;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg_instance) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "crypto_begin_result : A parameter is missing");
RETURN_FALSE;
}
instance = (struct net_func_instance *) arg_instance;
result = (struct crypto_begin_result *) net_func_pop_result(instance);
if (result != NULL)
{
result_new = emalloc(sizeof(struct crypto_begin_result));
result_new->error = result->error;
ZEND_REGISTER_RESOURCE(return_value, result_new, le_crypto_begin_result);
return;
}
else
{
RETURN_LONG(0);
}
}
/* }}} */
/* {{{ Prototype : Array ["error", ] crypto_begin_result_fetch_array ( Resource result ) */
PHP_FUNCTION(crypto_begin_result_fetch_array)
{
struct crypto_begin_result * result;
zval * arg_result;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg_result) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "crypto_begin_result_fetch_array : A parameter is missing");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(result, struct crypto_begin_result *, &arg_result, -1, le_crypto_begin_result_name, le_crypto_begin_result);
array_init(return_value);
add_assoc_bool(return_value, "error", result->error);
}
/* }}} */
/// crypto_end function definition.
static const struct net_func crypto_end_func_def =
{
0,
6,
NULL,
NULL
};
/* {{{ Prototype : long instance crypto_end ( long net_client, ) */
PHP_FUNCTION(crypto_end)
{
struct net_func_instance * instance;
struct net_client * net_client;
long arg_net_client;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg_net_client) == FAILURE)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "crypto_end : A parameter is missing");
RETURN_FALSE;
}
net_client = (struct net_client *) arg_net_client;
instance = net_client_call_function(net_client, &crypto_end_func_def, NULL);
if (instance == NULL)
{
RETURN_NULL();
}
else
{
RETURN_LONG((long) instance);
}
}
/* }}} */ |
Partager