MCPcopy Create free account
hub / github.com/acl-dev/acl / get_ip

Method get_ip

lib_acl_cpp/samples/udp/server/udp_pkt.cpp:78–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78const char *udp_pkt::get_ip(void) const
79{
80 if (addr_.sa.sa.sa_family == AF_INET)
81 {
82 const struct sockaddr_in *in = &addr_.sa.in;
83 return inet_ntop(in->sin_family, &in->sin_addr,
84 const_cast<udp_pkt*>(this)->ipbuf_,
85 sizeof(ipbuf_));
86 }
87#ifdef AF_INET6
88 else if (addr_.sa.sa.sa_family == AF_INET6)
89 {
90 const struct sockaddr_in6 *in = &addr_.sa.in6;
91 return inet_ntop(in->sin6_family, &in->sin6_addr,
92 const_cast<udp_pkt*>(this)->ipbuf_,
93 sizeof(ipbuf_));
94 }
95#endif
96 else
97 {
98 logger_error("unkown sa_family=%d", addr_.sa.sa.sa_family);
99 return NULL;
100 }
101}
102
103udp_pkts::udp_pkts(size_t max)

Callers 6

test_helloFunction · 0.45
mioFunction · 0.45
show_slaveFunction · 0.45
testFunction · 0.45
print_slaves_slotsFunction · 0.45
test_slotsFunction · 0.45

Calls 1

inet_ntopFunction · 0.85

Tested by 2

test_helloFunction · 0.36
test_slotsFunction · 0.36