]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
netsock2: backport ast_sockaddr_copy_sockaddr to asterisk 13.
authorJaco Kroon <jaco@uls.co.za>
Sun, 22 Dec 2019 16:07:50 +0000 (18:07 +0200)
committerJaco Kroon <jaco@uls.co.za>
Sun, 22 Dec 2019 16:07:50 +0000 (18:07 +0200)
This function is already present in 15, 16 and master.

Change-Id: I491ddecdccc87620c264567c549217e48f3d4ff1
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
include/asterisk/netsock2.h

index b6f2858bf19fcc0c68b59994f2cc0fb4b740d8b3..b62ca4cdc212a29c5ade587cf0d69bf0f8ce380a 100644 (file)
@@ -140,6 +140,22 @@ static inline void ast_sockaddr_setnull(struct ast_sockaddr *addr)
        addr->len = 0;
 }
 
+/*!
+ * \brief
+ * Copies the data from a sockaddr to an ast_sockaddr
+ *
+ * \param dst The destination ast_sockaddr
+ * \param src The source sockaddr
+ * \param len Length of the value stored in sockaddr
+ * \retval void
+ */
+static inline void ast_sockaddr_copy_sockaddr(struct ast_sockaddr *dst,
+               struct sockaddr *src, socklen_t len)
+{
+       memcpy(dst, src, len);
+       dst->len = len;
+}
+
 /*!
  * \since 1.8
  *