kgiusti commented on a change in pull request #558: Dispatch 1403
URL: https://github.com/apache/qpid-dispatch/pull/558#discussion_r319112225
 
 

 ##########
 File path: include/qpid/dispatch/buffer.h
 ##########
 @@ -176,6 +178,161 @@ static inline unsigned char *qd_buffer_at(const 
qd_buffer_t *buf, size_t len)
 }
 
 
+//
+// API for handling data that spans one or more buffers
+//
+
+/**
+ * Represents a span of data within a buffer chain.
+ * The buffer and cursor fields are guaranteed to be !null if length > 0.
+ */
+typedef struct qd_buffered_data_t {
+    qd_buffer_t   *buffer;  // head of buffer chain
+    unsigned char *cursor;  // start of first byte of data in 'buffer'
+    size_t         length;  // total number of bytes of data in chain
+} qd_buffered_data_t;
+
+
+/**
+ * Allocate a buffered data instance from the pool
+ * @param head Start of buffered data
+ * @param offset To start of data from qd_buffer_base(head)
+ * @param length Number of bytes in field
+ */
+qd_buffered_data_t *qd_buffered_data(qd_buffer_t *head, size_t offset, size_t 
length);
+
+
+/**
+ * Free an allocated qd_buffer_data_t
+ * @param bdata A pointer to the qd_buffered_data_t to free.  Note that the
+ * underlying buffer chain is not freed.
+ */
+void qd_buffered_data_free(qd_buffered_data_t *bdata);
+
+
+/**
+ * Copy n bytes of data from start of buffer chain (cursor) into buffer.
+ * Advance the cursor past the last byte copied.
+ * @param bdata Buffered data
+ * @param buffer Destination for copied bytes
+ * @param n Number of bytes to copy
+ * @return Number of bytes actually copied, which may be < n if length of
+ * buffered data is shorter than n.
+ */
+static inline size_t qd_buffered_data_copy(qd_buffered_data_t *bdata, unsigned 
char *buffer, size_t n)
+{ return 0; }
+
+/**
+ * Compare the first n bytes in the buffered data to contents of buffer.
+ * Advance the cursor past the last byte copied.  If matched advance the 
cursor past the nth byte.
 
 Review comment:
   Gah - typeo!  remove first sentence on this line!
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to