Skip to content

Commit

Permalink
Add sockaddr constructor for IPEndpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
SolidWallOfCode committed Mar 13, 2020
1 parent 72fde6d commit 53523eb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions swoc++/include/swoc/swoc_ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ union IPEndpoint {
// Construct from @a IPAddr
explicit IPEndpoint(IPAddr const& addr);

// Construct from @c sockaddr
IPEndpoint(sockaddr const * sa);

/** Break a string in to IP address relevant tokens.
*
* @param [in] src Source tex.t
Expand Down Expand Up @@ -1960,6 +1963,10 @@ inline IPEndpoint::IPEndpoint(IPAddr const& addr) {
this->assign(addr);
}

inline IPEndpoint::IPEndpoint(sockaddr const * sa) {
this->assign(sa);
}

inline IPEndpoint&
IPEndpoint::invalidate() {
sa.sa_family = AF_UNSPEC;
Expand Down

0 comments on commit 53523eb

Please sign in to comment.