1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00

Added vendor directory to source control

This commit is contained in:
Daniel 2021-11-08 13:23:16 -03:00
parent 16534d4217
commit d2589e176f
3049 changed files with 249997 additions and 395005 deletions

2
vendor/aws/aws-crt-php/ext/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.so
api.h

View file

@ -1,17 +1,17 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
/* This is a unity-build style source file, as PHP's build system is simplest with 1 source file per extension */
#include "credentials.c"
#include "crt.c"
#include "event_loop.c"
#include "http.c"
#include "signing.c"
#include "stream.c"
// #include "hash.c"
#include "crc.c"
#include "logging.c"
#include "php_util.c"
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
/* This is a unity-build style source file, as PHP's build system is simplest with 1 source file per extension */
#include "credentials.c"
#include "crt.c"
#include "event_loop.c"
#include "http.c"
#include "signing.c"
#include "stream.c"
// #include "hash.c"
#include "crc.c"
#include "logging.c"
#include "php_util.c"

View file

@ -1,88 +1,88 @@
<?php
/**
* @generate-class-entries
* @generate-function-entries
*/
function aws_crt_last_error(): int {}
function aws_crt_error_name(int $error_code): string {}
function aws_crt_error_str(int $error_code): string {}
function aws_crt_error_debug_str(int $error_code): string {}
function aws_crt_log_to_stdout(): void {}
function aws_crt_log_to_stderr(): void {}
function aws_crt_log_to_file(string $filename): void {}
function aws_crt_log_to_stream(object $stream): void {}
function aws_crt_log_stop(): void {}
function aws_crt_log_set_level(int $level): void {}
function aws_crt_log_message(string $message): void {}
function aws_crt_event_loop_group_options_new(): int {}
function aws_crt_event_loop_group_options_release(int $elg_options): void {}
function aws_crt_event_loop_group_options_set_max_threads(int $elg_options, int $max_threads): void {}
function aws_crt_event_loop_group_new(object $options): object {}
function aws_crt_event_loop_group_release(object $event_loop_group): void {}
function aws_crt_input_stream_options_new(): object {}
function aws_crt_input_stream_options_release(object $options): void {}
function aws_crt_input_stream_options_set_user_data(object $options, object $user_data): void {}
function aws_crt_input_stream_new(object $options): object {}
function aws_crt_input_stream_release(int $stream): void {}
function aws_crt_input_stream_seek(int $stream, int $offset, int $basis): int {}
function aws_crt_input_stream_read(int $stream, int $length): string {}
function aws_crt_input_stream_eof(int $stream): bool {}
function aws_crt_input_stream_get_length(int $stream): int {}
function aws_crt_http_message_new_from_blob(string $blob): int {}
function aws_crt_http_message_to_blob(int $message): string {}
function aws_crt_http_message_release(int $message): void {}
function aws_crt_credentials_options_new(): object {}
function aws_crt_credentials_options_release(object $options): void {}
function aws_crt_credentials_options_set_access_key_id(object $options, string $access_key_id): void {}
function aws_crt_credentials_options_set_secret_access_key(object $options, string $secret_access_key): void {}
function aws_crt_credentials_options_set_session_token(object $options, string $session_token): void {}
function aws_crt_credentials_options_set_expiration_timepoint_seconds(object $options, int $expiration_timepoint_seconds): void {}
function aws_crt_credentials_new(object $options): object {}
function aws_crt_credentials_release(object $credentials): void {}
function aws_crt_credentials_provider_release(int $credentials): void {}
function aws_crt_credentials_provider_static_options_new(): object {}
function aws_crt_credentials_provider_static_options_release(object $options): void {}
function aws_crt_credentials_provider_static_options_set_access_key_id(object $options, string $access_key_id): void {}
function aws_crt_credentials_provider_static_options_set_secret_access_key(object $options, string $secret_access_key): void {}
function aws_crt_credentials_provider_static_options_set_session_token(object $options, string $session_token): void {}
function aws_crt_credentials_provider_static_new(object $options): object {}
function aws_crt_signing_config_aws_new(): int {}
function aws_crt_signing_config_aws_release(int $config): void {}
function aws_crt_signing_config_aws_set_algorithm(int $config, int $algorithm): void {}
function aws_crt_signing_config_aws_set_signature_type(int $config, int $signature_type): void {}
function aws_crt_signing_config_aws_set_credentials_provider(int $config, int $credentials_provider): void {}
function aws_crt_signing_config_aws_set_region(int $config, string $region): void {}
function aws_crt_signing_config_aws_set_service(int $config, string $service): void {}
function aws_crt_signing_config_aws_set_use_double_uri_encode(int $config, bool $use_double_uri_encode): void {}
function aws_crt_signing_config_aws_set_should_normalize_uri_path(int $config, bool $should_normalize_uri_path): void {}
function aws_crt_signing_config_aws_set_omit_session_token(int $config, bool $omit_session_token): void {}
function aws_crt_signing_config_aws_set_signed_body_value(int $config, string $signed_body_value): void {}
function aws_crt_signing_config_aws_set_signed_body_header_type(int $config, int $signed_body_header_type): void {}
function aws_crt_signing_config_aws_set_expiration_in_seconds(int $config, int $expiration_in_seconds): void {}
function aws_crt_signing_config_aws_set_date(int $config, int $timestamp): void {}
function aws_crt_signing_config_aws_set_should_sign_header_fn(int $config, object $should_sign_header): void {}
function aws_crt_signable_new_from_http_request(int $http_message): int {}
function aws_crt_signable_new_from_chunk(int $input_stream, string $previous_signature): int {}
function aws_crt_signable_new_from_canonical_request(string $request): int {}
function aws_crt_signable_release(int $signable): void {}
function aws_crt_signing_result_release(int $signing_result): void {}
function aws_crt_signing_result_apply_to_http_request(object $signing_result, object $http_request): void {}
function aws_crt_sign_request_aws(int $signable, int $signing_config, object $on_complete, object $user_data): int {}
function aws_crt_test_verify_sigv4a_signing(int $signable, int $signing_config, string $expected_canonical_request, string $signature, string $ecc_key_pub_x, string $ecc_key_pub_y): bool {}
function aws_crt_crc32(string $input, int $prev): int {}
function aws_crt_crc32c(string $input, int $prev): int {}
<?php
/**
* @generate-class-entries
* @generate-function-entries
*/
function aws_crt_last_error(): int {}
function aws_crt_error_name(int $error_code): string {}
function aws_crt_error_str(int $error_code): string {}
function aws_crt_error_debug_str(int $error_code): string {}
function aws_crt_log_to_stdout(): void {}
function aws_crt_log_to_stderr(): void {}
function aws_crt_log_to_file(string $filename): void {}
function aws_crt_log_to_stream(object $stream): void {}
function aws_crt_log_stop(): void {}
function aws_crt_log_set_level(int $level): void {}
function aws_crt_log_message(string $message): void {}
function aws_crt_event_loop_group_options_new(): int {}
function aws_crt_event_loop_group_options_release(int $elg_options): void {}
function aws_crt_event_loop_group_options_set_max_threads(int $elg_options, int $max_threads): void {}
function aws_crt_event_loop_group_new(object $options): object {}
function aws_crt_event_loop_group_release(object $event_loop_group): void {}
function aws_crt_input_stream_options_new(): object {}
function aws_crt_input_stream_options_release(object $options): void {}
function aws_crt_input_stream_options_set_user_data(object $options, object $user_data): void {}
function aws_crt_input_stream_new(object $options): object {}
function aws_crt_input_stream_release(int $stream): void {}
function aws_crt_input_stream_seek(int $stream, int $offset, int $basis): int {}
function aws_crt_input_stream_read(int $stream, int $length): string {}
function aws_crt_input_stream_eof(int $stream): bool {}
function aws_crt_input_stream_get_length(int $stream): int {}
function aws_crt_http_message_new_from_blob(string $blob): int {}
function aws_crt_http_message_to_blob(int $message): string {}
function aws_crt_http_message_release(int $message): void {}
function aws_crt_credentials_options_new(): object {}
function aws_crt_credentials_options_release(object $options): void {}
function aws_crt_credentials_options_set_access_key_id(object $options, string $access_key_id): void {}
function aws_crt_credentials_options_set_secret_access_key(object $options, string $secret_access_key): void {}
function aws_crt_credentials_options_set_session_token(object $options, string $session_token): void {}
function aws_crt_credentials_options_set_expiration_timepoint_seconds(object $options, int $expiration_timepoint_seconds): void {}
function aws_crt_credentials_new(object $options): object {}
function aws_crt_credentials_release(object $credentials): void {}
function aws_crt_credentials_provider_release(int $credentials): void {}
function aws_crt_credentials_provider_static_options_new(): object {}
function aws_crt_credentials_provider_static_options_release(object $options): void {}
function aws_crt_credentials_provider_static_options_set_access_key_id(object $options, string $access_key_id): void {}
function aws_crt_credentials_provider_static_options_set_secret_access_key(object $options, string $secret_access_key): void {}
function aws_crt_credentials_provider_static_options_set_session_token(object $options, string $session_token): void {}
function aws_crt_credentials_provider_static_new(object $options): object {}
function aws_crt_signing_config_aws_new(): int {}
function aws_crt_signing_config_aws_release(int $config): void {}
function aws_crt_signing_config_aws_set_algorithm(int $config, int $algorithm): void {}
function aws_crt_signing_config_aws_set_signature_type(int $config, int $signature_type): void {}
function aws_crt_signing_config_aws_set_credentials_provider(int $config, int $credentials_provider): void {}
function aws_crt_signing_config_aws_set_region(int $config, string $region): void {}
function aws_crt_signing_config_aws_set_service(int $config, string $service): void {}
function aws_crt_signing_config_aws_set_use_double_uri_encode(int $config, bool $use_double_uri_encode): void {}
function aws_crt_signing_config_aws_set_should_normalize_uri_path(int $config, bool $should_normalize_uri_path): void {}
function aws_crt_signing_config_aws_set_omit_session_token(int $config, bool $omit_session_token): void {}
function aws_crt_signing_config_aws_set_signed_body_value(int $config, string $signed_body_value): void {}
function aws_crt_signing_config_aws_set_signed_body_header_type(int $config, int $signed_body_header_type): void {}
function aws_crt_signing_config_aws_set_expiration_in_seconds(int $config, int $expiration_in_seconds): void {}
function aws_crt_signing_config_aws_set_date(int $config, int $timestamp): void {}
function aws_crt_signing_config_aws_set_should_sign_header_fn(int $config, object $should_sign_header): void {}
function aws_crt_signable_new_from_http_request(int $http_message): int {}
function aws_crt_signable_new_from_chunk(int $input_stream, string $previous_signature): int {}
function aws_crt_signable_new_from_canonical_request(string $request): int {}
function aws_crt_signable_release(int $signable): void {}
function aws_crt_signing_result_release(int $signing_result): void {}
function aws_crt_signing_result_apply_to_http_request(object $signing_result, object $http_request): void {}
function aws_crt_sign_request_aws(int $signable, int $signing_config, object $on_complete, object $user_data): int {}
function aws_crt_test_verify_sigv4a_signing(int $signable, int $signing_config, string $expected_canonical_request, string $signature, string $ecc_key_pub_x, string $ecc_key_pub_y): bool {}
function aws_crt_crc32(string $input, int $prev): int {}
function aws_crt_crc32c(string $input, int $prev): int {}

View file

