1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 #ifndef AWS_JNI_MQTT5_UTILS_H 6 #define AWS_JNI_MQTT5_UTILS_H 7 8 #include <jni.h> 9 10 struct aws_mqtt5_user_property; 11 struct aws_mqtt5_packet_connack_view; 12 struct aws_mqtt5_packet_disconnect_view; 13 struct aws_mqtt5_negotiated_settings; 14 struct aws_mqtt5_packet_publish_view; 15 struct aws_mqtt5_packet_puback_view; 16 17 int s_set_jni_uint32_t_field_in_packet( 18 JNIEnv *env, 19 const uint32_t *native_integer, 20 jobject packet, 21 jfieldID field_id, 22 char *field_name, 23 bool optional); 24 25 int s_set_jni_uint16_t_field_in_packet( 26 JNIEnv *env, 27 const uint16_t *native_integer, 28 jobject packet, 29 jfieldID field_id, 30 char *field_name, 31 bool optional); 32 33 int s_set_jni_bool_field_in_packet( 34 JNIEnv *env, 35 const bool *native_boolean, 36 jobject packet, 37 jfieldID field_id, 38 char *field_name, 39 bool optional); 40 41 int s_set_jni_string_field_in_packet( 42 JNIEnv *env, 43 const struct aws_byte_cursor *native_cursor, 44 jobject packet, 45 jfieldID field_id, 46 char *field_name, 47 bool optional); 48 49 int s_set_jni_byte_array_field_in_packet( 50 JNIEnv *env, 51 const struct aws_byte_cursor *native_cursor, 52 jobject packet, 53 jfieldID field_id, 54 char *field_name, 55 bool optional); 56 57 int s_set_user_properties_field( 58 JNIEnv *env, 59 const size_t user_property_count, 60 const struct aws_mqtt5_user_property *packet_properties, 61 jobject packet, 62 jfieldID user_property_field_id); 63 64 int s_set_int_enum_in_packet( 65 JNIEnv *env, 66 const int *int_enum, 67 jobject packet, 68 jmethodID set_enum_field_id, 69 bool optional); 70 71 jobject s_aws_mqtt5_client_create_jni_connack_packet_from_native( 72 JNIEnv *env, 73 const struct aws_mqtt5_packet_connack_view *native_connack_data); 74 75 jobject s_aws_mqtt5_client_create_jni_disconnect_packet_from_native( 76 JNIEnv *env, 77 const struct aws_mqtt5_packet_disconnect_view *native_disconnect_data); 78 79 jobject s_aws_mqtt5_client_create_jni_negotiated_settings_from_native( 80 JNIEnv *env, 81 const struct aws_mqtt5_negotiated_settings *native_negotiated_settings_data); 82 83 jobject s_aws_mqtt5_client_create_jni_publish_packet_from_native( 84 JNIEnv *env, 85 const struct aws_mqtt5_packet_publish_view *publish); 86 87 jobject s_aws_mqtt5_client_create_jni_puback_packet_from_native( 88 JNIEnv *env, 89 struct aws_mqtt5_packet_puback_view *puback_packet); 90 91 #endif /* AWS_JNI_MQTT5_UTILS_H */ 92