diff mbox series

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

Message ID 1495519210-740-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v3,1/1] api: ipsec: factor out IP protocol version parameter | expand

Commit Message

Github ODP bot May 23, 2017, 6 a.m. UTC
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: 826ee894aa0ebd09d42a17e1de077c46bc5b366a
 ** Merge commit sha: 113bbff64c0bc3040833985e4de3f5b887f2b0c0
 **/
 include/odp/api/spec/ipsec.h | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

Comments

Savolainen, Petri (Nokia - FI/Espoo) May 23, 2017, 12:49 p.m. UTC | #1
Reviewed-by: Petri Savolainen <petri.savolainen@linaro.org>



> -----Original Message-----

> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of

> Github ODP bot

> Sent: Tuesday, May 23, 2017 9:00 AM

> To: lng-odp@lists.linaro.org

> Subject: [lng-odp] [PATCH API-NEXT v3 1/1] api: ipsec: factor out IP

> protocol version parameter

> 

> 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: 826ee894aa0ebd09d42a17e1de077c46bc5b366a

>  ** Merge commit sha: 113bbff64c0bc3040833985e4de3f5b887f2b0c0

>  **/

>  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 e83494d3..674bcb96 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 = 4,

> +

> +	/** Header is IPv6 */

> +	ODP_IPSEC_IPV6 = 6

> +

> +} 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;
diff mbox series

Patch

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index e83494d3..674bcb96 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 = 4,
+
+	/** Header is IPv6 */
+	ODP_IPSEC_IPV6 = 6
+
+} 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;