diff options
author | Mauro Sardara <msardara@cisco.com> | 2020-04-22 10:44:01 +0200 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2020-04-22 10:44:01 +0200 |
commit | 0296cf30d22918bc5c23e02cf2510fa18dec687e (patch) | |
tree | 859b72c6857cd28d08ddc9da45cbc47a11026095 /lib | |
parent | 2cc6a4f2c8499a8d7d52c5dd93f610ec8a5f926a (diff) |
[HICN-601] Redefine TCP flags with HICN_ prefix
Change-Id: I9263a65f3f151d55cdefcd14d39df4a70df9a83c
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/includes/hicn/protocol/tcp.h | 14 | ||||
-rw-r--r-- | lib/src/compat.c | 72 | ||||
-rw-r--r-- | lib/src/protocol/tcp.c | 4 |
3 files changed, 41 insertions, 49 deletions
diff --git a/lib/includes/hicn/protocol/tcp.h b/lib/includes/hicn/protocol/tcp.h index 3a15a93b3..347682299 100644 --- a/lib/includes/hicn/protocol/tcp.h +++ b/lib/includes/hicn/protocol/tcp.h @@ -128,8 +128,6 @@ typedef struct static_assert (EXPECTED_TCP_HDRLEN == TCP_HDRLEN, "Size of TCP struct does not match its expected size."); -#ifndef HICN_VPP_PLUGIN - /* TCP flags bit 0 first. */ #define foreach_tcp_flag \ _ (FIN) /**< No more data from sender. */ \ @@ -143,25 +141,19 @@ static_assert (EXPECTED_TCP_HDRLEN == TCP_HDRLEN, enum { -#define _(f) TCP_FLAG_BIT_##f, +#define _(f) HICN_TCP_FLAG_BIT_##f, foreach_tcp_flag #undef _ - TCP_N_FLAG_BITS, + HICN_TCP_N_FLAG_BITS, }; enum { -#define _(f) TCP_FLAG_##f = 1 << TCP_FLAG_BIT_##f, +#define _(f) HICN_TCP_FLAG_##f = 1 << HICN_TCP_FLAG_BIT_##f, foreach_tcp_flag #undef _ }; -#endif /* HICN_VPP_PLUGIN */ - -// get_data_name_suffix -// name->ip4.suffix = h->v4.tcp.seq; - - #endif /* HICN_PROTOCOL_TCP_H */ /* diff --git a/lib/src/compat.c b/lib/src/compat.c index 5473aaca8..615175e3b 100644 --- a/lib/src/compat.c +++ b/lib/src/compat.c @@ -543,10 +543,10 @@ hicn_packet_get_payload_type (const hicn_header_t * h, switch (HICN_IP_VERSION (h)) { case 6: - *payload_type = ((h->v6.tcp.flags & TCP_FLAG_URG) == TCP_FLAG_URG); + *payload_type = ((h->v6.tcp.flags & HICN_TCP_FLAG_URG) == HICN_TCP_FLAG_URG); break; case 4: - *payload_type = ((h->v4.tcp.flags & TCP_FLAG_URG) == TCP_FLAG_URG); + *payload_type = ((h->v4.tcp.flags & HICN_TCP_FLAG_URG) == HICN_TCP_FLAG_URG); break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -573,15 +573,15 @@ hicn_packet_set_payload_type (hicn_header_t * h, { case 6: if (payload_type) - h->v6.tcp.flags = h->v6.tcp.flags | TCP_FLAG_URG; + h->v6.tcp.flags = h->v6.tcp.flags | HICN_TCP_FLAG_URG; else - h->v6.tcp.flags = h->v6.tcp.flags & ~TCP_FLAG_URG; + h->v6.tcp.flags = h->v6.tcp.flags & ~HICN_TCP_FLAG_URG; break; case 4: if (payload_type) - h->v4.tcp.flags = h->v4.tcp.flags | TCP_FLAG_URG; + h->v4.tcp.flags = h->v4.tcp.flags | HICN_TCP_FLAG_URG; else - h->v4.tcp.flags = h->v4.tcp.flags & ~TCP_FLAG_URG; + h->v4.tcp.flags = h->v4.tcp.flags & ~HICN_TCP_FLAG_URG; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -596,10 +596,10 @@ hicn_packet_set_syn (hicn_header_t * h) switch (HICN_IP_VERSION (h)) { case 6: - h->v6.tcp.flags = h->v6.tcp.flags | TCP_FLAG_SYN; + h->v6.tcp.flags = h->v6.tcp.flags | HICN_TCP_FLAG_SYN; break; case 4: - h->v4.tcp.flags = h->v4.tcp.flags | TCP_FLAG_SYN; + h->v4.tcp.flags = h->v4.tcp.flags | HICN_TCP_FLAG_SYN; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -613,10 +613,10 @@ hicn_packet_reset_syn (hicn_header_t * h) switch (HICN_IP_VERSION (h)) { case 6: - h->v6.tcp.flags = h->v6.tcp.flags & ~TCP_FLAG_SYN; + h->v6.tcp.flags = h->v6.tcp.flags & ~HICN_TCP_FLAG_SYN; break; case 4: - h->v4.tcp.flags = h->v4.tcp.flags & ~TCP_FLAG_SYN; + h->v4.tcp.flags = h->v4.tcp.flags & ~HICN_TCP_FLAG_SYN; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -630,10 +630,10 @@ hicn_packet_test_syn (const hicn_header_t * h, bool * flag) switch (HICN_IP_VERSION (h)) { case 6: - *flag = h->v6.tcp.flags & TCP_FLAG_SYN; + *flag = h->v6.tcp.flags & HICN_TCP_FLAG_SYN; break; case 4: - *flag = h->v4.tcp.flags & TCP_FLAG_SYN; + *flag = h->v4.tcp.flags & HICN_TCP_FLAG_SYN; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -647,10 +647,10 @@ hicn_packet_set_ack (hicn_header_t * h) switch (HICN_IP_VERSION (h)) { case 6: - h->v6.tcp.flags = h->v6.tcp.flags | TCP_FLAG_ACK; + h->v6.tcp.flags = h->v6.tcp.flags | HICN_TCP_FLAG_ACK; break; case 4: - h->v4.tcp.flags = h->v4.tcp.flags | TCP_FLAG_ACK; + h->v4.tcp.flags = h->v4.tcp.flags | HICN_TCP_FLAG_ACK; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -664,10 +664,10 @@ hicn_packet_reset_ack (hicn_header_t * h) switch (HICN_IP_VERSION (h)) { case 6: - h->v6.tcp.flags = h->v6.tcp.flags & ~TCP_FLAG_ACK; + h->v6.tcp.flags = h->v6.tcp.flags & ~HICN_TCP_FLAG_ACK; break; case 4: - h->v4.tcp.flags = h->v4.tcp.flags & ~TCP_FLAG_ACK; + h->v4.tcp.flags = h->v4.tcp.flags & ~HICN_TCP_FLAG_ACK; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -681,10 +681,10 @@ hicn_packet_test_ack (const hicn_header_t * h, bool * flag) switch (HICN_IP_VERSION (h)) { case 6: - *flag = h->v6.tcp.flags & TCP_FLAG_ACK; + *flag = h->v6.tcp.flags & HICN_TCP_FLAG_ACK; break; case 4: - *flag = h->v4.tcp.flags & TCP_FLAG_ACK; + *flag = h->v4.tcp.flags & HICN_TCP_FLAG_ACK; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -698,10 +698,10 @@ hicn_packet_set_rst (hicn_header_t * h) switch (HICN_IP_VERSION (h)) { case 6: - h->v6.tcp.flags = h->v6.tcp.flags | TCP_FLAG_RST; + h->v6.tcp.flags = h->v6.tcp.flags | HICN_TCP_FLAG_RST; break; case 4: - h->v4.tcp.flags = h->v4.tcp.flags | TCP_FLAG_RST; + h->v4.tcp.flags = h->v4.tcp.flags | HICN_TCP_FLAG_RST; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -715,10 +715,10 @@ hicn_packet_reset_rst (hicn_header_t * h) switch (HICN_IP_VERSION (h)) { case 6: - h->v6.tcp.flags = h->v6.tcp.flags & ~TCP_FLAG_RST; + h->v6.tcp.flags = h->v6.tcp.flags & ~HICN_TCP_FLAG_RST; break; case 4: - h->v4.tcp.flags = h->v4.tcp.flags & ~TCP_FLAG_RST; + h->v4.tcp.flags = h->v4.tcp.flags & ~HICN_TCP_FLAG_RST; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -732,10 +732,10 @@ hicn_packet_test_rst (const hicn_header_t * h, bool * flag) switch (HICN_IP_VERSION (h)) { case 6: - *flag = h->v6.tcp.flags & TCP_FLAG_RST; + *flag = h->v6.tcp.flags & HICN_TCP_FLAG_RST; break; case 4: - *flag = h->v4.tcp.flags & TCP_FLAG_RST; + *flag = h->v4.tcp.flags & HICN_TCP_FLAG_RST; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -749,10 +749,10 @@ hicn_packet_set_fin (hicn_header_t * h) switch (HICN_IP_VERSION (h)) { case 6: - h->v6.tcp.flags = h->v6.tcp.flags | TCP_FLAG_FIN; + h->v6.tcp.flags = h->v6.tcp.flags | HICN_TCP_FLAG_FIN; break; case 4: - h->v4.tcp.flags = h->v4.tcp.flags | TCP_FLAG_FIN; + h->v4.tcp.flags = h->v4.tcp.flags | HICN_TCP_FLAG_FIN; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -766,10 +766,10 @@ hicn_packet_reset_fin (hicn_header_t * h) switch (HICN_IP_VERSION (h)) { case 6: - h->v6.tcp.flags = h->v6.tcp.flags & ~TCP_FLAG_FIN; + h->v6.tcp.flags = h->v6.tcp.flags & ~HICN_TCP_FLAG_FIN; break; case 4: - h->v4.tcp.flags = h->v4.tcp.flags & ~TCP_FLAG_FIN; + h->v4.tcp.flags = h->v4.tcp.flags & ~HICN_TCP_FLAG_FIN; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -783,10 +783,10 @@ hicn_packet_test_fin (const hicn_header_t * h, bool * flag) switch (HICN_IP_VERSION (h)) { case 6: - *flag = h->v6.tcp.flags & TCP_FLAG_FIN; + *flag = h->v6.tcp.flags & HICN_TCP_FLAG_FIN; break; case 4: - *flag = h->v4.tcp.flags & TCP_FLAG_FIN; + *flag = h->v4.tcp.flags & HICN_TCP_FLAG_FIN; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -800,10 +800,10 @@ hicn_packet_set_ece (hicn_header_t * h) switch (HICN_IP_VERSION (h)) { case 6: - h->v6.tcp.flags = h->v6.tcp.flags | TCP_FLAG_ECE; + h->v6.tcp.flags = h->v6.tcp.flags | HICN_TCP_FLAG_ECE; break; case 4: - h->v4.tcp.flags = h->v4.tcp.flags | TCP_FLAG_ECE; + h->v4.tcp.flags = h->v4.tcp.flags | HICN_TCP_FLAG_ECE; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -817,10 +817,10 @@ hicn_packet_reset_ece (hicn_header_t * h) switch (HICN_IP_VERSION (h)) { case 6: - h->v6.tcp.flags = h->v6.tcp.flags & ~TCP_FLAG_ECE; + h->v6.tcp.flags = h->v6.tcp.flags & ~HICN_TCP_FLAG_ECE; break; case 4: - h->v4.tcp.flags = h->v4.tcp.flags & ~TCP_FLAG_ECE; + h->v4.tcp.flags = h->v4.tcp.flags & ~HICN_TCP_FLAG_ECE; break; default: return HICN_LIB_ERROR_UNEXPECTED; @@ -834,10 +834,10 @@ hicn_packet_test_ece (const hicn_header_t * h, bool * flag) switch (HICN_IP_VERSION (h)) { case 6: - *flag = h->v6.tcp.flags & TCP_FLAG_ECE; + *flag = h->v6.tcp.flags & HICN_TCP_FLAG_ECE; break; case 4: - *flag = h->v4.tcp.flags & TCP_FLAG_ECE; + *flag = h->v4.tcp.flags & HICN_TCP_FLAG_ECE; break; default: return HICN_LIB_ERROR_UNEXPECTED; diff --git a/lib/src/protocol/tcp.c b/lib/src/protocol/tcp.c index 14e07b091..31c495ff4 100644 --- a/lib/src/protocol/tcp.c +++ b/lib/src/protocol/tcp.c @@ -85,14 +85,14 @@ tcp_set_interest_name_suffix (hicn_type_t type, hicn_protocol_t * h, int tcp_mark_packet_as_interest (hicn_type_t type, hicn_protocol_t * h) { - h->tcp.flags &= ~TCP_FLAG_ECE; + h->tcp.flags &= ~HICN_TCP_FLAG_ECE; return HICN_LIB_ERROR_NONE; } int tcp_mark_packet_as_data (hicn_type_t type, hicn_protocol_t * h) { - h->tcp.flags |= TCP_FLAG_ECE; + h->tcp.flags |= HICN_TCP_FLAG_ECE; return HICN_LIB_ERROR_NONE; } |