@ -1,413 +1,413 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 344f9d59b85697b80bb6808ac7d5eb7c1d07c03f */
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_last_error, 0, 0, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_error_name, 0, 0, 1)
ZEND_ARG_INFO(0, error_code)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_error_str arginfo_aws_crt_error_name
#define arginfo_aws_crt_error_debug_str arginfo_aws_crt_error_name
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_to_stdout, 0, 0, 0)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_log_to_stderr arginfo_aws_crt_log_to_stdout
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_to_file, 0, 0, 1)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_to_stream, 0, 0, 1)
ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_log_stop arginfo_aws_crt_log_to_stdout
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_set_level, 0, 0, 1)
ZEND_ARG_INFO(0, level)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_message, 0, 0, 1)
ZEND_ARG_INFO(0, message)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_event_loop_group_options_new arginfo_aws_crt_last_error
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_options_release, 0, 0, 1)
ZEND_ARG_INFO(0, elg_options)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_options_set_max_threads, 0, 0, 2)
ZEND_ARG_INFO(0, elg_options)
ZEND_ARG_INFO(0, max_threads)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_new, 0, 0, 1)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_release, 0, 0, 1)
ZEND_ARG_INFO(0, event_loop_group)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_options_new, 0, 0, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_options_release, 0, 0, 1)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_options_set_user_data, 0, 0, 2)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, user_data)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_input_stream_new arginfo_aws_crt_event_loop_group_new
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_release, 0, 0, 1)
ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_seek, 0, 0, 3)
ZEND_ARG_INFO(0, stream)
ZEND_ARG_INFO(0, offset)
ZEND_ARG_INFO(0, basis)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_read, 0, 0, 2)
ZEND_ARG_INFO(0, stream)
ZEND_ARG_INFO(0, length)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_eof, 0, 0, 1)
ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_get_length, 0, 0, 1)
ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_http_message_new_from_blob, 0, 0, 1)
ZEND_ARG_INFO(0, blob)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_http_message_to_blob, 0, 0, 1)
ZEND_ARG_INFO(0, message)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_http_message_release, 0, 0, 1)
ZEND_ARG_INFO(0, message)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_credentials_options_new arginfo_aws_crt_input_stream_options_new
#define arginfo_aws_crt_credentials_options_release arginfo_aws_crt_input_stream_options_release
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_access_key_id, 0, 0, 2)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, access_key_id)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_secret_access_key, 0, 0, 2)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, secret_access_key)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_session_token, 0, 0, 2)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, session_token)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_expiration_timepoint_seconds, 0, 0, 2)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, expiration_timepoint_seconds)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_credentials_new arginfo_aws_crt_event_loop_group_new
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_release, 0, 0, 1)
ZEND_ARG_INFO(0, credentials)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_provider_release, 0, 0, 1)
ZEND_ARG_INFO(0, credentials)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_credentials_provider_static_options_new arginfo_aws_crt_input_stream_options_new
#define arginfo_aws_crt_credentials_provider_static_options_release arginfo_aws_crt_input_stream_options_release
#define arginfo_aws_crt_credentials_provider_static_options_set_access_key_id arginfo_aws_crt_credentials_options_set_access_key_id
#define arginfo_aws_crt_credentials_provider_static_options_set_secret_access_key arginfo_aws_crt_credentials_options_set_secret_access_key
#define arginfo_aws_crt_credentials_provider_static_options_set_session_token arginfo_aws_crt_credentials_options_set_session_token
#define arginfo_aws_crt_credentials_provider_static_new arginfo_aws_crt_event_loop_group_new
#define arginfo_aws_crt_signing_config_aws_new arginfo_aws_crt_last_error
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_release, 0, 0, 1)
ZEND_ARG_INFO(0, config)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_algorithm, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, algorithm)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_signature_type, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, signature_type)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_credentials_provider, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, credentials_provider)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_region, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, region)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_service, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, service)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_use_double_uri_encode, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, use_double_uri_encode)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_should_normalize_uri_path, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, should_normalize_uri_path)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_omit_session_token, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, omit_session_token)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_signed_body_value, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, signed_body_value)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_signed_body_header_type, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, signed_body_header_type)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_expiration_in_seconds, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, expiration_in_seconds)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_date, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, timestamp)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_should_sign_header_fn, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, should_sign_header)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_new_from_http_request, 0, 0, 1)
ZEND_ARG_INFO(0, http_message)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_new_from_chunk, 0, 0, 2)
ZEND_ARG_INFO(0, input_stream)
ZEND_ARG_INFO(0, previous_signature)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_new_from_canonical_request, 0, 0, 1)
ZEND_ARG_INFO(0, request)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_release, 0, 0, 1)
ZEND_ARG_INFO(0, signable)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_result_release, 0, 0, 1)
ZEND_ARG_INFO(0, signing_result)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_result_apply_to_http_request, 0, 0, 2)
ZEND_ARG_INFO(0, signing_result)
ZEND_ARG_INFO(0, http_request)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_sign_request_aws, 0, 0, 4)
ZEND_ARG_INFO(0, signable)
ZEND_ARG_INFO(0, signing_config)
ZEND_ARG_INFO(0, on_complete)
ZEND_ARG_INFO(0, user_data)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_test_verify_sigv4a_signing, 0, 0, 6)
ZEND_ARG_INFO(0, signable)
ZEND_ARG_INFO(0, signing_config)
ZEND_ARG_INFO(0, expected_canonical_request)
ZEND_ARG_INFO(0, signature)
ZEND_ARG_INFO(0, ecc_key_pub_x)
ZEND_ARG_INFO(0, ecc_key_pub_y)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_crc32, 0, 0, 2)
ZEND_ARG_INFO(0, input)
ZEND_ARG_INFO(0, prev)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_crc32c arginfo_aws_crt_crc32
ZEND_FUNCTION(aws_crt_last_error);
ZEND_FUNCTION(aws_crt_error_name);
ZEND_FUNCTION(aws_crt_error_str);
ZEND_FUNCTION(aws_crt_error_debug_str);
ZEND_FUNCTION(aws_crt_log_to_stdout);
ZEND_FUNCTION(aws_crt_log_to_stderr);
ZEND_FUNCTION(aws_crt_log_to_file);
ZEND_FUNCTION(aws_crt_log_to_stream);
ZEND_FUNCTION(aws_crt_log_stop);
ZEND_FUNCTION(aws_crt_log_set_level);
ZEND_FUNCTION(aws_crt_log_message);
ZEND_FUNCTION(aws_crt_event_loop_group_options_new);
ZEND_FUNCTION(aws_crt_event_loop_group_options_release);
ZEND_FUNCTION(aws_crt_event_loop_group_options_set_max_threads);
ZEND_FUNCTION(aws_crt_event_loop_group_new);
ZEND_FUNCTION(aws_crt_event_loop_group_release);
ZEND_FUNCTION(aws_crt_input_stream_options_new);
ZEND_FUNCTION(aws_crt_input_stream_options_release);
ZEND_FUNCTION(aws_crt_input_stream_options_set_user_data);
ZEND_FUNCTION(aws_crt_input_stream_new);
ZEND_FUNCTION(aws_crt_input_stream_release);
ZEND_FUNCTION(aws_crt_input_stream_seek);
ZEND_FUNCTION(aws_crt_input_stream_read);
ZEND_FUNCTION(aws_crt_input_stream_eof);
ZEND_FUNCTION(aws_crt_input_stream_get_length);
ZEND_FUNCTION(aws_crt_http_message_new_from_blob);
ZEND_FUNCTION(aws_crt_http_message_to_blob);
ZEND_FUNCTION(aws_crt_http_message_release);
ZEND_FUNCTION(aws_crt_credentials_options_new);
ZEND_FUNCTION(aws_crt_credentials_options_release);
ZEND_FUNCTION(aws_crt_credentials_options_set_access_key_id);
ZEND_FUNCTION(aws_crt_credentials_options_set_secret_access_key);
ZEND_FUNCTION(aws_crt_credentials_options_set_session_token);
ZEND_FUNCTION(aws_crt_credentials_options_set_expiration_timepoint_seconds);
ZEND_FUNCTION(aws_crt_credentials_new);
ZEND_FUNCTION(aws_crt_credentials_release);
ZEND_FUNCTION(aws_crt_credentials_provider_release);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_new);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_release);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_set_access_key_id);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_set_secret_access_key);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_set_session_token);
ZEND_FUNCTION(aws_crt_credentials_provider_static_new);
ZEND_FUNCTION(aws_crt_signing_config_aws_new);
ZEND_FUNCTION(aws_crt_signing_config_aws_release);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_algorithm);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_signature_type);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_credentials_provider);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_region);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_service);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_use_double_uri_encode);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_should_normalize_uri_path);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_omit_session_token);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_signed_body_value);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_signed_body_header_type);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_expiration_in_seconds);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_date);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_should_sign_header_fn);
ZEND_FUNCTION(aws_crt_signable_new_from_http_request);
ZEND_FUNCTION(aws_crt_signable_new_from_chunk);
ZEND_FUNCTION(aws_crt_signable_new_from_canonical_request);
ZEND_FUNCTION(aws_crt_signable_release);
ZEND_FUNCTION(aws_crt_signing_result_release);
ZEND_FUNCTION(aws_crt_signing_result_apply_to_http_request);
ZEND_FUNCTION(aws_crt_sign_request_aws);
ZEND_FUNCTION(aws_crt_test_verify_sigv4a_signing);
ZEND_FUNCTION(aws_crt_crc32);
ZEND_FUNCTION(aws_crt_crc32c);
static const zend_function_entry ext_functions[] = {
ZEND_FE(aws_crt_last_error, arginfo_aws_crt_last_error)
ZEND_FE(aws_crt_error_name, arginfo_aws_crt_error_name)
ZEND_FE(aws_crt_error_str, arginfo_aws_crt_error_str)
ZEND_FE(aws_crt_error_debug_str, arginfo_aws_crt_error_debug_str)
ZEND_FE(aws_crt_log_to_stdout, arginfo_aws_crt_log_to_stdout)
ZEND_FE(aws_crt_log_to_stderr, arginfo_aws_crt_log_to_stderr)
ZEND_FE(aws_crt_log_to_file, arginfo_aws_crt_log_to_file)
ZEND_FE(aws_crt_log_to_stream, arginfo_aws_crt_log_to_stream)
ZEND_FE(aws_crt_log_stop, arginfo_aws_crt_log_stop)
ZEND_FE(aws_crt_log_set_level, arginfo_aws_crt_log_set_level)
ZEND_FE(aws_crt_log_message, arginfo_aws_crt_log_message)
ZEND_FE(aws_crt_event_loop_group_options_new, arginfo_aws_crt_event_loop_group_options_new)
ZEND_FE(aws_crt_event_loop_group_options_release, arginfo_aws_crt_event_loop_group_options_release)
ZEND_FE(aws_crt_event_loop_group_options_set_max_threads, arginfo_aws_crt_event_loop_group_options_set_max_threads)
ZEND_FE(aws_crt_event_loop_group_new, arginfo_aws_crt_event_loop_group_new)
ZEND_FE(aws_crt_event_loop_group_release, arginfo_aws_crt_event_loop_group_release)
ZEND_FE(aws_crt_input_stream_options_new, arginfo_aws_crt_input_stream_options_new)
ZEND_FE(aws_crt_input_stream_options_release, arginfo_aws_crt_input_stream_options_release)
ZEND_FE(aws_crt_input_stream_options_set_user_data, arginfo_aws_crt_input_stream_options_set_user_data)
ZEND_FE(aws_crt_input_stream_new, arginfo_aws_crt_input_stream_new)
ZEND_FE(aws_crt_input_stream_release, arginfo_aws_crt_input_stream_release)
ZEND_FE(aws_crt_input_stream_seek, arginfo_aws_crt_input_stream_seek)
ZEND_FE(aws_crt_input_stream_read, arginfo_aws_crt_input_stream_read)
ZEND_FE(aws_crt_input_stream_eof, arginfo_aws_crt_input_stream_eof)
ZEND_FE(aws_crt_input_stream_get_length, arginfo_aws_crt_input_stream_get_length)
ZEND_FE(aws_crt_http_message_new_from_blob, arginfo_aws_crt_http_message_new_from_blob)
ZEND_FE(aws_crt_http_message_to_blob, arginfo_aws_crt_http_message_to_blob)
ZEND_FE(aws_crt_http_message_release, arginfo_aws_crt_http_message_release)
ZEND_FE(aws_crt_credentials_options_new, arginfo_aws_crt_credentials_options_new)
ZEND_FE(aws_crt_credentials_options_release, arginfo_aws_crt_credentials_options_release)
ZEND_FE(aws_crt_credentials_options_set_access_key_id, arginfo_aws_crt_credentials_options_set_access_key_id)
ZEND_FE(aws_crt_credentials_options_set_secret_access_key, arginfo_aws_crt_credentials_options_set_secret_access_key)
ZEND_FE(aws_crt_credentials_options_set_session_token, arginfo_aws_crt_credentials_options_set_session_token)
ZEND_FE(aws_crt_credentials_options_set_expiration_timepoint_seconds, arginfo_aws_crt_credentials_options_set_expiration_timepoint_seconds)
ZEND_FE(aws_crt_credentials_new, arginfo_aws_crt_credentials_new)
ZEND_FE(aws_crt_credentials_release, arginfo_aws_crt_credentials_release)
ZEND_FE(aws_crt_credentials_provider_release, arginfo_aws_crt_credentials_provider_release)
ZEND_FE(aws_crt_credentials_provider_static_options_new, arginfo_aws_crt_credentials_provider_static_options_new)
ZEND_FE(aws_crt_credentials_provider_static_options_release, arginfo_aws_crt_credentials_provider_static_options_release)
ZEND_FE(aws_crt_credentials_provider_static_options_set_access_key_id, arginfo_aws_crt_credentials_provider_static_options_set_access_key_id)
ZEND_FE(aws_crt_credentials_provider_static_options_set_secret_access_key, arginfo_aws_crt_credentials_provider_static_options_set_secret_access_key)
ZEND_FE(aws_crt_credentials_provider_static_options_set_session_token, arginfo_aws_crt_credentials_provider_static_options_set_session_token)
ZEND_FE(aws_crt_credentials_provider_static_new, arginfo_aws_crt_credentials_provider_static_new)
ZEND_FE(aws_crt_signing_config_aws_new, arginfo_aws_crt_signing_config_aws_new)
ZEND_FE(aws_crt_signing_config_aws_release, arginfo_aws_crt_signing_config_aws_release)
ZEND_FE(aws_crt_signing_config_aws_set_algorithm, arginfo_aws_crt_signing_config_aws_set_algorithm)
ZEND_FE(aws_crt_signing_config_aws_set_signature_type, arginfo_aws_crt_signing_config_aws_set_signature_type)
ZEND_FE(aws_crt_signing_config_aws_set_credentials_provider, arginfo_aws_crt_signing_config_aws_set_credentials_provider)
ZEND_FE(aws_crt_signing_config_aws_set_region, arginfo_aws_crt_signing_config_aws_set_region)
ZEND_FE(aws_crt_signing_config_aws_set_service, arginfo_aws_crt_signing_config_aws_set_service)
ZEND_FE(aws_crt_signing_config_aws_set_use_double_uri_encode, arginfo_aws_crt_signing_config_aws_set_use_double_uri_encode)
ZEND_FE(aws_crt_signing_config_aws_set_should_normalize_uri_path, arginfo_aws_crt_signing_config_aws_set_should_normalize_uri_path)
ZEND_FE(aws_crt_signing_config_aws_set_omit_session_token, arginfo_aws_crt_signing_config_aws_set_omit_session_token)
ZEND_FE(aws_crt_signing_config_aws_set_signed_body_value, arginfo_aws_crt_signing_config_aws_set_signed_body_value)
ZEND_FE(aws_crt_signing_config_aws_set_signed_body_header_type, arginfo_aws_crt_signing_config_aws_set_signed_body_header_type)
ZEND_FE(aws_crt_signing_config_aws_set_expiration_in_seconds, arginfo_aws_crt_signing_config_aws_set_expiration_in_seconds)
ZEND_FE(aws_crt_signing_config_aws_set_date, arginfo_aws_crt_signing_config_aws_set_date)
ZEND_FE(aws_crt_signing_config_aws_set_should_sign_header_fn, arginfo_aws_crt_signing_config_aws_set_should_sign_header_fn)
ZEND_FE(aws_crt_signable_new_from_http_request, arginfo_aws_crt_signable_new_from_http_request)
ZEND_FE(aws_crt_signable_new_from_chunk, arginfo_aws_crt_signable_new_from_chunk)
ZEND_FE(aws_crt_signable_new_from_canonical_request, arginfo_aws_crt_signable_new_from_canonical_request)
ZEND_FE(aws_crt_signable_release, arginfo_aws_crt_signable_release)
ZEND_FE(aws_crt_signing_result_release, arginfo_aws_crt_signing_result_release)
ZEND_FE(aws_crt_signing_result_apply_to_http_request, arginfo_aws_crt_signing_result_apply_to_http_request)
ZEND_FE(aws_crt_sign_request_aws, arginfo_aws_crt_sign_request_aws)
ZEND_FE(aws_crt_test_verify_sigv4a_signing, arginfo_aws_crt_test_verify_sigv4a_signing)
ZEND_FE(aws_crt_crc32, arginfo_aws_crt_crc32)
ZEND_FE(aws_crt_crc32c, arginfo_aws_crt_crc32c)
ZEND_FE_END
};
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 344f9d59b85697b80bb6808ac7d5eb7c1d07c03f */
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_last_error, 0, 0, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_error_name, 0, 0, 1)
ZEND_ARG_INFO(0, error_code)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_error_str arginfo_aws_crt_error_name
#define arginfo_aws_crt_error_debug_str arginfo_aws_crt_error_name
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_to_stdout, 0, 0, 0)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_log_to_stderr arginfo_aws_crt_log_to_stdout
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_to_file, 0, 0, 1)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_to_stream, 0, 0, 1)
ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_log_stop arginfo_aws_crt_log_to_stdout
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_set_level, 0, 0, 1)
ZEND_ARG_INFO(0, level)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_log_message, 0, 0, 1)
ZEND_ARG_INFO(0, message)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_event_loop_group_options_new arginfo_aws_crt_last_error
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_options_release, 0, 0, 1)
ZEND_ARG_INFO(0, elg_options)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_options_set_max_threads, 0, 0, 2)
ZEND_ARG_INFO(0, elg_options)
ZEND_ARG_INFO(0, max_threads)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_new, 0, 0, 1)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_event_loop_group_release, 0, 0, 1)
ZEND_ARG_INFO(0, event_loop_group)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_options_new, 0, 0, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_options_release, 0, 0, 1)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_options_set_user_data, 0, 0, 2)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, user_data)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_input_stream_new arginfo_aws_crt_event_loop_group_new
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_release, 0, 0, 1)
ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_seek, 0, 0, 3)
ZEND_ARG_INFO(0, stream)
ZEND_ARG_INFO(0, offset)
ZEND_ARG_INFO(0, basis)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_read, 0, 0, 2)
ZEND_ARG_INFO(0, stream)
ZEND_ARG_INFO(0, length)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_eof, 0, 0, 1)
ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_input_stream_get_length, 0, 0, 1)
ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_http_message_new_from_blob, 0, 0, 1)
ZEND_ARG_INFO(0, blob)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_http_message_to_blob, 0, 0, 1)
ZEND_ARG_INFO(0, message)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_http_message_release, 0, 0, 1)
ZEND_ARG_INFO(0, message)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_credentials_options_new arginfo_aws_crt_input_stream_options_new
#define arginfo_aws_crt_credentials_options_release arginfo_aws_crt_input_stream_options_release
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_access_key_id, 0, 0, 2)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, access_key_id)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_secret_access_key, 0, 0, 2)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, secret_access_key)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_session_token, 0, 0, 2)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, session_token)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_options_set_expiration_timepoint_seconds, 0, 0, 2)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, expiration_timepoint_seconds)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_credentials_new arginfo_aws_crt_event_loop_group_new
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_release, 0, 0, 1)
ZEND_ARG_INFO(0, credentials)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_credentials_provider_release, 0, 0, 1)
ZEND_ARG_INFO(0, credentials)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_credentials_provider_static_options_new arginfo_aws_crt_input_stream_options_new
#define arginfo_aws_crt_credentials_provider_static_options_release arginfo_aws_crt_input_stream_options_release
#define arginfo_aws_crt_credentials_provider_static_options_set_access_key_id arginfo_aws_crt_credentials_options_set_access_key_id
#define arginfo_aws_crt_credentials_provider_static_options_set_secret_access_key arginfo_aws_crt_credentials_options_set_secret_access_key
#define arginfo_aws_crt_credentials_provider_static_options_set_session_token arginfo_aws_crt_credentials_options_set_session_token
#define arginfo_aws_crt_credentials_provider_static_new arginfo_aws_crt_event_loop_group_new
#define arginfo_aws_crt_signing_config_aws_new arginfo_aws_crt_last_error
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_release, 0, 0, 1)
ZEND_ARG_INFO(0, config)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_algorithm, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, algorithm)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_signature_type, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, signature_type)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_credentials_provider, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, credentials_provider)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_region, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, region)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_service, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, service)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_use_double_uri_encode, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, use_double_uri_encode)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_should_normalize_uri_path, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, should_normalize_uri_path)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_omit_session_token, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, omit_session_token)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_signed_body_value, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, signed_body_value)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_signed_body_header_type, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, signed_body_header_type)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_expiration_in_seconds, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, expiration_in_seconds)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_date, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, timestamp)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_config_aws_set_should_sign_header_fn, 0, 0, 2)
ZEND_ARG_INFO(0, config)
ZEND_ARG_INFO(0, should_sign_header)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_new_from_http_request, 0, 0, 1)
ZEND_ARG_INFO(0, http_message)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_new_from_chunk, 0, 0, 2)
ZEND_ARG_INFO(0, input_stream)
ZEND_ARG_INFO(0, previous_signature)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_new_from_canonical_request, 0, 0, 1)
ZEND_ARG_INFO(0, request)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signable_release, 0, 0, 1)
ZEND_ARG_INFO(0, signable)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_result_release, 0, 0, 1)
ZEND_ARG_INFO(0, signing_result)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_signing_result_apply_to_http_request, 0, 0, 2)
ZEND_ARG_INFO(0, signing_result)
ZEND_ARG_INFO(0, http_request)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_sign_request_aws, 0, 0, 4)
ZEND_ARG_INFO(0, signable)
ZEND_ARG_INFO(0, signing_config)
ZEND_ARG_INFO(0, on_complete)
ZEND_ARG_INFO(0, user_data)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_test_verify_sigv4a_signing, 0, 0, 6)
ZEND_ARG_INFO(0, signable)
ZEND_ARG_INFO(0, signing_config)
ZEND_ARG_INFO(0, expected_canonical_request)
ZEND_ARG_INFO(0, signature)
ZEND_ARG_INFO(0, ecc_key_pub_x)
ZEND_ARG_INFO(0, ecc_key_pub_y)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_aws_crt_crc32, 0, 0, 2)
ZEND_ARG_INFO(0, input)
ZEND_ARG_INFO(0, prev)
ZEND_END_ARG_INFO()
#define arginfo_aws_crt_crc32c arginfo_aws_crt_crc32
ZEND_FUNCTION(aws_crt_last_error);
ZEND_FUNCTION(aws_crt_error_name);
ZEND_FUNCTION(aws_crt_error_str);
ZEND_FUNCTION(aws_crt_error_debug_str);
ZEND_FUNCTION(aws_crt_log_to_stdout);
ZEND_FUNCTION(aws_crt_log_to_stderr);
ZEND_FUNCTION(aws_crt_log_to_file);
ZEND_FUNCTION(aws_crt_log_to_stream);
ZEND_FUNCTION(aws_crt_log_stop);
ZEND_FUNCTION(aws_crt_log_set_level);
ZEND_FUNCTION(aws_crt_log_message);
ZEND_FUNCTION(aws_crt_event_loop_group_options_new);
ZEND_FUNCTION(aws_crt_event_loop_group_options_release);
ZEND_FUNCTION(aws_crt_event_loop_group_options_set_max_threads);
ZEND_FUNCTION(aws_crt_event_loop_group_new);
ZEND_FUNCTION(aws_crt_event_loop_group_release);
ZEND_FUNCTION(aws_crt_input_stream_options_new);
ZEND_FUNCTION(aws_crt_input_stream_options_release);
ZEND_FUNCTION(aws_crt_input_stream_options_set_user_data);
ZEND_FUNCTION(aws_crt_input_stream_new);
ZEND_FUNCTION(aws_crt_input_stream_release);
ZEND_FUNCTION(aws_crt_input_stream_seek);
ZEND_FUNCTION(aws_crt_input_stream_read);
ZEND_FUNCTION(aws_crt_input_stream_eof);
ZEND_FUNCTION(aws_crt_input_stream_get_length);
ZEND_FUNCTION(aws_crt_http_message_new_from_blob);
ZEND_FUNCTION(aws_crt_http_message_to_blob);
ZEND_FUNCTION(aws_crt_http_message_release);
ZEND_FUNCTION(aws_crt_credentials_options_new);
ZEND_FUNCTION(aws_crt_credentials_options_release);
ZEND_FUNCTION(aws_crt_credentials_options_set_access_key_id);
ZEND_FUNCTION(aws_crt_credentials_options_set_secret_access_key);
ZEND_FUNCTION(aws_crt_credentials_options_set_session_token);
ZEND_FUNCTION(aws_crt_credentials_options_set_expiration_timepoint_seconds);
ZEND_FUNCTION(aws_crt_credentials_new);
ZEND_FUNCTION(aws_crt_credentials_release);
ZEND_FUNCTION(aws_crt_credentials_provider_release);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_new);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_release);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_set_access_key_id);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_set_secret_access_key);
ZEND_FUNCTION(aws_crt_credentials_provider_static_options_set_session_token);
ZEND_FUNCTION(aws_crt_credentials_provider_static_new);
ZEND_FUNCTION(aws_crt_signing_config_aws_new);
ZEND_FUNCTION(aws_crt_signing_config_aws_release);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_algorithm);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_signature_type);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_credentials_provider);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_region);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_service);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_use_double_uri_encode);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_should_normalize_uri_path);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_omit_session_token);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_signed_body_value);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_signed_body_header_type);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_expiration_in_seconds);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_date);
ZEND_FUNCTION(aws_crt_signing_config_aws_set_should_sign_header_fn);
ZEND_FUNCTION(aws_crt_signable_new_from_http_request);
ZEND_FUNCTION(aws_crt_signable_new_from_chunk);
ZEND_FUNCTION(aws_crt_signable_new_from_canonical_request);
ZEND_FUNCTION(aws_crt_signable_release);
ZEND_FUNCTION(aws_crt_signing_result_release);
ZEND_FUNCTION(aws_crt_signing_result_apply_to_http_request);
ZEND_FUNCTION(aws_crt_sign_request_aws);
ZEND_FUNCTION(aws_crt_test_verify_sigv4a_signing);
ZEND_FUNCTION(aws_crt_crc32);
ZEND_FUNCTION(aws_crt_crc32c);
static const zend_function_entry ext_functions[] = {
ZEND_FE(aws_crt_last_error, arginfo_aws_crt_last_error)
ZEND_FE(aws_crt_error_name, arginfo_aws_crt_error_name)
ZEND_FE(aws_crt_error_str, arginfo_aws_crt_error_str)
ZEND_FE(aws_crt_error_debug_str, arginfo_aws_crt_error_debug_str)
ZEND_FE(aws_crt_log_to_stdout, arginfo_aws_crt_log_to_stdout)
ZEND_FE(aws_crt_log_to_stderr, arginfo_aws_crt_log_to_stderr)
ZEND_FE(aws_crt_log_to_file, arginfo_aws_crt_log_to_file)
ZEND_FE(aws_crt_log_to_stream, arginfo_aws_crt_log_to_stream)
ZEND_FE(aws_crt_log_stop, arginfo_aws_crt_log_stop)
ZEND_FE(aws_crt_log_set_level, arginfo_aws_crt_log_set_level)
ZEND_FE(aws_crt_log_message, arginfo_aws_crt_log_message)
ZEND_FE(aws_crt_event_loop_group_options_new, arginfo_aws_crt_event_loop_group_options_new)
ZEND_FE(aws_crt_event_loop_group_options_release, arginfo_aws_crt_event_loop_group_options_release)
ZEND_FE(aws_crt_event_loop_group_options_set_max_threads, arginfo_aws_crt_event_loop_group_options_set_max_threads)
ZEND_FE(aws_crt_event_loop_group_new, arginfo_aws_crt_event_loop_group_new)
ZEND_FE(aws_crt_event_loop_group_release, arginfo_aws_crt_event_loop_group_release)
ZEND_FE(aws_crt_input_stream_options_new, arginfo_aws_crt_input_stream_options_new)
ZEND_FE(aws_crt_input_stream_options_release, arginfo_aws_crt_input_stream_options_release)
ZEND_FE(aws_crt_input_stream_options_set_user_data, arginfo_aws_crt_input_stream_options_set_user_data)
ZEND_FE(aws_crt_input_stream_new, arginfo_aws_crt_input_stream_new)
ZEND_FE(aws_crt_input_stream_release, arginfo_aws_crt_input_stream_release)
ZEND_FE(aws_crt_input_stream_seek, arginfo_aws_crt_input_stream_seek)
ZEND_FE(aws_crt_input_stream_read, arginfo_aws_crt_input_stream_read)
ZEND_FE(aws_crt_input_stream_eof, arginfo_aws_crt_input_stream_eof)
ZEND_FE(aws_crt_input_stream_get_length, arginfo_aws_crt_input_stream_get_length)
ZEND_FE(aws_crt_http_message_new_from_blob, arginfo_aws_crt_http_message_new_from_blob)
ZEND_FE(aws_crt_http_message_to_blob, arginfo_aws_crt_http_message_to_blob)
ZEND_FE(aws_crt_http_message_release, arginfo_aws_crt_http_message_release)
ZEND_FE(aws_crt_credentials_options_new, arginfo_aws_crt_credentials_options_new)
ZEND_FE(aws_crt_credentials_options_release, arginfo_aws_crt_credentials_options_release)
ZEND_FE(aws_crt_credentials_options_set_access_key_id, arginfo_aws_crt_credentials_options_set_access_key_id)
ZEND_FE(aws_crt_credentials_options_set_secret_access_key, arginfo_aws_crt_credentials_options_set_secret_access_key)
ZEND_FE(aws_crt_credentials_options_set_session_token, arginfo_aws_crt_credentials_options_set_session_token)
ZEND_FE(aws_crt_credentials_options_set_expiration_timepoint_seconds, arginfo_aws_crt_credentials_options_set_expiration_timepoint_seconds)
ZEND_FE(aws_crt_credentials_new, arginfo_aws_crt_credentials_new)
ZEND_FE(aws_crt_credentials_release, arginfo_aws_crt_credentials_release)
ZEND_FE(aws_crt_credentials_provider_release, arginfo_aws_crt_credentials_provider_release)
ZEND_FE(aws_crt_credentials_provider_static_options_new, arginfo_aws_crt_credentials_provider_static_options_new)
ZEND_FE(aws_crt_credentials_provider_static_options_release, arginfo_aws_crt_credentials_provider_static_options_release)
ZEND_FE(aws_crt_credentials_provider_static_options_set_access_key_id, arginfo_aws_crt_credentials_provider_static_options_set_access_key_id)
ZEND_FE(aws_crt_credentials_provider_static_options_set_secret_access_key, arginfo_aws_crt_credentials_provider_static_options_set_secret_access_key)
ZEND_FE(aws_crt_credentials_provider_static_options_set_session_token, arginfo_aws_crt_credentials_provider_static_options_set_session_token)
ZEND_FE(aws_crt_credentials_provider_static_new, arginfo_aws_crt_credentials_provider_static_new)
ZEND_FE(aws_crt_signing_config_aws_new, arginfo_aws_crt_signing_config_aws_new)
ZEND_FE(aws_crt_signing_config_aws_release, arginfo_aws_crt_signing_config_aws_release)
ZEND_FE(aws_crt_signing_config_aws_set_algorithm, arginfo_aws_crt_signing_config_aws_set_algorithm)
ZEND_FE(aws_crt_signing_config_aws_set_signature_type, arginfo_aws_crt_signing_config_aws_set_signature_type)
ZEND_FE(aws_crt_signing_config_aws_set_credentials_provider, arginfo_aws_crt_signing_config_aws_set_credentials_provider)
ZEND_FE(aws_crt_signing_config_aws_set_region, arginfo_aws_crt_signing_config_aws_set_region)
ZEND_FE(aws_crt_signing_config_aws_set_service, arginfo_aws_crt_signing_config_aws_set_service)
ZEND_FE(aws_crt_signing_config_aws_set_use_double_uri_encode, arginfo_aws_crt_signing_config_aws_set_use_double_uri_encode)
ZEND_FE(aws_crt_signing_config_aws_set_should_normalize_uri_path, arginfo_aws_crt_signing_config_aws_set_should_normalize_uri_path)
ZEND_FE(aws_crt_signing_config_aws_set_omit_session_token, arginfo_aws_crt_signing_config_aws_set_omit_session_token)
ZEND_FE(aws_crt_signing_config_aws_set_signed_body_value, arginfo_aws_crt_signing_config_aws_set_signed_body_value)
ZEND_FE(aws_crt_signing_config_aws_set_signed_body_header_type, arginfo_aws_crt_signing_config_aws_set_signed_body_header_type)
ZEND_FE(aws_crt_signing_config_aws_set_expiration_in_seconds, arginfo_aws_crt_signing_config_aws_set_expiration_in_seconds)
ZEND_FE(aws_crt_signing_config_aws_set_date, arginfo_aws_crt_signing_config_aws_set_date)
ZEND_FE(aws_crt_signing_config_aws_set_should_sign_header_fn, arginfo_aws_crt_signing_config_aws_set_should_sign_header_fn)
ZEND_FE(aws_crt_signable_new_from_http_request, arginfo_aws_crt_signable_new_from_http_request)
ZEND_FE(aws_crt_signable_new_from_chunk, arginfo_aws_crt_signable_new_from_chunk)
ZEND_FE(aws_crt_signable_new_from_canonical_request, arginfo_aws_crt_signable_new_from_canonical_request)
ZEND_FE(aws_crt_signable_release, arginfo_aws_crt_signable_release)
ZEND_FE(aws_crt_signing_result_release, arginfo_aws_crt_signing_result_release)
ZEND_FE(aws_crt_signing_result_apply_to_http_request, arginfo_aws_crt_signing_result_apply_to_http_request)
ZEND_FE(aws_crt_sign_request_aws, arginfo_aws_crt_sign_request_aws)
ZEND_FE(aws_crt_test_verify_sigv4a_signing, arginfo_aws_crt_test_verify_sigv4a_signing)
ZEND_FE(aws_crt_crc32, arginfo_aws_crt_crc32)
ZEND_FE(aws_crt_crc32c, arginfo_aws_crt_crc32c)
ZEND_FE_END
};

