1 #ifndef POSIXX_LINUX_TIPC_PRINT_HPP_
2 #define POSIXX_LINUX_TIPC_PRINT_HPP_
4 #include "../tipc.hpp" // posixx::linux::tipc::sockaddr
5 #include <ostream> // std::ostream
8 std::ostream& operator << (std::ostream& os,
9 const posixx::linux::tipc::addr& a) throw()
11 return os << a.zone() << "." << a.cluster() << "." << a.node();
15 std::ostream& operator << (std::ostream& os,
16 const posixx::linux::tipc::portid& p) throw()
18 return os << "portid(" << p.ref << ", " << p.node
19 << " [" << p.node_addr() << "])";
23 std::ostream& operator << (std::ostream& os,
24 const posixx::linux::tipc::name& n) throw()
26 return os << "name(" << n.type << ", " << n.instance << ")";
30 std::ostream& operator << (std::ostream& os,
31 const posixx::linux::tipc::nameseq& ns) throw()
33 return os << "nameseq(" << ns.type << ", " << ns.lower << ", "
38 std::ostream& operator << (std::ostream& os,
39 const posixx::linux::tipc::subscr& s) throw()
41 using namespace posixx::linux::tipc;
43 bool has_filter = false;
45 os << "subscr(" << s.name_seq() << ", " << s.timeout << ", ";
48 if (s.filter & SUB_PORTS) {
52 if (s.filter & SUB_SERVICE) {
60 if (s.filter & SUB_CANCEL) {
71 os << ", '" << std::string(s.usr_handle, sizeof(s.usr_handle)) << "')";
78 std::ostream& operator << (std::ostream& os,
79 const posixx::linux::tipc::subscr_event& e) throw()
81 using namespace posixx::linux::tipc;
82 os << "subscr_event(" << e.event << "[";
83 if (e.event == PUBLISHED)
85 else if (e.event == WITHDRAWN)
87 else if (e.event == TIMEOUT)
89 return os << "], " << e.found_lower << ", " << e.found_upper << ", "
90 << e.port_id() << ", " << e.subscription() << ")";
94 std::ostream& operator << (std::ostream& os,
95 const posixx::linux::tipc::sockaddr& sa) throw()
97 using namespace posixx::linux::tipc;
98 os << "sockaddr(" << sa.family << ", " << unsigned(sa.scope) << ", ";
101 else if (sa.type() == NAME)
102 os << sa.port_name() << ", " << sa.name_domain();
103 else if (sa.type() == NAMESEQ)
106 os << "[UNKNOW addrtype=" << sa.addrtype << "]";
110 #endif // POSIXX_LINUX_TIPC_PRINT_HPP_