std::string RTPLibraryVersion::GetVersionString() const { char str[16]; RTP_SNPRINTF(str,16,"%d.%d.%d",majornr,minornr,debugnr); return std::string(str); }
std::string RTPByteAddress::GetAddressString() const { char str[16]; std::string s; for (int i = 0 ; i < addresslength ; i++) { RTP_SNPRINTF(str, 16, "%02X", (int)hostaddress[i]); s += std::string(str); } s += std::string(":"); RTP_SNPRINTF(str, 16, "%d",(int)port); s += std::string(str); return s; }
std::string RTPIPv6Address::GetAddressString() const { char str[48]; uint16_t ip16[8]; int i,j; for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((uint16_t)ip.s6_addr[i])<<8); ip16[j] |= ((uint16_t)ip.s6_addr[i+1]); } RTP_SNPRINTF(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X/%d",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7],(int)port); return std::string(str); }
std::string RTPGetErrorString(int errcode) { int i; if (errcode >= 0) return std::string("No error"); i = 0; while (ErrorDescriptions[i].code != 0) { if (ErrorDescriptions[i].code == errcode) return std::string(ErrorDescriptions[i].description); i++; } char str[16]; RTP_SNPRINTF(str,16,"(%d)",errcode); return std::string("Unknown error code") + std::string(str); }