View file

@ -1,32 +1,32 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_crc32) {
zend_ulong prev = 0;
const char *input = NULL;
size_t len = 0;
aws_php_parse_parameters("sl", &input, &len, &prev);
if (prev > UINT32_MAX) {
aws_php_throw_exception("previous crc cannot be larger than UINT32_MAX");
}
RETURN_LONG((zend_ulong)aws_crt_crc32((const uint8_t *)input, len, prev));
}
PHP_FUNCTION(aws_crt_crc32c) {
zend_ulong prev = 0;
const char *input = NULL;
size_t len = 0;
aws_php_parse_parameters("sl", &input, &len, &prev);
if (prev > UINT32_MAX) {
aws_php_throw_exception("previous crc cannot be larger than UINT32_MAX");
}
RETURN_LONG((zend_ulong)aws_crt_crc32c((const uint8_t *)input, len, prev));
}
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_crc32) {
zend_ulong prev = 0;
const char *input = NULL;
size_t len = 0;
aws_php_parse_parameters("sl", &input, &len, &prev);
if (prev > UINT32_MAX) {
aws_php_throw_exception("previous crc cannot be larger than UINT32_MAX");
}
RETURN_LONG((zend_ulong)aws_crt_crc32((const uint8_t *)input, len, prev));
}
PHP_FUNCTION(aws_crt_crc32c) {
zend_ulong prev = 0;
const char *input = NULL;
size_t len = 0;
aws_php_parse_parameters("sl", &input, &len, &prev);
if (prev > UINT32_MAX) {
aws_php_throw_exception("previous crc cannot be larger than UINT32_MAX");
}
RETURN_LONG((zend_ulong)aws_crt_crc32c((const uint8_t *)input, len, prev));
}

