mirror of
https://github.com/awslabs/aws-crt-php.git
synced 2026-08-17 17:47:12 +00:00
* Updated to get latest aws-crt-ffi * Added implementation for signing_result * Added main thread queue and callback queueing to signing process * Updated to get support for date on signing_config_aws * added date support to SigningConfigAWS, fixed up reference issues on http message signing * Broke C code into separate files, moved common stuff to php_aws_crt.h * Use a unity build to make PHP do the right thing with our lib * Updated aws-crt-ffi to v0.1.3 to get sigv4 changes * Added CRT::isAvailable for safe runtime detection of CRT * Fixed up test resource safety, added tests to prove it * Added CI jobs for every version of PHP on linux (#26)
39 lines
1.0 KiB
C
39 lines
1.0 KiB
C
/**
|
|
* 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_http_message_new_from_blob) {
|
|
const char *blob = NULL;
|
|
size_t blob_len = 0;
|
|
|
|
aws_php_parse_parameters("s", &blob, &blob_len);
|
|
|
|
aws_crt_http_message *message = aws_crt_http_message_new_from_blob((uint8_t *)blob, blob_len);
|
|
RETURN_LONG((zend_ulong)message);
|
|
}
|
|
|
|
PHP_FUNCTION(aws_crt_http_message_to_blob) {
|
|
zend_ulong php_msg = 0;
|
|
|
|
aws_php_parse_parameters("l", &php_msg);
|
|
|
|
aws_crt_http_message *message = (void *)php_msg;
|
|
uint8_t *blob = NULL;
|
|
size_t blob_len = 0;
|
|
aws_crt_http_message_to_blob(message, &blob, &blob_len);
|
|
RETURN_STRINGL((const char *)blob, blob_len);
|
|
aws_crt_mem_release(blob);
|
|
}
|
|
|
|
PHP_FUNCTION(aws_crt_http_message_release) {
|
|
zend_ulong php_msg = 0;
|
|
|
|
aws_php_parse_parameters("l", &php_msg);
|
|
|
|
aws_crt_http_message *message = (void *)php_msg;
|
|
aws_crt_http_message_release(message);
|
|
}
|