From: Dmitry Eremin-Solenikov <[email protected]>

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 <[email protected]>
---
/** 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(-)

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;

Reply via email to