View file

@ -1,154 +1,154 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_credentials_options_new) {
aws_crt_credentials_options *options = aws_crt_credentials_options_new();
RETURN_LONG((zend_ulong)options);
}
PHP_FUNCTION(aws_crt_credentials_options_release) {
zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options);
aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_release(options);
}
PHP_FUNCTION(aws_crt_credentials_options_set_access_key_id) {
zend_ulong php_options = 0;
const char *access_key_id = NULL;
size_t access_key_id_len = 0;
aws_php_parse_parameters("ls", &php_options, &access_key_id, &access_key_id_len);
aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_set_access_key_id(options, (uint8_t *)access_key_id, access_key_id_len);
}
PHP_FUNCTION(aws_crt_credentials_options_set_secret_access_key) {
zend_ulong php_options = 0;
const char *secret_access_key = NULL;
size_t secret_access_key_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &php_options, &secret_access_key, &secret_access_key_len) ==
FAILURE) {
RETURN_NULL();
}
aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_set_secret_access_key(options, (uint8_t *)secret_access_key, secret_access_key_len);
}
PHP_FUNCTION(aws_crt_credentials_options_set_session_token) {
zend_ulong php_options = 0;
const char *session_token = NULL;
size_t session_token_len = 0;
aws_php_parse_parameters("ls", &php_options, &session_token, &session_token_len);
aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_set_session_token(options, (uint8_t *)session_token, session_token_len);
}
PHP_FUNCTION(aws_crt_credentials_options_set_expiration_timepoint_seconds) {
zend_ulong php_options = 0;
zend_ulong expiration_timepoint_seconds = 0;
aws_php_parse_parameters("ll", &php_options, &expiration_timepoint_seconds);
aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_set_expiration_timepoint_seconds(options, expiration_timepoint_seconds);
}
PHP_FUNCTION(aws_crt_credentials_new) {
zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options);
aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials *credentials = aws_crt_credentials_new(options);
RETURN_LONG((zend_ulong)credentials);
}
PHP_FUNCTION(aws_crt_credentials_release) {
zend_ulong php_credentials = 0;
aws_php_parse_parameters("l", &php_credentials);
aws_crt_credentials *credentials = (void *)php_credentials;
aws_crt_credentials_release(credentials);
}
PHP_FUNCTION(aws_crt_credentials_provider_release) {
zend_ulong php_creds_provider = 0;
aws_php_parse_parameters("l", &php_creds_provider);
aws_crt_credentials_provider *provider = (void *)php_creds_provider;
aws_crt_credentials_provider_release(provider);
}
PHP_FUNCTION(aws_crt_credentials_provider_static_options_new) {
aws_crt_credentials_provider_static_options *options = aws_crt_credentials_provider_static_options_new();
RETURN_LONG((zend_ulong)options);
}
PHP_FUNCTION(aws_crt_credentials_provider_static_options_release) {
zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options);
aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider_static_options_release(options);
}
PHP_FUNCTION(aws_crt_credentials_provider_static_options_set_access_key_id) {
zend_ulong php_options = 0;
const char *access_key_id = NULL;
size_t access_key_id_len = 0;
aws_php_parse_parameters("ls", &php_options, &access_key_id, &access_key_id_len);
aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider_static_options_set_access_key_id(options, (uint8_t *)access_key_id, access_key_id_len);
}
PHP_FUNCTION(aws_crt_credentials_provider_static_options_set_secret_access_key) {
zend_ulong php_options = 0;
const char *secret_access_key = NULL;
size_t secret_access_key_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &php_options, &secret_access_key, &secret_access_key_len) ==
FAILURE) {
RETURN_NULL();
}
aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider_static_options_set_secret_access_key(
options, (uint8_t *)secret_access_key, secret_access_key_len);
}
PHP_FUNCTION(aws_crt_credentials_provider_static_options_set_session_token) {
zend_ulong php_options = 0;
const char *session_token = NULL;
size_t session_token_len = 0;
aws_php_parse_parameters("ls", &php_options, &session_token, &session_token_len);
aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider_static_options_set_session_token(options, (uint8_t *)session_token, session_token_len);
}
PHP_FUNCTION(aws_crt_credentials_provider_static_new) {
zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options);
aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider *provider = aws_crt_credentials_provider_static_new(options);
RETURN_LONG((zend_ulong)provider);
}
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_credentials_options_new) {
aws_crt_credentials_options *options = aws_crt_credentials_options_new();
RETURN_LONG((zend_ulong)options);
}
PHP_FUNCTION(aws_crt_credentials_options_release) {
zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options);
aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_release(options);
}
PHP_FUNCTION(aws_crt_credentials_options_set_access_key_id) {
zend_ulong php_options = 0;
const char *access_key_id = NULL;
size_t access_key_id_len = 0;
aws_php_parse_parameters("ls", &php_options, &access_key_id, &access_key_id_len);
aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_set_access_key_id(options, (uint8_t *)access_key_id, access_key_id_len);
}
PHP_FUNCTION(aws_crt_credentials_options_set_secret_access_key) {
zend_ulong php_options = 0;
const char *secret_access_key = NULL;
size_t secret_access_key_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &php_options, &secret_access_key, &secret_access_key_len) ==
FAILURE) {
RETURN_NULL();
}
aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_set_secret_access_key(options, (uint8_t *)secret_access_key, secret_access_key_len);
}
PHP_FUNCTION(aws_crt_credentials_options_set_session_token) {
zend_ulong php_options = 0;
const char *session_token = NULL;
size_t session_token_len = 0;
aws_php_parse_parameters("ls", &php_options, &session_token, &session_token_len);
aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_set_session_token(options, (uint8_t *)session_token, session_token_len);
}
PHP_FUNCTION(aws_crt_credentials_options_set_expiration_timepoint_seconds) {
zend_ulong php_options = 0;
zend_ulong expiration_timepoint_seconds = 0;
aws_php_parse_parameters("ll", &php_options, &expiration_timepoint_seconds);
aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials_options_set_expiration_timepoint_seconds(options, expiration_timepoint_seconds);
}
PHP_FUNCTION(aws_crt_credentials_new) {
zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options);
aws_crt_credentials_options *options = (void *)php_options;
aws_crt_credentials *credentials = aws_crt_credentials_new(options);
RETURN_LONG((zend_ulong)credentials);
}
PHP_FUNCTION(aws_crt_credentials_release) {
zend_ulong php_credentials = 0;
aws_php_parse_parameters("l", &php_credentials);
aws_crt_credentials *credentials = (void *)php_credentials;
aws_crt_credentials_release(credentials);
}
PHP_FUNCTION(aws_crt_credentials_provider_release) {
zend_ulong php_creds_provider = 0;
aws_php_parse_parameters("l", &php_creds_provider);
aws_crt_credentials_provider *provider = (void *)php_creds_provider;
aws_crt_credentials_provider_release(provider);
}
PHP_FUNCTION(aws_crt_credentials_provider_static_options_new) {
aws_crt_credentials_provider_static_options *options = aws_crt_credentials_provider_static_options_new();
RETURN_LONG((zend_ulong)options);
}
PHP_FUNCTION(aws_crt_credentials_provider_static_options_release) {
zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options);
aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider_static_options_release(options);
}
PHP_FUNCTION(aws_crt_credentials_provider_static_options_set_access_key_id) {
zend_ulong php_options = 0;
const char *access_key_id = NULL;
size_t access_key_id_len = 0;
aws_php_parse_parameters("ls", &php_options, &access_key_id, &access_key_id_len);
aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider_static_options_set_access_key_id(options, (uint8_t *)access_key_id, access_key_id_len);
}
PHP_FUNCTION(aws_crt_credentials_provider_static_options_set_secret_access_key) {
zend_ulong php_options = 0;
const char *secret_access_key = NULL;
size_t secret_access_key_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &php_options, &secret_access_key, &secret_access_key_len) ==
FAILURE) {
RETURN_NULL();
}
aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider_static_options_set_secret_access_key(
options, (uint8_t *)secret_access_key, secret_access_key_len);
}
PHP_FUNCTION(aws_crt_credentials_provider_static_options_set_session_token) {
zend_ulong php_options = 0;
const char *session_token = NULL;
size_t session_token_len = 0;
aws_php_parse_parameters("ls", &php_options, &session_token, &session_token_len);
aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider_static_options_set_session_token(options, (uint8_t *)session_token, session_token_len);
}
PHP_FUNCTION(aws_crt_credentials_provider_static_new) {
zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options);
aws_crt_credentials_provider_static_options *options = (void *)php_options;
aws_crt_credentials_provider *provider = aws_crt_credentials_provider_static_new(options);
RETURN_LONG((zend_ulong)provider);
}

