This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/main by this push:
     new 1d1bf11  PROTON-2429: Introduce restricted pn_msgid_t typedef
1d1bf11 is described below

commit 1d1bf116ce125f345d71f4f8eef0000d506e2f78
Author: Andrew Stitcher <[email protected]>
AuthorDate: Thu Sep 2 16:19:18 2021 -0400

    PROTON-2429: Introduce restricted pn_msgid_t typedef
    
    This is a typedef for pn_atom_t but indicates that the values are
    restricted to be the subset that is allowed in message id and
    correlation id.
---
 c/include/proton/codec.h   | 11 +++++++++++
 c/include/proton/message.h |  8 ++++----
 c/src/core/message.c       | 12 ++++++++----
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/c/include/proton/codec.h b/c/include/proton/codec.h
index cc2e2f2..5cd54ad 100644
--- a/c/include/proton/codec.h
+++ b/c/include/proton/codec.h
@@ -301,6 +301,17 @@ typedef struct {
 } pn_atom_t;
 
 /**
+ * A type that holds scalar AMQP values that are valid for
+ * message id and correlation id fields.
+ *
+ * This is actually another name for ::pn_atom_t as it is just a
+ * restricted version of that type.
+ *
+ * @ingroup api_types
+ */
+typedef pn_atom_t pn_msgid_t;
+
+/**
  * @addtogroup data
  * @{
  */
diff --git a/c/include/proton/message.h b/c/include/proton/message.h
index 80b9e00..6a31eaf 100644
--- a/c/include/proton/message.h
+++ b/c/include/proton/message.h
@@ -286,7 +286,7 @@ PN_EXTERN pn_data_t *    pn_message_id                    
(pn_message_t *msg);
  * @param[in] msg a message object
  * @return the message id
  */
-PN_EXTERN pn_atom_t      pn_message_get_id                (pn_message_t *msg);
+PN_EXTERN pn_msgid_t     pn_message_get_id                (pn_message_t *msg);
 
 /**
  * Set the id for a message.
@@ -299,7 +299,7 @@ PN_EXTERN pn_atom_t      pn_message_get_id                
(pn_message_t *msg);
  * @param[in] id the new value of the message id
  * @return zero on success or an error code on failure
  */
-PN_EXTERN int            pn_message_set_id                (pn_message_t *msg, 
pn_atom_t id);
+PN_EXTERN int            pn_message_set_id                (pn_message_t *msg, 
pn_msgid_t id);
 
 /**
  * Get the user id for a message.
@@ -443,7 +443,7 @@ PN_EXTERN pn_data_t *    pn_message_correlation_id        
(pn_message_t *msg);
  * @param[in] msg a message object
  * @return the message id
  */
-PN_EXTERN pn_atom_t      pn_message_get_correlation_id    (pn_message_t *msg);
+PN_EXTERN pn_msgid_t     pn_message_get_correlation_id    (pn_message_t *msg);
 
 /**
  * Set the correlation id for a message.
@@ -456,7 +456,7 @@ PN_EXTERN pn_atom_t      pn_message_get_correlation_id    
(pn_message_t *msg);
  * @param[in] id the new value of the message id
  * @return zero on success or an error code on failure
  */
-PN_EXTERN int            pn_message_set_correlation_id    (pn_message_t *msg, 
pn_atom_t id);
+PN_EXTERN int            pn_message_set_correlation_id    (pn_message_t *msg, 
pn_msgid_t id);
 
 /**
  * Get the content_type for a message.
diff --git a/c/src/core/message.c b/c/src/core/message.c
index a52dce8..987ff20 100644
--- a/c/src/core/message.c
+++ b/c/src/core/message.c
@@ -481,12 +481,14 @@ pn_data_t *pn_message_id(pn_message_t *msg)
   assert(msg);
   return msg->id;
 }
-pn_atom_t pn_message_get_id(pn_message_t *msg)
+
+pn_msgid_t pn_message_get_id(pn_message_t *msg)
 {
   assert(msg);
   return pn_data_get_atom(msg->id);
 }
-int pn_message_set_id(pn_message_t *msg, pn_atom_t id)
+
+int pn_message_set_id(pn_message_t *msg, pn_msgid_t id)
 {
   assert(msg);
   pn_data_rewind(msg->id);
@@ -552,12 +554,14 @@ pn_data_t *pn_message_correlation_id(pn_message_t *msg)
   assert(msg);
   return msg->correlation_id;
 }
-pn_atom_t pn_message_get_correlation_id(pn_message_t *msg)
+
+pn_msgid_t pn_message_get_correlation_id(pn_message_t *msg)
 {
   assert(msg);
   return pn_data_get_atom(msg->correlation_id);
 }
-int pn_message_set_correlation_id(pn_message_t *msg, pn_atom_t atom)
+
+int pn_message_set_correlation_id(pn_message_t *msg, pn_msgid_t id)
 {
   assert(msg);
   pn_data_rewind(msg->correlation_id);

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to