[API-NEXT,v1,2/2] helper: provide icmp non-camelcase alternative

Message ID 1515546007-13757-3-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • Icmp camelcase
Related show

Commit Message

Github ODP bot Jan. 10, 2018, 1 a.m.
From: Bill Fischofer <bill.fischofer@linaro.org>


Add the ODPH_IPPROTO_ICMPV4 and ODPH_IPPROTO_ICMPV6 defines to
avoid camelcase issues in ODP examples. Since the helpers are part
of the public API, the camelcase variants are retained for
compatibility, however ODP example code that uses helpers is updated
to use the non-camelcase forms.
---
/** Email created from pull request 386 (Bill-Fischofer-Linaro:icmp-camelcase)
 ** https://github.com/Linaro/odp/pull/386
 ** Patch: https://github.com/Linaro/odp/pull/386.patch
 ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4
 ** Merge commit sha: 9b488231de93541f9a2c75a6e277921c55041427
 **/
 example/generator/odp_generator.c | 4 ++--
 example/ipsec/odp_ipsec_stream.c  | 6 +++---
 helper/include/odp/helper/ip.h    | 2 ++
 3 files changed, 7 insertions(+), 5 deletions(-)

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index b1827e9c9..0fc4c9ccd 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -426,7 +426,7 @@  static odp_packet_t setup_icmp_pkt_ref(odp_pool_t pool,
 	ip->ttl = 64;
 	ip->tot_len = odp_cpu_to_be_16(args->appl.payload + ODPH_ICMPHDR_LEN +
 				       ODPH_IPV4HDR_LEN);
-	ip->proto = ODPH_IPPROTO_ICMPv4;
+	ip->proto = ODPH_IPPROTO_ICMPV4;
 	ip->id = 0;
 	ip->chksum = 0;
 
@@ -806,7 +806,7 @@  static void print_pkts(int thr, thread_args_t *thr_args,
 			thr_args->counters.ctr_udp_rcv++;
 
 		/* icmp */
-		if (ip->proto == ODPH_IPPROTO_ICMPv4) {
+		if (ip->proto == ODPH_IPPROTO_ICMPV4) {
 			icmp = (odph_icmphdr_t *)(buf + offset);
 
 			process_icmp_pkt(thr_args, icmp, msg);
diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c
index c287282e8..3773ce525 100644
--- a/example/ipsec/odp_ipsec_stream.c
+++ b/example/ipsec/odp_ipsec_stream.c
@@ -217,7 +217,7 @@  odp_packet_t create_ipv4_packet(stream_db_entry_t *stream,
 		ip->src_addr = odp_cpu_to_be_32(entry->tun_src_ip);
 		ip->dst_addr = odp_cpu_to_be_32(entry->tun_dst_ip);
 	} else {
-		ip->proto = ODPH_IPPROTO_ICMPv4;
+		ip->proto = ODPH_IPPROTO_ICMPV4;
 		ip->src_addr = odp_cpu_to_be_32(stream->src_ip);
 		ip->dst_addr = odp_cpu_to_be_32(stream->dst_ip);
 	}
@@ -260,7 +260,7 @@  odp_packet_t create_ipv4_packet(stream_db_entry_t *stream,
 		inner_ip = (odph_ipv4hdr_t *)data;
 		memset((char *)inner_ip, 0, sizeof(*inner_ip));
 		inner_ip->ver_ihl = 0x45;
-		inner_ip->proto = ODPH_IPPROTO_ICMPv4;
+		inner_ip->proto = ODPH_IPPROTO_ICMPV4;
 		inner_ip->id = odp_cpu_to_be_16(stream->id);
 		inner_ip->ttl = 64;
 		inner_ip->tos = 0;
@@ -518,7 +518,7 @@  odp_bool_t verify_ipv4_packet(stream_db_entry_t *stream,
 		icmp = (odph_icmphdr_t *)(inner_ip + 1);
 		data = (uint8_t *)icmp;
 	} else {
-		if (ODPH_IPPROTO_ICMPv4 != ip->proto)
+		if (ODPH_IPPROTO_ICMPV4 != ip->proto)
 			return FALSE;
 		icmp = (odph_icmphdr_t *)data;
 	}
diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h
index b96aab280..a47030a39 100644
--- a/helper/include/odp/helper/ip.h
+++ b/helper/include/odp/helper/ip.h
@@ -252,6 +252,7 @@  typedef struct ODP_PACKED {
  * @{*/
 #define ODPH_IPPROTO_HOPOPTS 0x00 /**< IPv6 hop-by-hop options */
 #define ODPH_IPPROTO_ICMPv4  0x01 /**< Internet Control Message Protocol (1) */
+#define ODPH_IPPROTO_ICMPV4  0x01 /**< Internet Control Message Protocol (1) */
 #define ODPH_IPPROTO_TCP     0x06 /**< Transmission Control Protocol (6) */
 #define ODPH_IPPROTO_UDP     0x11 /**< User Datagram Protocol (17) */
 #define ODPH_IPPROTO_ROUTE   0x2B /**< IPv6 Routing header (43) */
@@ -259,6 +260,7 @@  typedef struct ODP_PACKED {
 #define ODPH_IPPROTO_AH      0x33 /**< Authentication Header (51) */
 #define ODPH_IPPROTO_ESP     0x32 /**< Encapsulating Security Payload (50) */
 #define ODPH_IPPROTO_ICMPv6  0x3A /**< Internet Control Message Protocol (58) */
+#define ODPH_IPPROTO_ICMPV6  0x3A /**< Internet Control Message Protocol (58) */
 #define ODPH_IPPROTO_INVALID 0xFF /**< Reserved invalid by IANA */
 
 /**@}*/