View file

@ -1,65 +1,65 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_log_to_stdout) {
aws_php_parse_parameters_none();
aws_crt_log_to_stdout();
}
PHP_FUNCTION(aws_crt_log_to_stderr) {
aws_php_parse_parameters_none();
aws_crt_log_to_stderr();
}
PHP_FUNCTION(aws_crt_log_to_file) {
const char *filename = NULL;
size_t filename_len = 0;
/* read the filename as a path, which guarantees no NUL bytes */
aws_php_parse_parameters("p", &filename, &filename_len);
aws_crt_log_to_file(filename);
}
static void php_crt_log(const char *message, size_t len, void *user_data) {
php_stream *stream = user_data;
php_stream_write(stream, message, len);
php_stream_flush(stream);
}
PHP_FUNCTION(aws_crt_log_to_stream) {
zval *php_log_stream = NULL;
aws_php_parse_parameters("r", &php_log_stream);
if (php_log_stream) {
php_stream *stream = NULL;
Z_ADDREF(*php_log_stream);
AWS_PHP_STREAM_FROM_ZVAL(stream, php_log_stream);
aws_crt_log_to_callback((aws_crt_log_callback *)php_crt_log, stream);
} else {
aws_crt_log_to_callback(NULL, NULL);
}
}
PHP_FUNCTION(aws_crt_log_set_level) {
zend_ulong log_level = 0;
aws_php_parse_parameters("l", &log_level);
aws_crt_log_set_level((aws_crt_log_level)log_level);
}
PHP_FUNCTION(aws_crt_log_stop) {
aws_php_parse_parameters_none();
aws_crt_log_stop();
}
PHP_FUNCTION(aws_crt_log_message) {
zend_ulong log_level = 0;
const char *message = NULL;
size_t message_len = 0;
aws_php_parse_parameters("ls", &log_level, &message, &message_len);
aws_crt_log_message((aws_crt_log_level)log_level, (const uint8_t *)message, message_len);
}
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_log_to_stdout) {
aws_php_parse_parameters_none();
aws_crt_log_to_stdout();
}
PHP_FUNCTION(aws_crt_log_to_stderr) {
aws_php_parse_parameters_none();
aws_crt_log_to_stderr();
}
PHP_FUNCTION(aws_crt_log_to_file) {
const char *filename = NULL;
size_t filename_len = 0;
/* read the filename as a path, which guarantees no NUL bytes */
aws_php_parse_parameters("p", &filename, &filename_len);
aws_crt_log_to_file(filename);
}
static void php_crt_log(const char *message, size_t len, void *user_data) {
php_stream *stream = user_data;
php_stream_write(stream, message, len);
php_stream_flush(stream);
}
PHP_FUNCTION(aws_crt_log_to_stream) {
zval *php_log_stream = NULL;
aws_php_parse_parameters("r", &php_log_stream);
if (php_log_stream) {
php_stream *stream = NULL;
Z_ADDREF(*php_log_stream);
AWS_PHP_STREAM_FROM_ZVAL(stream, php_log_stream);
aws_crt_log_to_callback((aws_crt_log_callback *)php_crt_log, stream);
} else {
aws_crt_log_to_callback(NULL, NULL);
}
}
PHP_FUNCTION(aws_crt_log_set_level) {
zend_ulong log_level = 0;
aws_php_parse_parameters("l", &log_level);
aws_crt_log_set_level((aws_crt_log_level)log_level);
}
PHP_FUNCTION(aws_crt_log_stop) {
aws_php_parse_parameters_none();
aws_crt_log_stop();
}
PHP_FUNCTION(aws_crt_log_message) {
zend_ulong log_level = 0;
const char *message = NULL;
size_t message_len = 0;
aws_php_parse_parameters("ls", &log_level, &message, &message_len);
aws_crt_log_message((aws_crt_log_level)log_level, (const uint8_t *)message, message_len);
}

View file

@ -1,171 +1,171 @@
#ifndef PHP_AWS_CRT_H
#define PHP_AWS_CRT_H
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "php.h"
#include "Zend/zend_extensions.h" /* for ZEND_EXTENSION_API_NO */
#include <aws/common/common.h>
#include <aws/common/mutex.h>
#include <aws/common/promise.h>
#include <aws/common/thread.h>
/* ZEND_EXTENSION_API_NO from each branch of the PHP source */
#define AWS_PHP_EXTENSION_API_5_5 220121212
#define AWS_PHP_EXTENSION_API_5_6 220131226
#define AWS_PHP_EXTENSION_API_7_0 320151012
#define AWS_PHP_EXTENSION_API_7_1 320160303
#define AWS_PHP_EXTENSION_API_7_2 320170718
#define AWS_PHP_EXTENSION_API_7_3 320180731
#define AWS_PHP_EXTENSION_API_7_4 320190902
#define AWS_PHP_EXTENSION_API_8_0 420200930
#if ZEND_EXTENSION_API_NO < AWS_PHP_EXTENSION_API_5_5
# error "PHP >= 5.5 is required"
#endif
#define AWS_PHP_AT_LEAST_7 (ZEND_EXTENSION_API_NO >= AWS_PHP_EXTENSION_API_7_0)
#define AWS_PHP_AT_LEAST_7_2 (ZEND_EXTENSION_API_NO >= AWS_PHP_EXTENSION_API_7_2)
ZEND_BEGIN_MODULE_GLOBALS(awscrt)
long log_level;
ZEND_END_MODULE_GLOBALS(awscrt)
ZEND_EXTERN_MODULE_GLOBALS(awscrt)
#define AWSCRT_GLOBAL(v) ZEND_MODULE_GLOBALS_ACCESSOR(awscrt, v)
#if AWS_PHP_AT_LEAST_7
/* PHP 7 takes a zval*, PHP5 takes a zval** */
# define AWS_PHP_STREAM_FROM_ZVAL(s, z) php_stream_from_zval(s, z)
#define XRETURN_STRINGL RETURN_STRINGL
#define XRETURN_STRING RETURN_STRING
#define XRETVAL_STRINGL RETVAL_STRINGL
#define XRETVAL_STRING RETVAL_STRING
#else /* PHP 5.5-5.6 */
# define AWS_PHP_STREAM_FROM_ZVAL(s, z) php_stream_from_zval(s, &z)
#define XRETURN_STRINGL(s, l) RETURN_STRINGL(s, l, 1)
#define XRETURN_STRING(s) RETURN_STRING(s, 1)
#define XRETVAL_STRINGL(s, l) RETVAL_STRINGL(s, l, 1)
#define XRETVAL_STRING(s) RETVAL_STRING(s, 1)
#endif /* PHP 5.x */
#include "api.h"
#include "awscrt_arginfo.h"
/* Utility macros borrowed from common */
#define GLUE(x, y) x y
#define RETURN_ARG_COUNT(_1_, _2_, _3_, _4_, _5_, count, ...) count
#define EXPAND_ARGS(args) RETURN_ARG_COUNT args
#define COUNT_ARGS_MAX5(...) EXPAND_ARGS((__VA_ARGS__, 5, 4, 3, 2, 1, 0))
#define OVERLOAD_MACRO2(name, count) name##count
#define OVERLOAD_MACRO1(name, count) OVERLOAD_MACRO2(name, count)
#define OVERLOAD_MACRO(name, count) OVERLOAD_MACRO1(name, count)
#define CALL_OVERLOAD(name, ...) GLUE(OVERLOAD_MACRO(name, COUNT_ARGS_MAX5(__VA_ARGS__)), (__VA_ARGS__))
#define VARIABLE_LENGTH_ARRAY(type, name, length) type *name = alloca(sizeof(type) * (length))
/*
* PHP utility APIs for this extension
*/
/*
* Exception throwing mechanism, will never return
*/
#define aws_php_throw_exception(...) CALL_OVERLOAD(_AWS_PHP_THROW_EXCEPTION, __VA_ARGS__);
#define _AWS_PHP_THROW_EXCEPTION5(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__)
#define _AWS_PHP_THROW_EXCEPTION4(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__)
#define _AWS_PHP_THROW_EXCEPTION3(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__)
#define _AWS_PHP_THROW_EXCEPTION2(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__)
#define _AWS_PHP_THROW_EXCEPTION1(format) zend_error_noreturn(E_ERROR, format)
/**
* throws an exception resulting from argument parsing, notes the current function name in the exception
*/
#define aws_php_argparse_fail() \
do { \
aws_php_throw_exception("Failed to parse arguments to %s", __func__); \
} while (0)
/**
* calls zend_parse_parameters() with the arguments and throws an exception if parsing fails
*/
#define aws_php_parse_parameters(type_spec, ...) \
do { \
if (zend_parse_parameters(ZEND_NUM_ARGS(), type_spec, __VA_ARGS__) == FAILURE) { \
aws_php_argparse_fail(); \
} \
} while (0)
/**
* calls zend_parse_parameters_none() and throws an exception if parsing fails
*/
#define aws_php_parse_parameters_none() \
do { \
if (zend_parse_parameters_none() == FAILURE) { \
aws_php_argparse_fail(); \
} \
} while (0)
/* PHP/Zend utility functions to work across PHP versions */
zval *aws_php_zval_new(void);
void aws_php_zval_dtor(void *zval_ptr);
bool aws_php_zval_as_bool(zval *z);
void aws_php_zval_copy(zval *dest, zval *src);
/**
* Replacement for ZVAL_STRINGL that is PHP version agnostic
*/
void aws_php_zval_stringl(zval *val, const char *str, size_t len);
/* Thread queue functions for managing PHP's optional threading situation */
typedef struct _aws_php_task {
void (*callback)(void *); /* task function */
void (*dtor)(void *); /* deletes task_data, if non-null */
void *data;
} aws_php_task;
/* maximum number of queued callbacks to execute at once. Since this is to support single-threaded usage,
* this can be a fairly small number, as how many callbacks could we reasonably be stacking up?! */
#define AWS_PHP_THREAD_QUEUE_MAX_DEPTH 32
typedef struct _aws_php_thread_queue {
struct aws_mutex mutex;
aws_php_task queue[AWS_PHP_THREAD_QUEUE_MAX_DEPTH];
size_t write_slot;
aws_thread_id_t thread_id;
} aws_php_thread_queue;
extern aws_php_thread_queue s_aws_php_main_thread_queue;
bool aws_php_is_main_thread(void);
void aws_php_thread_queue_init(aws_php_thread_queue *queue);
void aws_php_thread_queue_clean_up(aws_php_thread_queue *queue);
void aws_php_thread_queue_push(aws_php_thread_queue *queue, aws_php_task task);
bool aws_php_thread_queue_drain(aws_php_thread_queue *queue);
/* called from worker thread to wait for the main thread to execute any queued work in PHP */
void aws_php_thread_queue_yield(aws_php_thread_queue *queue);
/* called from PHP thread to wait on async queued jobs, one of which MUST complete the promise */
void aws_php_thread_queue_wait(aws_php_thread_queue *queue, struct aws_promise *promise);
/**
* generic dispatch mechanism to call a callback provided as a zval with arguments
* that are converted to zvals based on the arg_types format string
* Uses the same format string as zend_parse_parameters
*/
zval aws_php_invoke_callback(zval *callback, const char *arg_types, ...);
#endif /* PHP_AWS_CRT_H */
#ifndef PHP_AWS_CRT_H
#define PHP_AWS_CRT_H
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "php.h"
#include "Zend/zend_extensions.h" /* for ZEND_EXTENSION_API_NO */
#include <aws/common/common.h>
#include <aws/common/mutex.h>
#include <aws/common/promise.h>
#include <aws/common/thread.h>
/* ZEND_EXTENSION_API_NO from each branch of the PHP source */
#define AWS_PHP_EXTENSION_API_5_5 220121212
#define AWS_PHP_EXTENSION_API_5_6 220131226
#define AWS_PHP_EXTENSION_API_7_0 320151012
#define AWS_PHP_EXTENSION_API_7_1 320160303
#define AWS_PHP_EXTENSION_API_7_2 320170718
#define AWS_PHP_EXTENSION_API_7_3 320180731
#define AWS_PHP_EXTENSION_API_7_4 320190902
#define AWS_PHP_EXTENSION_API_8_0 420200930
#if ZEND_EXTENSION_API_NO < AWS_PHP_EXTENSION_API_5_5
# error "PHP >= 5.5 is required"
#endif
#define AWS_PHP_AT_LEAST_7 (ZEND_EXTENSION_API_NO >= AWS_PHP_EXTENSION_API_7_0)
#define AWS_PHP_AT_LEAST_7_2 (ZEND_EXTENSION_API_NO >= AWS_PHP_EXTENSION_API_7_2)
ZEND_BEGIN_MODULE_GLOBALS(awscrt)
long log_level;
ZEND_END_MODULE_GLOBALS(awscrt)
ZEND_EXTERN_MODULE_GLOBALS(awscrt)
#define AWSCRT_GLOBAL(v) ZEND_MODULE_GLOBALS_ACCESSOR(awscrt, v)
#if AWS_PHP_AT_LEAST_7
/* PHP 7 takes a zval*, PHP5 takes a zval** */
# define AWS_PHP_STREAM_FROM_ZVAL(s, z) php_stream_from_zval(s, z)
#define XRETURN_STRINGL RETURN_STRINGL
#define XRETURN_STRING RETURN_STRING
#define XRETVAL_STRINGL RETVAL_STRINGL
#define XRETVAL_STRING RETVAL_STRING
#else /* PHP 5.5-5.6 */
# define AWS_PHP_STREAM_FROM_ZVAL(s, z) php_stream_from_zval(s, &z)
#define XRETURN_STRINGL(s, l) RETURN_STRINGL(s, l, 1)
#define XRETURN_STRING(s) RETURN_STRING(s, 1)
#define XRETVAL_STRINGL(s, l) RETVAL_STRINGL(s, l, 1)
#define XRETVAL_STRING(s) RETVAL_STRING(s, 1)
#endif /* PHP 5.x */
#include "api.h"
#include "awscrt_arginfo.h"
/* Utility macros borrowed from common */
#define GLUE(x, y) x y
#define RETURN_ARG_COUNT(_1_, _2_, _3_, _4_, _5_, count, ...) count
#define EXPAND_ARGS(args) RETURN_ARG_COUNT args
#define COUNT_ARGS_MAX5(...) EXPAND_ARGS((__VA_ARGS__, 5, 4, 3, 2, 1, 0))
#define OVERLOAD_MACRO2(name, count) name##count
#define OVERLOAD_MACRO1(name, count) OVERLOAD_MACRO2(name, count)
#define OVERLOAD_MACRO(name, count) OVERLOAD_MACRO1(name, count)
#define CALL_OVERLOAD(name, ...) GLUE(OVERLOAD_MACRO(name, COUNT_ARGS_MAX5(__VA_ARGS__)), (__VA_ARGS__))
#define VARIABLE_LENGTH_ARRAY(type, name, length) type *name = alloca(sizeof(type) * (length))
/*
* PHP utility APIs for this extension
*/
/*
* Exception throwing mechanism, will never return
*/
#define aws_php_throw_exception(...) CALL_OVERLOAD(_AWS_PHP_THROW_EXCEPTION, __VA_ARGS__);
#define _AWS_PHP_THROW_EXCEPTION5(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__)
#define _AWS_PHP_THROW_EXCEPTION4(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__)
#define _AWS_PHP_THROW_EXCEPTION3(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__)
#define _AWS_PHP_THROW_EXCEPTION2(format, ...) zend_error_noreturn(E_ERROR, format, __VA_ARGS__)
#define _AWS_PHP_THROW_EXCEPTION1(format) zend_error_noreturn(E_ERROR, format)
/**
* throws an exception resulting from argument parsing, notes the current function name in the exception
*/
#define aws_php_argparse_fail() \
do { \
aws_php_throw_exception("Failed to parse arguments to %s", __func__); \
} while (0)
/**
* calls zend_parse_parameters() with the arguments and throws an exception if parsing fails
*/
#define aws_php_parse_parameters(type_spec, ...) \
do { \
if (zend_parse_parameters(ZEND_NUM_ARGS(), type_spec, __VA_ARGS__) == FAILURE) { \
aws_php_argparse_fail(); \
} \
} while (0)
/**
* calls zend_parse_parameters_none() and throws an exception if parsing fails
*/
#define aws_php_parse_parameters_none() \
do { \
if (zend_parse_parameters_none() == FAILURE) { \
aws_php_argparse_fail(); \
} \
} while (0)
/* PHP/Zend utility functions to work across PHP versions */
zval *aws_php_zval_new(void);
void aws_php_zval_dtor(void *zval_ptr);
bool aws_php_zval_as_bool(zval *z);
void aws_php_zval_copy(zval *dest, zval *src);
/**
* Replacement for ZVAL_STRINGL that is PHP version agnostic
*/
void aws_php_zval_stringl(zval *val, const char *str, size_t len);
/* Thread queue functions for managing PHP's optional threading situation */
typedef struct _aws_php_task {
void (*callback)(void *); /* task function */
void (*dtor)(void *); /* deletes task_data, if non-null */
void *data;
} aws_php_task;
/* maximum number of queued callbacks to execute at once. Since this is to support single-threaded usage,
* this can be a fairly small number, as how many callbacks could we reasonably be stacking up?! */
#define AWS_PHP_THREAD_QUEUE_MAX_DEPTH 32
typedef struct _aws_php_thread_queue {
struct aws_mutex mutex;
aws_php_task queue[AWS_PHP_THREAD_QUEUE_MAX_DEPTH];
size_t write_slot;
aws_thread_id_t thread_id;
} aws_php_thread_queue;
extern aws_php_thread_queue s_aws_php_main_thread_queue;
bool aws_php_is_main_thread(void);
void aws_php_thread_queue_init(aws_php_thread_queue *queue);
void aws_php_thread_queue_clean_up(aws_php_thread_queue *queue);
void aws_php_thread_queue_push(aws_php_thread_queue *queue, aws_php_task task);
bool aws_php_thread_queue_drain(aws_php_thread_queue *queue);
/* called from worker thread to wait for the main thread to execute any queued work in PHP */
void aws_php_thread_queue_yield(aws_php_thread_queue *queue);
/* called from PHP thread to wait on async queued jobs, one of which MUST complete the promise */
void aws_php_thread_queue_wait(aws_php_thread_queue *queue, struct aws_promise *promise);
/**
* generic dispatch mechanism to call a callback provided as a zval with arguments
* that are converted to zvals based on the arg_types format string
* Uses the same format string as zend_parse_parameters
*/
zval aws_php_invoke_callback(zval *callback, const char *arg_types, ...);
#endif /* PHP_AWS_CRT_H */

