1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #ifndef AWS_JNI_CRT_HTTP_REQUEST_UTILS_H 7 #define AWS_JNI_CRT_HTTP_REQUEST_UTILS_H 8 9 #include <jni.h> 10 11 #include <aws/common/byte_buf.h> 12 13 struct aws_allocator; 14 struct aws_http_header; 15 struct aws_http_headers; 16 struct aws_http_message; 17 struct aws_input_stream; 18 19 struct aws_input_stream *aws_input_stream_new_from_java_http_request_body_stream( 20 struct aws_allocator *allocator, 21 JNIEnv *env, 22 jobject http_request_body_stream); 23 24 struct aws_http_message *aws_http_request_new_from_java_http_request( 25 JNIEnv *env, 26 jbyteArray marshalled_request, 27 jobject jni_body_stream); 28 29 struct aws_http_headers *aws_http_headers_new_from_java_http_headers(JNIEnv *env, jbyteArray marshalled_headers); 30 31 int aws_marshal_http_headers_array_to_dynamic_buffer( 32 struct aws_byte_buf *buf, 33 const struct aws_http_header *header_array, 34 size_t num_headers); 35 36 int aws_marshal_http_headers_to_dynamic_buffer(struct aws_byte_buf *buf, const struct aws_http_headers *headers); 37 38 /* if this fails a java exception has been set. */ 39 int aws_apply_java_http_request_changes_to_native_request( 40 JNIEnv *env, 41 jbyteArray marshalled_request, 42 jobject jni_body_stream, 43 struct aws_http_message *message); 44 45 /* if this fails a java exception has been set. */ 46 jobject aws_java_http_request_from_native(JNIEnv *env, struct aws_http_message *message, jobject request_body_stream); 47 48 #endif /* AWS_JNI_CRT_HTTP_REQUEST_UTILS_H */ 49