mirror of
https://github.com/awslabs/aws-crt-php.git
synced 2026-08-17 17:47:12 +00:00
Added logging support from aws-crt-ffi (#42)
* Added logging support from aws-crt-ffi * Updated to aws-crt-ffi v0.2.1
This commit is contained in:
+1
-1
Submodule crt/aws-crt-ffi updated: a7c2c91a10...927850d2e7
@@ -13,4 +13,5 @@
|
||||
#include "stream.c"
|
||||
// #include "hash.c"
|
||||
#include "crc.c"
|
||||
#include "logging.c"
|
||||
#include "php_util.c"
|
||||
|
||||
+15
-1
@@ -13,6 +13,20 @@ 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 {}
|
||||
@@ -123,4 +137,4 @@ function aws_crt_sign_request_aws(int $signable, int $signing_config, object $on
|
||||
|
||||
function aws_crt_crc32(string $input, int $prev): int {}
|
||||
|
||||
function aws_crt_crc32c(string $input, int $prev): int {}
|
||||
function aws_crt_crc32c(string $input, int $prev): int {}
|
||||
|
||||
+177
-173
@@ -1,83 +1,106 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 9b39b5b4523538d8b64b2558e11dfafb209c8ea8 */
|
||||
* Stub hash: 3d39c69ca902372d6bf164faadb43df1f201bd80 */
|
||||
|
||||
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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_ARG_INFO(0, message)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_aws_crt_credentials_options_new arginfo_aws_crt_input_stream_options_new
|
||||
@@ -85,165 +108,170 @@ ZEND_END_ARG_INFO()
|
||||
#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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_crc32, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, input)
|
||||
ZEND_ARG_INFO(0, prev)
|
||||
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);
|
||||
@@ -301,98 +329,74 @@ ZEND_FUNCTION(aws_crt_sign_request_aws);
|
||||
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_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_crc32,
|
||||
arginfo_aws_crt_crc32)
|
||||
ZEND_FE(
|
||||
aws_crt_crc32c,
|
||||
arginfo_aws_crt_crc32c)
|
||||
ZEND_FE_END};
|
||||
|
||||
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_crc32, arginfo_aws_crt_crc32)
|
||||
ZEND_FE(aws_crt_crc32c, arginfo_aws_crt_crc32c)
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
@@ -0,0 +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);
|
||||
}
|
||||
@@ -113,6 +113,34 @@ final class CRT {
|
||||
return self::$impl->aws_crt_error_name((int) $error);
|
||||
}
|
||||
|
||||
public static function log_to_stdout() {
|
||||
return self::$impl->aws_crt_log_to_stdout();
|
||||
}
|
||||
|
||||
public static function log_to_stderr() {
|
||||
return self::$impl->aws_crt_log_to_stderr();
|
||||
}
|
||||
|
||||
public static function log_to_file($filename) {
|
||||
return self::$impl->aws_crt_log_to_file($filename);
|
||||
}
|
||||
|
||||
public static function log_to_stream($stream) {
|
||||
return self::$impl->aws_crt_log_to_stream($stream);
|
||||
}
|
||||
|
||||
public static function log_set_level($level) {
|
||||
return self::$impl->aws_crt_log_set_level($level);
|
||||
}
|
||||
|
||||
public static function log_stop() {
|
||||
return self::$impl->aws_crt_log_stop();
|
||||
}
|
||||
|
||||
public static function log_message($level, $message) {
|
||||
return self::$impl->aws_crt_log_message($level, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object Pointer to native event_loop_group_options
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0.
|
||||
*/
|
||||
namespace AWS\CRT;
|
||||
use AWS\CRT\CRT;
|
||||
|
||||
final class Log {
|
||||
const NONE = 0;
|
||||
const FATAL = 1;
|
||||
const ERROR = 2;
|
||||
const WARN = 3;
|
||||
const INFO = 4;
|
||||
const DEBUG = 5;
|
||||
const TRACE = 6;
|
||||
|
||||
public static function toStdout() {
|
||||
CRT::log_to_stdout();
|
||||
}
|
||||
|
||||
public static function toStderr() {
|
||||
CRT::log_to_stderr();
|
||||
}
|
||||
|
||||
public static function toFile($filename) {
|
||||
CRT::log_to_file($filename);
|
||||
}
|
||||
|
||||
public static function toStream($stream) {
|
||||
assert(get_resource_type($stream) == "stream");
|
||||
CRT::log_to_stream($stream);
|
||||
}
|
||||
|
||||
public static function stop() {
|
||||
CRT::log_stop();
|
||||
}
|
||||
|
||||
public static function setLogLevel($level) {
|
||||
assert($level >= self::NONE && $level <= self::TRACE);
|
||||
CRT::log_set_level($level);
|
||||
}
|
||||
|
||||
public static function log($level, $message) {
|
||||
CRT::log_message($level, $message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0.
|
||||
*/
|
||||
use AWS\CRT\Log;
|
||||
|
||||
require_once('common.inc');
|
||||
|
||||
class LogTest extends CrtTestCase {
|
||||
|
||||
public function testLogToStream() {
|
||||
$this->skipFFI();
|
||||
$log_stream = fopen("php://memory", "r+");
|
||||
$this->assertNotNull($log_stream);
|
||||
Log::toStream($log_stream);
|
||||
Log::setLogLevel(Log::TRACE);
|
||||
Log::log(Log::TRACE, "THIS IS A TEST");
|
||||
$this->assertTrue(rewind($log_stream));
|
||||
$log_contents = stream_get_contents($log_stream, -1, 0);
|
||||
$this->assertStringEndsWith("THIS IS A TEST", trim($log_contents));
|
||||
Log::stop();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user