View file

@ -1,33 +1,33 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include "php_aws_crt.h"
zval *aws_php_zval_new(void) {
return emalloc(sizeof(zval));
}
void aws_php_zval_dtor(void *zval_ptr) {
zval *z = zval_ptr;
zval_dtor(z);
efree(z);
}
bool aws_php_zval_as_bool(zval *z) {
#if AWS_PHP_AT_LEAST_7
return (Z_TYPE_P(z) == IS_TRUE);
#else
return (Z_TYPE_P(z) == IS_BOOL && Z_LVAL_P(z) != 0);
#endif
}
void aws_php_zval_copy(zval *dest, zval *src) {
#if AWS_PHP_AT_LEAST_7
ZVAL_COPY(dest, src);
#else
ZVAL_COPY_VALUE(dest, src);
#endif
}
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include "php_aws_crt.h"
zval *aws_php_zval_new(void) {
return emalloc(sizeof(zval));
}
void aws_php_zval_dtor(void *zval_ptr) {
zval *z = zval_ptr;
zval_dtor(z);
efree(z);
}
bool aws_php_zval_as_bool(zval *z) {
#if AWS_PHP_AT_LEAST_7
return (Z_TYPE_P(z) == IS_TRUE);
#else
return (Z_TYPE_P(z) == IS_BOOL && Z_LVAL_P(z) != 0);
#endif
}
void aws_php_zval_copy(zval *dest, zval *src) {
#if AWS_PHP_AT_LEAST_7
ZVAL_COPY(dest, src);
#else
ZVAL_COPY_VALUE(dest, src);
#endif
}

View file

