aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vcl_private.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-04-01 04:31:21 +0000
committerDave Barach <openvpp@barachs.net>2020-04-01 19:21:45 +0000
commit5da10c4c5501d40366df451703c2ffa3993be8cf (patch)
tree6a649e3e184f33bbb3be67b951f9dfc53325acf4 /src/vcl/vcl_private.h
parent805d58c2f65e92d92d47e7543378f557ce7aec96 (diff)
vcl: support sendto for dgrams
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I2a0fdced6a3ae262b30cda6a51f1fa96c1d44665
Diffstat (limited to 'src/vcl/vcl_private.h')
-rw-r--r--src/vcl/vcl_private.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index 4b8bf7565be..650d254afc7 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -555,6 +555,25 @@ vcl_session_closed_error (vcl_session_t * s)
? VPPCOM_ECONNRESET : VPPCOM_ENOTCONN;
}
+static inline void
+vcl_ip_copy_from_ep (ip46_address_t * ip, vppcom_endpt_t * ep)
+{
+ if (ep->is_ip4)
+ clib_memcpy_fast (&ip->ip4, ep->ip, sizeof (ip4_address_t));
+ else
+ clib_memcpy_fast (&ip->ip6, ep->ip, sizeof (ip6_address_t));
+}
+
+static inline void
+vcl_ip_copy_to_ep (ip46_address_t * ip, vppcom_endpt_t * ep, u8 is_ip4)
+{
+ ep->is_ip4 = is_ip4;
+ if (is_ip4)
+ clib_memcpy_fast (ep->ip, &ip->ip4, sizeof (ip4_address_t));
+ else
+ clib_memcpy_fast (ep->ip, &ip->ip6, sizeof (ip6_address_t));
+}
+
/*
* Helpers
*/