From f9a76b8e929026c6cab9218e9a453bb66df1ac4d Mon Sep 17 00:00:00 2001
From: Bret Ambrose <bretambrose@gmail.com>
Date: Wed, 18 Sep 2024 10:46:29 -0700
Subject: [PATCH 1/2] Install request-response headers

---
 CMakeLists.txt | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4a3348ec..43f6ac01 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,39 +39,44 @@ include(AwsFindPackage)
 
 file(GLOB AWS_MQTT_HEADERS
         "include/aws/mqtt/*.h"
-        )
+)
 
 file(GLOB AWS_MQTT5_HEADERS
         "include/aws/mqtt/v5/*.h"
-        )
+)
+
+file(GLOB AWS_MQTT_RR_HEADERS
+        "include/aws/mqtt/request-response/*.h"
+)
 
 file(GLOB AWS_MQTT_PRIV_HEADERS
         "include/aws/mqtt/private/*.h"
+        "include/aws/mqtt/private/request-response/*.h"
         "include/aws/mqtt/private/v5/*.h"
-        )
+)
 
 file(GLOB AWS_MQTT_PRIV_EXPOSED_HEADERS
         "include/aws/mqtt/private/mqtt_client_test_helper.h"
-        )
+)
 
 file(GLOB AWS_MQTT_SRC
         "source/*.c"
         "source/v5/*.c"
         "source/request-response/*.c"
-        )
+)
 
 file(GLOB MQTT_HEADERS
         ${AWS_MQTT_HEADERS}
         ${AWS_MQTT_PRIV_HEADERS}
-        )
+)
 
 file(GLOB AWS_MQTT5_HEADERS
         ${AWS_MQTT5_HEADERS}
-        )
+)
 
 file(GLOB MQTT_SRC
         ${AWS_MQTT_SRC}
-        )
+)
 
 add_library(${PROJECT_NAME} ${MQTT_HEADERS} ${MQTT_SRC})
 aws_set_common_properties(${PROJECT_NAME})
@@ -94,13 +99,14 @@ aws_prepare_shared_lib_exports(${PROJECT_NAME})
 
 install(FILES ${AWS_MQTT_HEADERS} DESTINATION "include/aws/mqtt" COMPONENT Development)
 install(FILES ${AWS_MQTT5_HEADERS} DESTINATION "include/aws/mqtt/v5" COMPONENT Development)
+install(FILES ${AWS_MQTT_RR_HEADERS} DESTINATION "include/aws/mqtt/request-response" COMPONENT Development)
 install(FILES ${AWS_MQTT_TESTING_HEADERS} DESTINATION "include/aws/testing/mqtt" COMPONENT Development)
 install(FILES ${AWS_MQTT_PRIV_EXPOSED_HEADERS} DESTINATION "include/aws/mqtt/private" COMPONENT Development)
 
 if (BUILD_SHARED_LIBS)
-   set (TARGET_DIR "shared")
+    set (TARGET_DIR "shared")
 else()
-   set (TARGET_DIR "static")
+    set (TARGET_DIR "static")
 endif()
 
 install(EXPORT "${PROJECT_NAME}-targets"

From e26a55f2a2bcffce257ff2a4ec85db786b725827 Mon Sep 17 00:00:00 2001
From: Bret Ambrose <bretambrose@gmail.com>
Date: Thu, 19 Sep 2024 13:15:01 -0700
Subject: [PATCH 2/2] Add some error codes

---
 include/aws/mqtt/mqtt.h |  3 +++
 source/mqtt.c           | 11 ++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/aws/mqtt/mqtt.h b/include/aws/mqtt/mqtt.h
index 8d632fd4..d71d96a5 100644
--- a/include/aws/mqtt/mqtt.h
+++ b/include/aws/mqtt/mqtt.h
@@ -90,6 +90,9 @@ enum aws_mqtt_error {
     AWS_ERROR_MQTT_REQUEST_RESPONSE_INTERNAL_ERROR,
     AWS_ERROR_MQTT_REQUEST_RESPONSE_PUBLISH_FAILURE,
     AWS_ERROR_MQTT_REUQEST_RESPONSE_STREAM_ALREADY_ACTIVATED,
+    AWS_ERROR_MQTT_REQUEST_RESPONSE_MODELED_SERVICE_ERROR,
+    AWS_ERROR_MQTT_REQUEST_RESPONSE_PAYLOAD_PARSE_ERROR,
+    AWS_ERROR_MQTT_REQUEST_RESPONSE_INVALID_RESPONSE_PATH,
 
     AWS_ERROR_END_MQTT_RANGE = AWS_ERROR_ENUM_END_RANGE(AWS_C_MQTT_PACKAGE_ID),
 };
diff --git a/source/mqtt.c b/source/mqtt.c
index 252cbd49..392dda20 100644
--- a/source/mqtt.c
+++ b/source/mqtt.c
@@ -259,7 +259,16 @@ bool aws_mqtt_is_valid_topic_filter(const struct aws_byte_cursor *topic_filter)
                 "Request-response operation failed because the associated publish failed synchronously."),
             AWS_DEFINE_ERROR_INFO_MQTT(
                 AWS_ERROR_MQTT_REUQEST_RESPONSE_STREAM_ALREADY_ACTIVATED,
-                "Streaming operation activation failed because the operaation had already been activated."),
+                "Streaming operation activation failed because the operation had already been activated."),
+            AWS_DEFINE_ERROR_INFO_MQTT(
+                 AWS_ERROR_MQTT_REQUEST_RESPONSE_MODELED_SERVICE_ERROR,
+                 "Request-response operation failed with a modeled service error."),
+            AWS_DEFINE_ERROR_INFO_MQTT(
+                 AWS_ERROR_MQTT_REQUEST_RESPONSE_PAYLOAD_PARSE_ERROR,
+                 "Request-response operation failed due to an inability to parse the payload."),
+            AWS_DEFINE_ERROR_INFO_MQTT(
+                 AWS_ERROR_MQTT_REQUEST_RESPONSE_INVALID_RESPONSE_PATH,
+                 "Request-response operation failed due to arrival on an unknown response path"),
         };
 /* clang-format on */
 #undef AWS_DEFINE_ERROR_INFO_MQTT