@ -1,374 +1,374 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_signing_config_aws_new) {
if (zend_parse_parameters_none() == FAILURE) {
RETURN_NULL();
}
aws_crt_signing_config_aws *signing_config = aws_crt_signing_config_aws_new();
RETURN_LONG((zend_ulong)signing_config);
}
PHP_FUNCTION(aws_crt_signing_config_aws_release) {
zend_ulong php_signing_config = 0;
aws_php_parse_parameters("l", &php_signing_config);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_release(signing_config);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_algorithm) {
zend_ulong php_signing_config = 0;
zend_ulong php_algorithm = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_algorithm);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_algorithm algorithm = php_algorithm;
aws_crt_signing_config_aws_set_algorithm(signing_config, algorithm);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_signature_type) {
zend_ulong php_signing_config = 0;
zend_ulong php_signature_type = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_signature_type);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signature_type signature_type = php_signature_type;
aws_crt_signing_config_aws_set_signature_type(signing_config, signature_type);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_credentials_provider) {
zend_ulong php_signing_config = 0;
zend_ulong php_credentials_provider = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_credentials_provider);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_credentials_provider *credentials_provider = (void *)php_credentials_provider;
aws_crt_signing_config_aws_set_credentials_provider(signing_config, credentials_provider);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_region) {
zend_ulong php_signing_config = 0;
const char *region = NULL;
size_t region_len = 0;
aws_php_parse_parameters("ls", &php_signing_config, &region, &region_len);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_region(signing_config, (uint8_t *)region, region_len);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_service) {
zend_ulong php_signing_config = 0;
const char *service = NULL;
size_t service_len = 0;
aws_php_parse_parameters("ls", &php_signing_config, &service, &service_len);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_service(signing_config, (uint8_t *)service, service_len);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_use_double_uri_encode) {
zend_ulong php_signing_config = 0;
zend_bool php_use_double_uri_encode = 0;
aws_php_parse_parameters("lb", &php_signing_config, &php_use_double_uri_encode);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_use_double_uri_encode(signing_config, php_use_double_uri_encode);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_should_normalize_uri_path) {
zend_ulong php_signing_config = 0;
zend_bool php_should_normalize_uri_path = 0;
aws_php_parse_parameters("lb", &php_signing_config, &php_should_normalize_uri_path);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_should_normalize_uri_path(signing_config, php_should_normalize_uri_path);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_omit_session_token) {
zend_ulong php_signing_config = 0;
zend_bool php_omit_session_token = 0;
aws_php_parse_parameters("lb", &php_signing_config, &php_omit_session_token);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_omit_session_token(signing_config, php_omit_session_token);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_signed_body_value) {
zend_ulong php_signing_config = 0;
const char *signed_body_value = NULL;
size_t signed_body_value_len = 0;
aws_php_parse_parameters("ls", &php_signing_config, &signed_body_value, &signed_body_value_len);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_signed_body_value(
signing_config, (uint8_t *)signed_body_value, signed_body_value_len);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_signed_body_header_type) {
zend_ulong php_signing_config = 0;
zend_ulong php_signed_body_header_type = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_signed_body_header_type);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signed_body_header_type signed_body_header_type = php_signed_body_header_type;
aws_crt_signing_config_aws_set_signed_body_header_type(signing_config, signed_body_header_type);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_expiration_in_seconds) {
zend_ulong php_signing_config = 0;
zend_ulong php_expiration_in_seconds = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_expiration_in_seconds);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_expiration_in_seconds(signing_config, php_expiration_in_seconds);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_date) {
zend_ulong php_signing_config = 0;
zend_ulong php_timestamp = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_timestamp);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_date(signing_config, php_timestamp);
}
typedef struct _should_sign_header_data {
zval *should_sign_header;
zval *header_name;
bool result;
} should_sign_header_data;
static void should_sign_header_task(void *data) {
should_sign_header_data *task = data;
zval result = aws_php_invoke_callback(task->should_sign_header, "z", task->header_name);
task->result = aws_php_zval_as_bool(&result);
zval_dtor(&result);
}
static bool aws_php_should_sign_header(const char *header_name, size_t header_length, void *user_data) {
zval php_header_name;
aws_php_zval_stringl(&php_header_name, header_name, header_length);
should_sign_header_data task_data = {
.should_sign_header = user_data,
.header_name = &php_header_name,
.result = false,
};
aws_php_task task = {
.callback = should_sign_header_task,
.data = &task_data,
};
aws_php_thread_queue_push(&s_aws_php_main_thread_queue, task);
aws_php_thread_queue_yield(&s_aws_php_main_thread_queue);
zval_dtor(&php_header_name);
return task_data.result;
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_should_sign_header_fn) {
zend_ulong php_signing_config = 0;
zval *php_should_sign_header = NULL;
aws_php_parse_parameters("lz", &php_signing_config, &php_should_sign_header);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
/* copy/retain PHP callback, add as user data for signing_config resource */
zval *should_sign_header = aws_php_zval_new();
aws_php_zval_copy(should_sign_header, php_should_sign_header);
aws_crt_resource_set_user_data(signing_config, should_sign_header, aws_php_zval_dtor);
aws_crt_signing_config_aws_set_should_sign_header_fn(
signing_config, aws_php_should_sign_header, should_sign_header);
}
PHP_FUNCTION(aws_crt_signable_new_from_http_request) {
zend_ulong php_http_message = 0;
aws_php_parse_parameters("l", &php_http_message);
const aws_crt_http_message *http_message = (void *)php_http_message;
aws_crt_signable *signable = aws_crt_signable_new_from_http_request(http_message);
RETURN_LONG((zend_ulong)signable);
}
PHP_FUNCTION(aws_crt_signable_new_from_chunk) {
zend_ulong php_input_stream = 0;
const char *previous_signature = NULL;
size_t previous_signature_len = 0;
aws_php_parse_parameters("ls", &php_input_stream, &previous_signature, &previous_signature_len);
aws_crt_input_stream *input_stream = (void *)php_input_stream;
aws_crt_signable *signable =
aws_crt_signable_new_from_chunk(input_stream, (uint8_t *)previous_signature, previous_signature_len);
RETURN_LONG((zend_ulong)signable);
}
PHP_FUNCTION(aws_crt_signable_new_from_canonical_request) {
const char *canonical_request = NULL;
size_t canonical_request_len = 0;
aws_crt_signable *signable =
aws_crt_signable_new_from_canonical_request((uint8_t *)canonical_request, canonical_request_len);
RETURN_LONG((zend_ulong)signable);
}
PHP_FUNCTION(aws_crt_signable_release) {
zend_ulong php_signable = 0;
aws_php_parse_parameters("l", &php_signable);
aws_crt_signable *signable = (void *)php_signable;
aws_crt_signable_release(signable);
}
PHP_FUNCTION(aws_crt_signing_result_release) {
zend_ulong php_signing_result = 0;
aws_php_parse_parameters("l", &php_signing_result);
aws_crt_signing_result *result = (void *)php_signing_result;
aws_crt_signing_result_release(result);
}
PHP_FUNCTION(aws_crt_signing_result_apply_to_http_request) {
zend_ulong php_signing_result = 0;
zend_ulong php_http_request = 0;
aws_php_parse_parameters("ll", &php_signing_result, &php_http_request);
aws_crt_signing_result *result = (void *)php_signing_result;
aws_crt_http_message *request = (void *)php_http_request;
if (aws_crt_signing_result_apply_to_http_request(result, request)) {
aws_php_throw_exception(
"Failed to apply signing result to HTTP request: %s", aws_crt_error_name(aws_crt_last_error()));
}
}
typedef struct _signing_state {
struct aws_promise *promise;
zval *on_complete;
aws_crt_signing_result *signing_result;
int error_code;
} signing_state;
/* called on main thread to deliver result to php */
static void s_sign_aws_complete(void *data) {
signing_state *state = data;
zval *on_complete = state->on_complete;
aws_php_invoke_callback(on_complete, "ll", (zend_ulong)state->signing_result, (zend_ulong)state->error_code);
}
/* called from signing process in aws_sign_request_aws */
static void s_on_sign_request_aws_complete(aws_crt_signing_result *result, int error_code, void *user_data) {
signing_state *state = user_data;
struct aws_promise *promise = state->promise;
state->signing_result = result;
state->error_code = error_code;
/*
* Must execute PHP callback before this function returns, or signing_result will be killed
* so the callback is queued back to the main thread and will have run when yield returns
*/
aws_php_task complete_callback_task = {
.callback = s_sign_aws_complete,
.data = state,
};
aws_php_thread_queue_push(&s_aws_php_main_thread_queue, complete_callback_task);
aws_php_thread_queue_yield(&s_aws_php_main_thread_queue);
if (error_code) {
aws_promise_fail(promise, error_code);
} else {
aws_promise_complete(promise, result, NULL);
}
}
PHP_FUNCTION(aws_crt_sign_request_aws) {
zend_ulong php_signable = 0;
zend_ulong php_signing_config = 0;
zval *php_on_complete = 0;
zend_ulong php_user_data = 0;
aws_php_parse_parameters("llzl", &php_signable, &php_signing_config, &php_on_complete, &php_user_data);
aws_crt_signable *signable = (void *)php_signable;
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
struct aws_promise *promise = aws_promise_new(aws_crt_default_allocator());
signing_state state = {
.promise = promise,
.on_complete = php_on_complete,
};
int ret = aws_crt_sign_request_aws(signable, signing_config, s_on_sign_request_aws_complete, &state);
if (ret != 0) {
int last_error = aws_crt_last_error();
aws_promise_fail(promise, last_error);
aws_php_throw_exception(
"aws_crt_sign_request_aws: error starting signing process: %s", aws_crt_error_name(last_error));
}
aws_php_thread_queue_wait(&s_aws_php_main_thread_queue, promise);
done:
aws_promise_release(promise);
RETURN_LONG(ret);
}
PHP_FUNCTION(aws_crt_test_verify_sigv4a_signing) {
zend_ulong php_signable = 0;
zend_ulong php_signing_config = 0;
const char *expected_canonical_request = NULL;
size_t expected_canonical_request_len = 0;
const char *signature = NULL;
size_t signature_len = 0;
const char *ecc_key_pub_x = NULL;
size_t ecc_key_pub_x_len = 0;
const char *ecc_key_pub_y = NULL;
size_t ecc_key_pub_y_len = 0;
aws_php_parse_parameters(
"llssss",
&php_signable,
&php_signing_config,
&expected_canonical_request,
&expected_canonical_request_len,
&signature,
&signature_len,
&ecc_key_pub_x,
&ecc_key_pub_x_len,
&ecc_key_pub_y,
&ecc_key_pub_y_len);
const aws_crt_signable *signable = (void *)php_signable;
const aws_crt_signing_config *signing_config = (void *)php_signing_config;
bool result = AWS_OP_SUCCESS ==
aws_crt_test_verify_sigv4a_signing(
signable, signing_config, expected_canonical_request, signature, ecc_key_pub_x, ecc_key_pub_y);
RETURN_BOOL(result);
}
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include "php_aws_crt.h"
PHP_FUNCTION(aws_crt_signing_config_aws_new) {
if (zend_parse_parameters_none() == FAILURE) {
RETURN_NULL();
}
aws_crt_signing_config_aws *signing_config = aws_crt_signing_config_aws_new();
RETURN_LONG((zend_ulong)signing_config);
}
PHP_FUNCTION(aws_crt_signing_config_aws_release) {
zend_ulong php_signing_config = 0;
aws_php_parse_parameters("l", &php_signing_config);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_release(signing_config);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_algorithm) {
zend_ulong php_signing_config = 0;
zend_ulong php_algorithm = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_algorithm);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_algorithm algorithm = php_algorithm;
aws_crt_signing_config_aws_set_algorithm(signing_config, algorithm);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_signature_type) {
zend_ulong php_signing_config = 0;
zend_ulong php_signature_type = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_signature_type);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signature_type signature_type = php_signature_type;
aws_crt_signing_config_aws_set_signature_type(signing_config, signature_type);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_credentials_provider) {
zend_ulong php_signing_config = 0;
zend_ulong php_credentials_provider = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_credentials_provider);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_credentials_provider *credentials_provider = (void *)php_credentials_provider;
aws_crt_signing_config_aws_set_credentials_provider(signing_config, credentials_provider);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_region) {
zend_ulong php_signing_config = 0;
const char *region = NULL;
size_t region_len = 0;
aws_php_parse_parameters("ls", &php_signing_config, &region, &region_len);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_region(signing_config, (uint8_t *)region, region_len);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_service) {
zend_ulong php_signing_config = 0;
const char *service = NULL;
size_t service_len = 0;
aws_php_parse_parameters("ls", &php_signing_config, &service, &service_len);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_service(signing_config, (uint8_t *)service, service_len);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_use_double_uri_encode) {
zend_ulong php_signing_config = 0;
zend_bool php_use_double_uri_encode = 0;
aws_php_parse_parameters("lb", &php_signing_config, &php_use_double_uri_encode);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_use_double_uri_encode(signing_config, php_use_double_uri_encode);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_should_normalize_uri_path) {
zend_ulong php_signing_config = 0;
zend_bool php_should_normalize_uri_path = 0;
aws_php_parse_parameters("lb", &php_signing_config, &php_should_normalize_uri_path);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_should_normalize_uri_path(signing_config, php_should_normalize_uri_path);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_omit_session_token) {
zend_ulong php_signing_config = 0;
zend_bool php_omit_session_token = 0;
aws_php_parse_parameters("lb", &php_signing_config, &php_omit_session_token);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_omit_session_token(signing_config, php_omit_session_token);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_signed_body_value) {
zend_ulong php_signing_config = 0;
const char *signed_body_value = NULL;
size_t signed_body_value_len = 0;
aws_php_parse_parameters("ls", &php_signing_config, &signed_body_value, &signed_body_value_len);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_signed_body_value(
signing_config, (uint8_t *)signed_body_value, signed_body_value_len);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_signed_body_header_type) {
zend_ulong php_signing_config = 0;
zend_ulong php_signed_body_header_type = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_signed_body_header_type);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signed_body_header_type signed_body_header_type = php_signed_body_header_type;
aws_crt_signing_config_aws_set_signed_body_header_type(signing_config, signed_body_header_type);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_expiration_in_seconds) {
zend_ulong php_signing_config = 0;
zend_ulong php_expiration_in_seconds = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_expiration_in_seconds);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_expiration_in_seconds(signing_config, php_expiration_in_seconds);
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_date) {
zend_ulong php_signing_config = 0;
zend_ulong php_timestamp = 0;
aws_php_parse_parameters("ll", &php_signing_config, &php_timestamp);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
aws_crt_signing_config_aws_set_date(signing_config, php_timestamp);
}
typedef struct _should_sign_header_data {
zval *should_sign_header;
zval *header_name;
bool result;
} should_sign_header_data;
static void should_sign_header_task(void *data) {
should_sign_header_data *task = data;
zval result = aws_php_invoke_callback(task->should_sign_header, "z", task->header_name);
task->result = aws_php_zval_as_bool(&result);
zval_dtor(&result);
}
static bool aws_php_should_sign_header(const char *header_name, size_t header_length, void *user_data) {
zval php_header_name;
aws_php_zval_stringl(&php_header_name, header_name, header_length);
should_sign_header_data task_data = {
.should_sign_header = user_data,
.header_name = &php_header_name,
.result = false,
};
aws_php_task task = {
.callback = should_sign_header_task,
.data = &task_data,
};
aws_php_thread_queue_push(&s_aws_php_main_thread_queue, task);
aws_php_thread_queue_yield(&s_aws_php_main_thread_queue);
zval_dtor(&php_header_name);
return task_data.result;
}
PHP_FUNCTION(aws_crt_signing_config_aws_set_should_sign_header_fn) {
zend_ulong php_signing_config = 0;
zval *php_should_sign_header = NULL;
aws_php_parse_parameters("lz", &php_signing_config, &php_should_sign_header);
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
/* copy/retain PHP callback, add as user data for signing_config resource */
zval *should_sign_header = aws_php_zval_new();
aws_php_zval_copy(should_sign_header, php_should_sign_header);
aws_crt_resource_set_user_data(signing_config, should_sign_header, aws_php_zval_dtor);
aws_crt_signing_config_aws_set_should_sign_header_fn(
signing_config, aws_php_should_sign_header, should_sign_header);
}
PHP_FUNCTION(aws_crt_signable_new_from_http_request) {
zend_ulong php_http_message = 0;
aws_php_parse_parameters("l", &php_http_message);
const aws_crt_http_message *http_message = (void *)php_http_message;
aws_crt_signable *signable = aws_crt_signable_new_from_http_request(http_message);
RETURN_LONG((zend_ulong)signable);
}
PHP_FUNCTION(aws_crt_signable_new_from_chunk) {
zend_ulong php_input_stream = 0;
const char *previous_signature = NULL;
size_t previous_signature_len = 0;
aws_php_parse_parameters("ls", &php_input_stream, &previous_signature, &previous_signature_len);
aws_crt_input_stream *input_stream = (void *)php_input_stream;
aws_crt_signable *signable =
aws_crt_signable_new_from_chunk(input_stream, (uint8_t *)previous_signature, previous_signature_len);
RETURN_LONG((zend_ulong)signable);
}
PHP_FUNCTION(aws_crt_signable_new_from_canonical_request) {
const char *canonical_request = NULL;
size_t canonical_request_len = 0;
aws_crt_signable *signable =
aws_crt_signable_new_from_canonical_request((uint8_t *)canonical_request, canonical_request_len);
RETURN_LONG((zend_ulong)signable);
}
PHP_FUNCTION(aws_crt_signable_release) {
zend_ulong php_signable = 0;
aws_php_parse_parameters("l", &php_signable);
aws_crt_signable *signable = (void *)php_signable;
aws_crt_signable_release(signable);
}
PHP_FUNCTION(aws_crt_signing_result_release) {
zend_ulong php_signing_result = 0;
aws_php_parse_parameters("l", &php_signing_result);
aws_crt_signing_result *result = (void *)php_signing_result;
aws_crt_signing_result_release(result);
}
PHP_FUNCTION(aws_crt_signing_result_apply_to_http_request) {
zend_ulong php_signing_result = 0;
zend_ulong php_http_request = 0;
aws_php_parse_parameters("ll", &php_signing_result, &php_http_request);
aws_crt_signing_result *result = (void *)php_signing_result;
aws_crt_http_message *request = (void *)php_http_request;
if (aws_crt_signing_result_apply_to_http_request(result, request)) {
aws_php_throw_exception(
"Failed to apply signing result to HTTP request: %s", aws_crt_error_name(aws_crt_last_error()));
}
}
typedef struct _signing_state {
struct aws_promise *promise;
zval *on_complete;
aws_crt_signing_result *signing_result;
int error_code;
} signing_state;
/* called on main thread to deliver result to php */
static void s_sign_aws_complete(void *data) {
signing_state *state = data;
zval *on_complete = state->on_complete;
aws_php_invoke_callback(on_complete, "ll", (zend_ulong)state->signing_result, (zend_ulong)state->error_code);
}
/* called from signing process in aws_sign_request_aws */
static void s_on_sign_request_aws_complete(aws_crt_signing_result *result, int error_code, void *user_data) {
signing_state *state = user_data;
struct aws_promise *promise = state->promise;
state->signing_result = result;
state->error_code = error_code;
/*
* Must execute PHP callback before this function returns, or signing_result will be killed
* so the callback is queued back to the main thread and will have run when yield returns
*/
aws_php_task complete_callback_task = {
.callback = s_sign_aws_complete,
.data = state,
};
aws_php_thread_queue_push(&s_aws_php_main_thread_queue, complete_callback_task);
aws_php_thread_queue_yield(&s_aws_php_main_thread_queue);
if (error_code) {
aws_promise_fail(promise, error_code);
} else {
aws_promise_complete(promise, result, NULL);
}
}
PHP_FUNCTION(aws_crt_sign_request_aws) {
zend_ulong php_signable = 0;
zend_ulong php_signing_config = 0;
zval *php_on_complete = 0;
zend_ulong php_user_data = 0;
aws_php_parse_parameters("llzl", &php_signable, &php_signing_config, &php_on_complete, &php_user_data);
aws_crt_signable *signable = (void *)php_signable;
aws_crt_signing_config_aws *signing_config = (void *)php_signing_config;
struct aws_promise *promise = aws_promise_new(aws_crt_default_allocator());
signing_state state = {
.promise = promise,
.on_complete = php_on_complete,
};
int ret = aws_crt_sign_request_aws(signable, signing_config, s_on_sign_request_aws_complete, &state);
if (ret != 0) {
int last_error = aws_crt_last_error();
aws_promise_fail(promise, last_error);
aws_php_throw_exception(
"aws_crt_sign_request_aws: error starting signing process: %s", aws_crt_error_name(last_error));
}
aws_php_thread_queue_wait(&s_aws_php_main_thread_queue, promise);
done:
aws_promise_release(promise);
RETURN_LONG(ret);
}
PHP_FUNCTION(aws_crt_test_verify_sigv4a_signing) {
zend_ulong php_signable = 0;
zend_ulong php_signing_config = 0;
const char *expected_canonical_request = NULL;
size_t expected_canonical_request_len = 0;
const char *signature = NULL;
size_t signature_len = 0;
const char *ecc_key_pub_x = NULL;
size_t ecc_key_pub_x_len = 0;
const char *ecc_key_pub_y = NULL;
size_t ecc_key_pub_y_len = 0;
aws_php_parse_parameters(
"llssss",
&php_signable,
&php_signing_config,
&expected_canonical_request,
&expected_canonical_request_len,
&signature,
&signature_len,
&ecc_key_pub_x,
&ecc_key_pub_x_len,
&ecc_key_pub_y,
&ecc_key_pub_y_len);
const aws_crt_signable *signable = (void *)php_signable;
const aws_crt_signing_config *signing_config = (void *)php_signing_config;
bool result = AWS_OP_SUCCESS ==
aws_crt_test_verify_sigv4a_signing(
signable, signing_config, expected_canonical_request, signature, ecc_key_pub_x, ecc_key_pub_y);
RETURN_BOOL(result);
}

