[API-NEXT,v2,1/1] api: ipsec: factor out IP protocol version parameter

Message ID 1494021622-16250-2-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series
  • [API-NEXT,v2,1/1] api: ipsec: factor out IP protocol version parameter
Related show

Commit Message

Github ODP bot May 5, 2017, 10 p.m.
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Instead of using 'magic' numbers for ip version in SA params, define new
enum to distinguish between IPv4 and IPv6.

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

---
/** Email created from pull request 20 (lumag:ipsec-ipv)
 ** https://github.com/Linaro/odp/pull/20
 ** Patch: https://github.com/Linaro/odp/pull/20.patch
 ** Base sha: 540490ddf3a1b3da4b80ed15fc874ccdfc49b60c
 ** Merge commit sha: 202225608c0ec69e40c461b0d0f0d7274b64c141
 **/
 include/odp/api/spec/ipsec.h | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index e83494d..8829b55 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -569,6 +569,18 @@  typedef enum odp_ipsec_pipeline_t {
 } odp_ipsec_pipeline_t;
 
 /**
+ * IPSEC header type
+ */
+typedef enum odp_ipsec_ip_version_t {
+	/** Header is IPv4 */
+	ODP_IPSEC_IPV4 = 0,
+
+	/** Header is IPv6 */
+	ODP_IPSEC_IPV6
+
+} odp_ipsec_ip_version_t;
+
+/**
  * IPSEC Security Association (SA) parameters
  */
 typedef struct odp_ipsec_sa_param_t {
@@ -613,11 +625,8 @@  typedef struct odp_ipsec_sa_param_t {
 	 *  only in ODP_IPSEC_LOOKUP_DSTADDR_SPI lookup mode. */
 	struct {
 		/** Select IP version
-		 *
-		 *  4:   IPv4
-		 *  6:   IPv6
 		 */
-		uint8_t ip_version;
+		odp_ipsec_ip_version_t ip_version;
 
 		/** IP destination address (NETWORK ENDIAN) */
 		void    *dst_addr;