[API-NEXT,v3,1/6] api: packet: add packet memset and memcmp-like functions

Message ID 1501552809-14585-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • Add support for AES-192 and AES-256 keys
Related show

Commit Message

Github ODP bot Aug. 1, 2017, 2 a.m.
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Currently we have such functions in internal namespace for in-ODP use
only. Exporting them as a part of public API would allow using them from
tests and user applications.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 94 (lumag:crypto-long-keys)
 ** https://github.com/Linaro/odp/pull/94
 ** Patch: https://github.com/Linaro/odp/pull/94.patch
 ** Base sha: c16f1363303cd5fc11324acbc4dfebe0a9680a41
 ** Merge commit sha: 97de0c6543391f0a758ac472f48e0b407ad1d800
 **/
 include/odp/api/spec/packet.h | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Patch

diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 95f5349b..d37468ff 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -1135,6 +1135,39 @@  int odp_packet_copy_data(odp_packet_t pkt, uint32_t dst_offset,
 int odp_packet_move_data(odp_packet_t pkt, uint32_t dst_offset,
 			 uint32_t src_offset, uint32_t len);
 
+/**
+ * Set packet data to specific value
+ *
+ * Set 'len' bytes of packet data to value 'c' starting from 'offset'.  Maximum
+ * number of bytes to copy is packet data length minus the offset. Packet is
+ * not modified on an error.
+ *
+ * @param pkt    Packet handle
+ * @param offset Byte offset into the packet
+ * @param c      Value to set
+ * @param len    Number of bytes to set
+ */
+int odp_packet_set_data(odp_packet_t pkt, uint32_t offset,
+			uint8_t c, uint32_t len);
+
+/**
+ * Compare data with packet
+ *
+ * Compare 'len' bytes of data from the source address with the packet
+ * contentes starting from offset. Maximum number of bytes to compare is packet
+ * data length minus the offset. Packet is not modified on an error.
+ *
+ * @param pkt    Packet handle
+ * @param offset Byte offset into the packet
+ * @param data   Data address
+ * @param len    Number of bytes to compare
+ *
+ * @retval 0 on success
+ * @retval <0 on failure
+ */
+int odp_packet_cmp_mem(odp_packet_t pkt, uint32_t offset,
+		       const void *data, uint32_t len);
+
 /*
  *
  * Meta-data