View file

@ -1,148 +1,148 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include "php_aws_crt.h"
/* PHP streams info:
* https://git.php.net/?p=php-src.git;a=blob;f=docs/streams.md;h=0ec3846d68bf70067297d8a6c691d2591c49b48a;hb=HEAD
* https://github.com/php/php-src/blob/PHP-5.6.0/main/php_streams.h
*/
PHP_FUNCTION(aws_crt_input_stream_options_new) {
if (zend_parse_parameters_none() == FAILURE) {
aws_php_argparse_fail();
}
aws_crt_input_stream_options *options = aws_crt_input_stream_options_new();
RETURN_LONG((zend_ulong)options);
}
PHP_FUNCTION(aws_crt_input_stream_options_release) {
zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options);
aws_crt_input_stream_options *options = (void *)php_options;
aws_crt_input_stream_options_release(options);
}
PHP_FUNCTION(aws_crt_input_stream_options_set_user_data) {
zend_ulong php_options = 0;
zval *user_data = NULL;
aws_php_parse_parameters("lz", &php_options, &user_data);
aws_crt_input_stream_options *options = (void *)php_options;
php_stream *stream = NULL;
AWS_PHP_STREAM_FROM_ZVAL(stream, user_data);
aws_crt_input_stream_options_set_user_data(options, stream);
}
static int s_php_stream_seek(void *user_data, int64_t offset, aws_crt_input_stream_seek_basis basis) {
php_stream *stream = user_data;
return php_stream_seek(stream, offset, basis);
}
static int s_php_stream_read(void *user_data, uint8_t *dest, size_t dest_length) {
php_stream *stream = user_data;
return php_stream_read(stream, (char *)dest, dest_length) != 0;
}
static int s_php_stream_get_length(void *user_data, int64_t *out_length) {
php_stream *stream = user_data;
size_t pos = php_stream_tell(stream);
php_stream_seek(stream, 0, SEEK_END);
*out_length = php_stream_tell(stream);
php_stream_seek(stream, pos, SEEK_SET);
return 0;
}
static int s_php_stream_get_status(void *user_data, aws_crt_input_stream_status *out_status) {
php_stream *stream = user_data;
out_status->is_valid = stream != NULL;
/* We would like to use php_stream_eof here, but certain streams (notably php://memory)
* are not actually capable of EOF, so we get to do it the hard way */
int64_t length = 0;
int64_t pos = 0;
s_php_stream_get_length(stream, &length);
pos = php_stream_tell(stream);
out_status->is_end_of_stream = pos == length;
return 0;
}
static void s_php_stream_destroy(void *user_data) {
(void)user_data;
/* no op, stream will be freed by PHP refcount dropping from InputStream::stream */
}
PHP_FUNCTION(aws_crt_input_stream_new) {
zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options);
aws_crt_input_stream_options *options = (void *)php_options;
aws_crt_input_stream_options_set_seek(options, s_php_stream_seek);
aws_crt_input_stream_options_set_read(options, s_php_stream_read);
aws_crt_input_stream_options_set_get_status(options, s_php_stream_get_status);
aws_crt_input_stream_options_set_get_length(options, s_php_stream_get_length);
aws_crt_input_stream_options_set_destroy(options, s_php_stream_destroy);
aws_crt_input_stream *stream = aws_crt_input_stream_new(options);
RETURN_LONG((zend_ulong)stream);
}
PHP_FUNCTION(aws_crt_input_stream_release) {
zend_ulong php_stream = 0;
aws_php_parse_parameters("l", &php_stream);
aws_crt_input_stream *stream = (void *)php_stream;
aws_crt_input_stream_release(stream);
}
PHP_FUNCTION(aws_crt_input_stream_seek) {
zend_ulong php_stream = 0;
zend_ulong offset = 0;
zend_ulong basis = 0;
aws_php_parse_parameters("lll", &php_stream, &offset, &basis);
aws_crt_input_stream *stream = (void *)php_stream;
RETURN_LONG(aws_crt_input_stream_seek(stream, offset, basis));
}
PHP_FUNCTION(aws_crt_input_stream_read) {
zend_ulong php_stream = 0;
zend_ulong length = 0;
aws_php_parse_parameters("ll", &php_stream, &length);
aws_crt_input_stream *stream = (void *)php_stream;
uint8_t *buf = emalloc(length);
int ret = aws_crt_input_stream_read(stream, buf, length);
XRETVAL_STRINGL((const char *)buf, length);
efree(buf);
}
PHP_FUNCTION(aws_crt_input_stream_eof) {
zend_ulong php_stream = 0;
aws_php_parse_parameters("l", &php_stream);
aws_crt_input_stream *stream = (void *)php_stream;
aws_crt_input_stream_status status = {0};
aws_crt_input_stream_get_status(stream, &status);
RETURN_BOOL(status.is_end_of_stream);
}
PHP_FUNCTION(aws_crt_input_stream_get_length) {
zend_ulong php_stream = 0;
aws_php_parse_parameters("l", &php_stream);
aws_crt_input_stream *stream = (void *)php_stream;
int64_t length = 0;
aws_crt_input_stream_get_length(stream, &length);
RETURN_LONG(length);
}
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include "php_aws_crt.h"
/* PHP streams info:
* https://git.php.net/?p=php-src.git;a=blob;f=docs/streams.md;h=0ec3846d68bf70067297d8a6c691d2591c49b48a;hb=HEAD
* https://github.com/php/php-src/blob/PHP-5.6.0/main/php_streams.h
*/
PHP_FUNCTION(aws_crt_input_stream_options_new) {
if (zend_parse_parameters_none() == FAILURE) {
aws_php_argparse_fail();
}
aws_crt_input_stream_options *options = aws_crt_input_stream_options_new();
RETURN_LONG((zend_ulong)options);
}
PHP_FUNCTION(aws_crt_input_stream_options_release) {
zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options);
aws_crt_input_stream_options *options = (void *)php_options;
aws_crt_input_stream_options_release(options);
}
PHP_FUNCTION(aws_crt_input_stream_options_set_user_data) {
zend_ulong php_options = 0;
zval *user_data = NULL;
aws_php_parse_parameters("lz", &php_options, &user_data);
aws_crt_input_stream_options *options = (void *)php_options;
php_stream *stream = NULL;
AWS_PHP_STREAM_FROM_ZVAL(stream, user_data);
aws_crt_input_stream_options_set_user_data(options, stream);
}
static int s_php_stream_seek(void *user_data, int64_t offset, aws_crt_input_stream_seek_basis basis) {
php_stream *stream = user_data;
return php_stream_seek(stream, offset, basis);
}
static int s_php_stream_read(void *user_data, uint8_t *dest, size_t dest_length) {
php_stream *stream = user_data;
return php_stream_read(stream, (char *)dest, dest_length) != 0;
}
static int s_php_stream_get_length(void *user_data, int64_t *out_length) {
php_stream *stream = user_data;
size_t pos = php_stream_tell(stream);
php_stream_seek(stream, 0, SEEK_END);
*out_length = php_stream_tell(stream);
php_stream_seek(stream, pos, SEEK_SET);
return 0;
}
static int s_php_stream_get_status(void *user_data, aws_crt_input_stream_status *out_status) {
php_stream *stream = user_data;
out_status->is_valid = stream != NULL;
/* We would like to use php_stream_eof here, but certain streams (notably php://memory)
* are not actually capable of EOF, so we get to do it the hard way */
int64_t length = 0;
int64_t pos = 0;
s_php_stream_get_length(stream, &length);
pos = php_stream_tell(stream);
out_status->is_end_of_stream = pos == length;
return 0;
}
static void s_php_stream_destroy(void *user_data) {
(void)user_data;
/* no op, stream will be freed by PHP refcount dropping from InputStream::stream */
}
PHP_FUNCTION(aws_crt_input_stream_new) {
zend_ulong php_options = 0;
aws_php_parse_parameters("l", &php_options);
aws_crt_input_stream_options *options = (void *)php_options;
aws_crt_input_stream_options_set_seek(options, s_php_stream_seek);
aws_crt_input_stream_options_set_read(options, s_php_stream_read);
aws_crt_input_stream_options_set_get_status(options, s_php_stream_get_status);
aws_crt_input_stream_options_set_get_length(options, s_php_stream_get_length);
aws_crt_input_stream_options_set_destroy(options, s_php_stream_destroy);
aws_crt_input_stream *stream = aws_crt_input_stream_new(options);
RETURN_LONG((zend_ulong)stream);
}
PHP_FUNCTION(aws_crt_input_stream_release) {
zend_ulong php_stream = 0;
aws_php_parse_parameters("l", &php_stream);
aws_crt_input_stream *stream = (void *)php_stream;
aws_crt_input_stream_release(stream);
}
PHP_FUNCTION(aws_crt_input_stream_seek) {
zend_ulong php_stream = 0;
zend_ulong offset = 0;
zend_ulong basis = 0;
aws_php_parse_parameters("lll", &php_stream, &offset, &basis);
aws_crt_input_stream *stream = (void *)php_stream;
RETURN_LONG(aws_crt_input_stream_seek(stream, offset, basis));
}
PHP_FUNCTION(aws_crt_input_stream_read) {
zend_ulong php_stream = 0;
zend_ulong length = 0;
aws_php_parse_parameters("ll", &php_stream, &length);
aws_crt_input_stream *stream = (void *)php_stream;
uint8_t *buf = emalloc(length);
int ret = aws_crt_input_stream_read(stream, buf, length);
XRETVAL_STRINGL((const char *)buf, length);
efree(buf);
}
PHP_FUNCTION(aws_crt_input_stream_eof) {
zend_ulong php_stream = 0;
aws_php_parse_parameters("l", &php_stream);
aws_crt_input_stream *stream = (void *)php_stream;
aws_crt_input_stream_status status = {0};
aws_crt_input_stream_get_status(stream, &status);
RETURN_BOOL(status.is_end_of_stream);
}
PHP_FUNCTION(aws_crt_input_stream_get_length) {
zend_ulong php_stream = 0;
aws_php_parse_parameters("l", &php_stream);
aws_crt_input_stream *stream = (void *)php_stream;
int64_t length = 0;
aws_crt_input_stream_get_length(stream, &length);
RETURN_LONG(length);
}