diff options
author | James M Snell <jasnell@gmail.com> | 2020-03-03 22:18:45 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2020-03-10 01:56:02 +0300 |
commit | 4ac1ce1071ede979956ab4654d40d31291b99f3d (patch) | |
tree | 4944f2b16b868c742cc159c3d543a19d1d156262 /src/udp_wrap.h | |
parent | a727b133438f8e76febf68f4c6d73414b7945f13 (diff) |
src: introduce node_sockaddr
Introduce the SocketAddress utility class. The QUIC implementation
makes extensive use of this for handling of socket addresses. It
was separated out to make it generically reusable throughout core
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/32070
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Diffstat (limited to 'src/udp_wrap.h')
-rw-r--r-- | src/udp_wrap.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/udp_wrap.h b/src/udp_wrap.h index 7afd9784b0a..6fed1d2dfea 100644 --- a/src/udp_wrap.h +++ b/src/udp_wrap.h @@ -26,6 +26,7 @@ #include "handle_wrap.h" #include "req_wrap.h" +#include "node_sockaddr.h" #include "uv.h" #include "v8.h" @@ -95,11 +96,8 @@ class UDPWrapBase { size_t nbufs, const sockaddr* addr) = 0; - // Stores the sockaddr for the peer in `name`. - virtual int GetPeerName(sockaddr* name, int* namelen) = 0; - - // Stores the sockaddr for the local socket in `name`. - virtual int GetSockName(sockaddr* name, int* namelen) = 0; + virtual SocketAddress GetPeerName() = 0; + virtual SocketAddress GetSockName() = 0; // Returns an AsyncWrap object with the same lifetime as this object. virtual AsyncWrap* GetAsyncWrap() = 0; @@ -168,8 +166,10 @@ class UDPWrap final : public HandleWrap, ssize_t Send(uv_buf_t* bufs, size_t nbufs, const sockaddr* addr) override; - int GetPeerName(sockaddr* name, int* namelen) override; - int GetSockName(sockaddr* name, int* namelen) override; + + SocketAddress GetPeerName() override; + SocketAddress GetSockName() override; + AsyncWrap* GetAsyncWrap() override; static v8::MaybeLocal<v8::Object> Instantiate(Environment* env, |