join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
endpoint.hpp
Go to the documentation of this file.
1
25#ifndef __JOIN_ENDPOINT_HPP__
26#define __JOIN_ENDPOINT_HPP__
27
28// libjoin.
29#include <join/macaddress.hpp>
30
31// C++.
32#include <ostream>
33#include <sstream>
34
35// C.
36#include <linux/netfilter/nfnetlink.h>
37#include <linux/if_packet.h>
38#include <linux/rtnetlink.h>
39#include <linux/netlink.h>
40#include <sys/un.h>
41#include <cstring>
42
43namespace join
44{
48 template <class Protocol>
49 class BasicEndpoint
50 {
51 public:
55 constexpr BasicEndpoint () noexcept
56 {
57 this->_addr.ss_family = Protocol ().family ();
58 }
59
65 BasicEndpoint (const struct sockaddr* addr, socklen_t len) noexcept
66 {
67 memcpy (&this->_addr, addr, len);
68 }
69
74 struct sockaddr* addr () noexcept
75 {
76 return reinterpret_cast <struct sockaddr*> (&this->_addr);
77 }
78
83 const struct sockaddr* addr () const noexcept
84 {
85 return reinterpret_cast <const struct sockaddr*> (&this->_addr);
86 }
87
88 protected:
90 struct sockaddr_storage _addr = {};
91 };
92
96 template <class Protocol>
97 class BasicUnixEndpoint : public BasicEndpoint <Protocol>
98 {
99 public:
103 constexpr BasicUnixEndpoint () noexcept
104 : BasicEndpoint <Protocol> ()
105 {
106 }
107
113 BasicUnixEndpoint (const struct sockaddr* addr, socklen_t len) noexcept
114 : BasicEndpoint <Protocol> (addr, len)
115 {
116 }
117
122 BasicUnixEndpoint (const char* dev) noexcept
124 {
125 struct sockaddr_un* sa = reinterpret_cast <struct sockaddr_un*> (&this->_addr);
126 strncpy (sa->sun_path, dev, sizeof (sa->sun_path) - 1);
127 }
128
133 BasicUnixEndpoint (const std::string& dev) noexcept
134 : BasicUnixEndpoint <Protocol> (dev.c_str ())
135 {
136 }
137
142 constexpr Protocol protocol () const noexcept
143 {
144 return Protocol ();
145 }
146
151 constexpr socklen_t length () const noexcept
152 {
153 return sizeof (struct sockaddr_un);
154 }
155
160 void device (const std::string& dev) noexcept
161 {
162 struct sockaddr_un* sa = reinterpret_cast <struct sockaddr_un*> (&this->_addr);
163 strncpy (sa->sun_path, dev.c_str (), sizeof (sa->sun_path) - 1);
164 }
165
170 std::string device () const
171 {
172 return reinterpret_cast <const struct sockaddr_un*> (&this->_addr)->sun_path;
173 }
174 };
175
182 template <class Protocol>
183 bool operator== (const BasicUnixEndpoint <Protocol>& a, const BasicUnixEndpoint <Protocol>& b) noexcept
184 {
185 return a.device () == b.device ();
186 }
187
194 template <class Protocol>
195 bool operator!= (const BasicUnixEndpoint <Protocol>& a, const BasicUnixEndpoint <Protocol>& b) noexcept
196 {
197 return !(a == b);
198 }
199
206 template <class Protocol>
207 bool operator< (const BasicUnixEndpoint <Protocol>& a, const BasicUnixEndpoint <Protocol>& b) noexcept
208 {
209 return a.device () < b.device ();
210 }
211
218 template <class Protocol>
219 bool operator> (const BasicUnixEndpoint <Protocol>& a, const BasicUnixEndpoint <Protocol>& b) noexcept
220 {
221 return b < a;
222 }
223
230 template <class Protocol>
231 bool operator<= (const BasicUnixEndpoint <Protocol>& a, const BasicUnixEndpoint <Protocol>& b) noexcept
232 {
233 return !(b < a);
234 }
235
242 template <class Protocol>
243 bool operator>= (const BasicUnixEndpoint <Protocol>& a, const BasicUnixEndpoint <Protocol>& b) noexcept
244 {
245 return !(a < b);
246 }
247
254 template <class Protocol>
255 std::ostream& operator<< (std::ostream& os, const BasicUnixEndpoint <Protocol>& endpoint)
256 {
257 os << endpoint.device ();
258 return os;
259 }
260
264 template <class Protocol>
265 class BasicNetlinkEndpoint : public BasicEndpoint <Protocol>
266 {
267 public:
271 constexpr BasicNetlinkEndpoint () noexcept
272 : BasicEndpoint <Protocol> ()
273 , _protocol (Protocol ().protocol ())
274 {
275 }
276
282 BasicNetlinkEndpoint (const struct sockaddr* addr, socklen_t len) noexcept
283 : BasicEndpoint <Protocol> (addr, len)
284 , _protocol (Protocol ().protocol ())
285 {
286 }
287
294 BasicNetlinkEndpoint (const Protocol& protocol, uint32_t pid, uint32_t groups) noexcept
295 : BasicEndpoint <Protocol> ()
296 , _protocol (protocol.protocol ())
297 {
298 struct sockaddr_nl* nl = reinterpret_cast <struct sockaddr_nl*> (&this->_addr);
299 nl->nl_pid = pid;
300 nl->nl_groups = groups;
301 }
302
308 BasicNetlinkEndpoint (uint32_t pid, uint32_t groups) noexcept
309 : BasicNetlinkEndpoint (Protocol (), pid, groups)
310 {
311 }
312
318 BasicNetlinkEndpoint (const Protocol& protocol, uint32_t groups) noexcept
319 : BasicNetlinkEndpoint (protocol, getpid (), groups)
320 {
321 }
322
327 BasicNetlinkEndpoint (uint32_t groups) noexcept
328 : BasicNetlinkEndpoint (Protocol (), getpid (), groups)
329 {
330 }
331
336 Protocol protocol () const noexcept
337 {
338 if (_protocol == NETLINK_NETFILTER)
339 {
340 return Protocol::nf ();
341 }
342 return Protocol::rt ();
343 }
344
349 constexpr socklen_t length () const noexcept
350 {
351 return sizeof (struct sockaddr_nl);
352 }
353
358 void pid (uint32_t pid) noexcept
359 {
360 reinterpret_cast <struct sockaddr_nl*> (&this->_addr)->nl_pid = pid;
361 }
362
367 uint32_t pid () const noexcept
368 {
369 return reinterpret_cast <const struct sockaddr_nl*> (&this->_addr)->nl_pid;
370 }
371
376 void groups (uint32_t groups) noexcept
377 {
378 reinterpret_cast <struct sockaddr_nl*> (&this->_addr)->nl_groups = groups;
379 }
380
385 uint32_t groups () const noexcept
386 {
387 return reinterpret_cast <const struct sockaddr_nl*> (&this->_addr)->nl_groups;
388 }
389
394 std::string device () const
395 {
396 return std::string ();
397 }
398
399 protected:
402 };
403
410 template <class Protocol>
411 bool operator== (const BasicNetlinkEndpoint <Protocol>& a, const BasicNetlinkEndpoint <Protocol>& b) noexcept
412 {
413 return a.pid () == b.pid () && a.groups () == b.groups ();
414 }
415
422 template <class Protocol>
423 bool operator!= (const BasicNetlinkEndpoint <Protocol>& a, const BasicNetlinkEndpoint <Protocol>& b) noexcept
424 {
425 return !(a == b);
426 }
427
434 template <class Protocol>
435 bool operator< (const BasicNetlinkEndpoint <Protocol>& a, const BasicNetlinkEndpoint <Protocol>& b) noexcept
436 {
437 if (a.pid () != b.pid ())
438 {
439 return a.pid () < b.pid ();
440 }
441 return a.groups () < b.groups ();
442 }
443
450 template <class Protocol>
451 bool operator> (const BasicNetlinkEndpoint <Protocol>& a, const BasicNetlinkEndpoint <Protocol>& b) noexcept
452 {
453 return b < a;
454 }
455
462 template <class Protocol>
463 bool operator<= (const BasicNetlinkEndpoint <Protocol>& a, const BasicNetlinkEndpoint <Protocol>& b) noexcept
464 {
465 return !(b < a);
466 }
467
474 template <class Protocol>
475 bool operator>= (const BasicNetlinkEndpoint <Protocol>& a, const BasicNetlinkEndpoint <Protocol>& b) noexcept
476 {
477 return !(a < b);
478 }
479
486 template <class Protocol>
487 std::ostream& operator<< (std::ostream& os, const BasicNetlinkEndpoint <Protocol>& endpoint)
488 {
489 os << "pid=" << endpoint.pid () << ",groups=" << endpoint.groups ();
490 return os;
491 }
492
496 template <class Protocol>
497 class BasicLinkLayerEndpoint : public BasicEndpoint <Protocol>
498 {
499 public:
504 : BasicEndpoint <Protocol> ()
505 {
506 reinterpret_cast <struct sockaddr_ll*> (&this->_addr)->sll_protocol = this->protocol ().protocol ();
507 }
508
514 BasicLinkLayerEndpoint (const struct sockaddr* addr, socklen_t len) noexcept
515 : BasicEndpoint <Protocol> (addr, len)
516 {
517 }
518
523 BasicLinkLayerEndpoint (const char* dev) noexcept
524 : BasicEndpoint <Protocol> ()
525 {
526 reinterpret_cast <struct sockaddr_ll*> (&this->_addr)->sll_ifindex = if_nametoindex (dev);
527 }
528
533 BasicLinkLayerEndpoint (const std::string& dev) noexcept
534 : BasicLinkLayerEndpoint <Protocol> (dev.c_str ())
535 {
536 }
537
542 constexpr Protocol protocol () const noexcept
543 {
544 return Protocol ();
545 }
546
551 constexpr socklen_t length () const noexcept
552 {
553 return sizeof (struct sockaddr_ll);
554 }
555
560 void device (const std::string& dev) noexcept
561 {
562 reinterpret_cast <struct sockaddr_ll*> (&this->_addr)->sll_ifindex = if_nametoindex (dev.c_str ());
563 }
564
569 std::string device () const
570 {
571 char ifname[IFNAMSIZ];
572 if (if_indextoname (reinterpret_cast <const struct sockaddr_ll*> (&this->_addr)->sll_ifindex, ifname))
573 {
574 return ifname;
575 }
576 return {};
577 }
578 };
579
586 template <class Protocol>
587 bool operator== (const BasicLinkLayerEndpoint <Protocol>& a, const BasicLinkLayerEndpoint <Protocol>& b) noexcept
588 {
589 return a.device () == b.device ();
590 }
591
598 template <class Protocol>
599 bool operator!= (const BasicLinkLayerEndpoint <Protocol>& a, const BasicLinkLayerEndpoint <Protocol>& b) noexcept
600 {
601 return !(a == b);
602 }
603
610 template <class Protocol>
611 bool operator< (const BasicLinkLayerEndpoint <Protocol>& a, const BasicLinkLayerEndpoint <Protocol>& b) noexcept
612 {
613 return a.device () < b.device ();
614 }
615
622 template <class Protocol>
623 bool operator> (const BasicLinkLayerEndpoint <Protocol>& a, const BasicLinkLayerEndpoint <Protocol>& b) noexcept
624 {
625 return b < a;
626 }
627
634 template <class Protocol>
635 bool operator<= (const BasicLinkLayerEndpoint <Protocol>& a, const BasicLinkLayerEndpoint <Protocol>& b) noexcept
636 {
637 return !(b < a);
638 }
639
646 template <class Protocol>
647 bool operator>= (const BasicLinkLayerEndpoint <Protocol>& a, const BasicLinkLayerEndpoint <Protocol>& b) noexcept
648 {
649 return !(a < b);
650 }
651
658 template <class Protocol>
659 std::ostream& operator<< (std::ostream& os, const BasicLinkLayerEndpoint <Protocol>& endpoint)
660 {
661 os << endpoint.device ();
662 return os;
663 }
664
668 template <class Protocol>
669 class BasicInternetEndpoint : public BasicEndpoint <Protocol>
670 {
671 public:
675 constexpr BasicInternetEndpoint () noexcept
676 : BasicEndpoint <Protocol> ()
677 {
678 }
679
684 BasicInternetEndpoint (const struct sockaddr* addr, socklen_t len) noexcept
685 : BasicEndpoint <Protocol> (addr, len)
686 {
687 }
688
694 BasicInternetEndpoint (const IpAddress& ip, uint16_t port = 0) noexcept
695 : BasicEndpoint <Protocol> ()
696 {
697 if (ip.family () == AF_INET6)
698 {
699 struct sockaddr_in6* sa = reinterpret_cast <struct sockaddr_in6*> (&this->_addr);
700 sa->sin6_family = AF_INET6;
701 sa->sin6_port = htons (port);
702 memcpy (&sa->sin6_addr, ip.addr (), ip.length ());
703 sa->sin6_scope_id = ip.scope ();
704 }
705 else
706 {
707 struct sockaddr_in* sa = reinterpret_cast <struct sockaddr_in*> (&this->_addr);
708 sa->sin_family = AF_INET;
709 sa->sin_port = htons (port);
710 memcpy (&sa->sin_addr, ip.addr (), ip.length ());
711 }
712 }
713
719 BasicInternetEndpoint (const std::string& ip, uint16_t port = 0)
720 : BasicInternetEndpoint <Protocol> (IpAddress (ip), port)
721 {
722 }
723
729 BasicInternetEndpoint (const char* ip, uint16_t port = 0)
730 : BasicInternetEndpoint <Protocol> (IpAddress (ip), port)
731 {
732 }
733
739 BasicInternetEndpoint (const Protocol& protocol, uint16_t port = 0) noexcept
740 : BasicEndpoint <Protocol> ()
741 {
742 if (protocol.family () == AF_INET6)
743 {
744 struct sockaddr_in6* sa = reinterpret_cast <struct sockaddr_in6*> (&this->_addr);
745 sa->sin6_family = AF_INET6;
746 sa->sin6_port = htons (port);
747 }
748 else
749 {
750 struct sockaddr_in* sa = reinterpret_cast <struct sockaddr_in*> (&this->_addr);
751 sa->sin_family = AF_INET;
752 sa->sin_port = htons (port);
753 }
754 }
755
760 void hostname (const std::string& hostname) noexcept
761 {
763 }
764
769 const std::string& hostname () const noexcept
770 {
771 return _hostname;
772 }
773
778 void ip (const IpAddress& ip) noexcept
779 {
780 if (ip.family () == AF_INET6)
781 {
782 struct sockaddr_in6* sa = reinterpret_cast <struct sockaddr_in6*> (&this->_addr);
783 sa->sin6_family = AF_INET6;
784 memcpy (&sa->sin6_addr, ip.addr (), ip.length ());
785 sa->sin6_scope_id = ip.scope ();
786 }
787 else
788 {
789 struct sockaddr_in* sa = reinterpret_cast <struct sockaddr_in*> (&this->_addr);
790 sa->sin_family = AF_INET;
791 memcpy (&sa->sin_addr, ip.addr (), ip.length ());
792 }
793 }
794
799 IpAddress ip () const noexcept
800 {
801 return *reinterpret_cast <const struct sockaddr*> (&this->_addr);
802 }
803
808 void port (uint16_t p) noexcept
809 {
810 if (this->_addr.ss_family == AF_INET6)
811 {
812 reinterpret_cast <struct sockaddr_in6*> (&this->_addr)->sin6_port = htons (p);
813 }
814 else
815 {
816 reinterpret_cast <struct sockaddr_in*> (&this->_addr)->sin_port = htons (p);
817 }
818 }
819
824 uint16_t port () const noexcept
825 {
826 if (this->_addr.ss_family == AF_INET6)
827 {
828 return ntohs (reinterpret_cast <const struct sockaddr_in6*> (&this->_addr)->sin6_port);
829 }
830 else
831 {
832 return ntohs (reinterpret_cast <const struct sockaddr_in*> (&this->_addr)->sin_port);
833 }
834 }
835
840 Protocol protocol () const noexcept
841 {
842 if (this->_addr.ss_family == AF_INET)
843 {
844 return Protocol::v4 ();
845 }
846 return Protocol::v6 ();
847 }
848
853 socklen_t length () const noexcept
854 {
855 if (this->_addr.ss_family == AF_INET)
856 {
857 return sizeof (struct sockaddr_in);
858 }
859 return sizeof (struct sockaddr_in6);
860 }
861
866 void device (const std::string& dev) noexcept
867 {
868 if (this->_addr.ss_family == AF_INET6)
869 {
870 reinterpret_cast <struct sockaddr_in6*> (&this->_addr)->sin6_scope_id = if_nametoindex (dev.c_str ());
871 }
872 }
873
878 std::string device () const
879 {
880 if (this->_addr.ss_family == AF_INET6)
881 {
882 char ifname[IFNAMSIZ];
883 if (if_indextoname (reinterpret_cast <const struct sockaddr_in6*> (&this->_addr)->sin6_scope_id, ifname))
884 {
885 return ifname;
886 }
887 }
888 return {};
889 }
890
891 protected:
893 std::string _hostname;
894 };
895
902 template <class Protocol>
903 bool operator== (const BasicInternetEndpoint <Protocol>& a, const BasicInternetEndpoint <Protocol>& b) noexcept
904 {
905 return a.ip () == b.ip () && a.port () == b.port ();
906 }
907
914 template <class Protocol>
915 bool operator!= (const BasicInternetEndpoint <Protocol>& a, const BasicInternetEndpoint <Protocol>& b) noexcept
916 {
917 return !(a == b);
918 }
919
926 template <class Protocol>
927 bool operator< (const BasicInternetEndpoint <Protocol>& a, const BasicInternetEndpoint <Protocol>& b) noexcept
928 {
929 return std::tie (a.ip (), a.port ()) < std::tie (b.ip (), b.port ());
930 }
931
938 template <class Protocol>
939 bool operator> (const BasicInternetEndpoint <Protocol>& a, const BasicInternetEndpoint <Protocol>& b) noexcept
940 {
941 return b < a;
942 }
943
950 template <class Protocol>
951 bool operator<= (const BasicInternetEndpoint <Protocol>& a, const BasicInternetEndpoint <Protocol>& b) noexcept
952 {
953 return !(b < a);
954 }
955
962 template <class Protocol>
963 bool operator>= (const BasicInternetEndpoint <Protocol>& a, const BasicInternetEndpoint <Protocol>& b) noexcept
964 {
965 return !(a < b);
966 }
967
974 template <class Protocol>
975 std::ostream& operator<< (std::ostream& os, const BasicInternetEndpoint <Protocol>& endpoint)
976 {
977 if (endpoint.protocol () == Protocol::v6 ())
978 os << "[" << endpoint.ip () << "]";
979 else
980 os << endpoint.ip ();
981 if (endpoint.port ())
982 os << ":" << endpoint.port ();
983 return os;
984 }
985}
986
987#endif
basic endpoint class.
Definition shared.hpp:613
constexpr BasicEndpoint() noexcept
default constructor.
Definition endpoint.hpp:55
const struct sockaddr * addr() const noexcept
get socket address.
Definition endpoint.hpp:83
struct sockaddr * addr() noexcept
get socket address.
Definition endpoint.hpp:74
struct sockaddr_storage _addr
socket address storage.
Definition endpoint.hpp:90
BasicEndpoint(const struct sockaddr *addr, socklen_t len) noexcept
create instance using socket address.
Definition endpoint.hpp:65
basic internet endpoint class.
Definition endpoint.hpp:670
void port(uint16_t p) noexcept
set endpoint port number.
Definition endpoint.hpp:808
std::string _hostname
endpoint hostname.
Definition endpoint.hpp:893
const std::string & hostname() const noexcept
get the endpoint hostname.
Definition endpoint.hpp:769
std::string device() const
get endpoint device name.
Definition endpoint.hpp:878
uint16_t port() const noexcept
get endpoint port number.
Definition endpoint.hpp:824
void device(const std::string &dev) noexcept
set endpoint device name.
Definition endpoint.hpp:866
BasicInternetEndpoint(const std::string &ip, uint16_t port=0)
create the endpoint instance.
Definition endpoint.hpp:719
IpAddress ip() const noexcept
get endpoint IP address.
Definition endpoint.hpp:799
BasicInternetEndpoint(const Protocol &protocol, uint16_t port=0) noexcept
create the endpoint instance.
Definition endpoint.hpp:739
BasicInternetEndpoint(const IpAddress &ip, uint16_t port=0) noexcept
create the endpoint instance.
Definition endpoint.hpp:694
Protocol protocol() const noexcept
get endpoint protocol.
Definition endpoint.hpp:840
BasicInternetEndpoint(const struct sockaddr *addr, socklen_t len) noexcept
create the endpoint instance.
Definition endpoint.hpp:684
void hostname(const std::string &hostname) noexcept
set endpoint hostname.
Definition endpoint.hpp:760
socklen_t length() const noexcept
get socket address length.
Definition endpoint.hpp:853
constexpr BasicInternetEndpoint() noexcept
default constructor.
Definition endpoint.hpp:675
BasicInternetEndpoint(const char *ip, uint16_t port=0)
create the endpoint instance.
Definition endpoint.hpp:729
void ip(const IpAddress &ip) noexcept
set endpoint IP address.
Definition endpoint.hpp:778
basic link layer endpoint class.
Definition endpoint.hpp:498
void device(const std::string &dev) noexcept
set endpoint device name.
Definition endpoint.hpp:560
constexpr Protocol protocol() const noexcept
get endpoint protocol.
Definition endpoint.hpp:542
BasicLinkLayerEndpoint(const struct sockaddr *addr, socklen_t len) noexcept
create instance using socket address.
Definition endpoint.hpp:514
constexpr socklen_t length() const noexcept
get socket address length.
Definition endpoint.hpp:551
BasicLinkLayerEndpoint() noexcept
default constructor.
Definition endpoint.hpp:503
std::string device() const
get endpoint device name.
Definition endpoint.hpp:569
BasicLinkLayerEndpoint(const char *dev) noexcept
create instance using device name.
Definition endpoint.hpp:523
BasicLinkLayerEndpoint(const std::string &dev) noexcept
create instance using device name.
Definition endpoint.hpp:533
basic netlink endpoint class.
Definition endpoint.hpp:266
uint32_t groups() const noexcept
get netlink groups.
Definition endpoint.hpp:385
uint32_t pid() const noexcept
get process id.
Definition endpoint.hpp:367
int _protocol
netlink protocol type.
Definition endpoint.hpp:401
void groups(uint32_t groups) noexcept
set netlink groups.
Definition endpoint.hpp:376
std::string device() const
get device name (not applicable for netlink).
Definition endpoint.hpp:394
constexpr BasicNetlinkEndpoint() noexcept
default constructor.
Definition endpoint.hpp:271
BasicNetlinkEndpoint(const struct sockaddr *addr, socklen_t len) noexcept
create instance using socket address.
Definition endpoint.hpp:282
BasicNetlinkEndpoint(uint32_t pid, uint32_t groups) noexcept
create instance using netlink groups.
Definition endpoint.hpp:308
BasicNetlinkEndpoint(const Protocol &protocol, uint32_t groups) noexcept
create instance using netlink groups.
Definition endpoint.hpp:318
Protocol protocol() const noexcept
get endpoint protocol.
Definition endpoint.hpp:336
constexpr socklen_t length() const noexcept
get socket address length.
Definition endpoint.hpp:349
BasicNetlinkEndpoint(const Protocol &protocol, uint32_t pid, uint32_t groups) noexcept
create instance using netlink groups.
Definition endpoint.hpp:294
void pid(uint32_t pid) noexcept
set process id.
Definition endpoint.hpp:358
BasicNetlinkEndpoint(uint32_t groups) noexcept
create instance using netlink groups.
Definition endpoint.hpp:327
basic unix endpoint class.
Definition endpoint.hpp:98
BasicUnixEndpoint(const char *dev) noexcept
create instance using device name.
Definition endpoint.hpp:122
BasicUnixEndpoint(const struct sockaddr *addr, socklen_t len) noexcept
create instance using socket address.
Definition endpoint.hpp:113
std::string device() const
get endpoint device name.
Definition endpoint.hpp:170
constexpr socklen_t length() const noexcept
get socket address length.
Definition endpoint.hpp:151
constexpr BasicUnixEndpoint() noexcept
default constructor.
Definition endpoint.hpp:103
BasicUnixEndpoint(const std::string &dev) noexcept
create instance using device name.
Definition endpoint.hpp:133
constexpr Protocol protocol() const noexcept
get endpoint protocol.
Definition endpoint.hpp:142
void device(const std::string &dev) noexcept
set endpoint device name.
Definition endpoint.hpp:160
IPv6, IPv4 address class.
Definition ipaddress.hpp:51
uint32_t scope() const
get the scope identifier of the address.
Definition ipaddress.cpp:1277
int family() const
get address family.
Definition ipaddress.cpp:1250
socklen_t length() const
get the size in byte of the internal address structure.
Definition ipaddress.cpp:1268
const void * addr() const
get the internal address structure.
Definition ipaddress.cpp:1259
Definition acceptor.hpp:32
bool operator<(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoint is lower.
Definition endpoint.hpp:207
bool operator>(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoint is greater.
Definition endpoint.hpp:219
bool operator!=(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoints are not equal.
Definition endpoint.hpp:195
bool operator>=(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoint is greater or equal.
Definition endpoint.hpp:243
std::ostream & operator<<(std::ostream &os, const BasicUnixEndpoint< Protocol > &endpoint)
push endpoint representation into a stream.
Definition endpoint.hpp:255
bool operator<=(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoint is lower or equal.
Definition endpoint.hpp:231
bool operator==(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoints are equal.
Definition endpoint.hpp:183