MCPcopy Create free account
hub / github.com/ElementsProject/elements / CService

Class CService

src/netaddress.h:527–559  ·  view source on GitHub ↗

A combination of a network address (CNetAddr) and a (TCP) port */

Source from the content-addressed store, hash-verified

525
526/** A combination of a network address (CNetAddr) and a (TCP) port */
527class CService : public CNetAddr
528{
529protected:
530 uint16_t port; // host order
531
532public:
533 CService();
534 CService(const CNetAddr& ip, uint16_t port);
535 CService(const struct in_addr& ipv4Addr, uint16_t port);
536 explicit CService(const struct sockaddr_in& addr);
537 uint16_t GetPort() const;
538 bool GetSockAddr(struct sockaddr* paddr, socklen_t* addrlen) const;
539 bool SetSockAddr(const struct sockaddr* paddr);
540 friend bool operator==(const CService& a, const CService& b);
541 friend bool operator!=(const CService& a, const CService& b) { return !(a == b); }
542 friend bool operator<(const CService& a, const CService& b);
543 std::vector<unsigned char> GetKey() const;
544 std::string ToString() const;
545 std::string ToStringPort() const;
546 std::string ToStringIPPort() const;
547
548 CService(const struct in6_addr& ipv6Addr, uint16_t port);
549 explicit CService(const struct sockaddr_in6& addr);
550
551 SERIALIZE_METHODS(CService, obj)
552 {
553 READWRITEAS(CNetAddr, obj);
554 READWRITE(Using<BigEndianFormatter<2>>(obj.port));
555 }
556
557 friend class CServiceHash;
558 friend CService MaybeFlipIPv6toCJDNS(const CService& service);
559};
560
561class CServiceHash
562{

Callers 15

AcceptMethod · 0.70
disconnected_cbMethod · 0.70
PushNodeVersionMethod · 0.70
LookupFunction · 0.70
LookupNumericFunction · 0.70
SetSockAddrMethod · 0.70
GetLocalFunction · 0.70
GetLocalAddressFunction · 0.70
GetLocalAddrForPeerFunction · 0.70
AddLocalFunction · 0.70
ThreadDNSAddressSeedMethod · 0.70

Calls

no outgoing calls

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.40
ipFunction · 0.40