diff options
Diffstat (limited to 'cpp/src/Ice/Endpoint.cpp')
-rw-r--r-- | cpp/src/Ice/Endpoint.cpp | 69 |
1 files changed, 66 insertions, 3 deletions
diff --git a/cpp/src/Ice/Endpoint.cpp b/cpp/src/Ice/Endpoint.cpp index 2038dbdfb14..833af74472b 100644 --- a/cpp/src/Ice/Endpoint.cpp +++ b/cpp/src/Ice/Endpoint.cpp @@ -19,6 +19,7 @@ #include <Ice/UdpTransceiver.h> #include <Ice/Stream.h> #include <Ice/LocalException.h> +#include <sstream> using namespace std; using namespace Ice; @@ -117,6 +118,12 @@ IceInternal::UnknownEndpoint::streamWrite(Stream* s) const s->write(_rawBytes); } +string +IceInternal::UnknownEndpoint::toString() const +{ + return string(); +} + Short IceInternal::UnknownEndpoint::type() const { @@ -251,7 +258,7 @@ IceInternal::TcpEndpoint::TcpEndpoint(const string& ho, Int po, Int ti) : } IceInternal::TcpEndpoint::TcpEndpoint(const string& str) : - _port(10000), + _port(0), _timeout(-1) { const string delim = " \t\n\r"; @@ -352,6 +359,26 @@ IceInternal::TcpEndpoint::streamWrite(Stream* s) const s->endWriteEncaps(); } +string +IceInternal::TcpEndpoint::toString() const +{ + ostringstream s; + s << "tcp"; + if (_host != getLocalHost(true)) // TODO: Whether numeric or not should be configurable + { + s << " -h " << _host; + } + if (_port != 0) + { + s << " -p " << _port; + } + if (_timeout != -1) + { + s << " -t " << _timeout; + } + return s.str(); +} + Short IceInternal::TcpEndpoint::type() const { @@ -551,7 +578,7 @@ IceInternal::SslEndpoint::SslEndpoint(const string& ho, Int po, Int ti) : } IceInternal::SslEndpoint::SslEndpoint(const string& str) : - _port(10000), + _port(0), _timeout(-1) { const string delim = " \t\n\r"; @@ -652,6 +679,26 @@ IceInternal::SslEndpoint::streamWrite(Stream* s) const s->endWriteEncaps(); } +string +IceInternal::SslEndpoint::toString() const +{ + ostringstream s; + s << "tcp"; + if (_host != getLocalHost(true)) // TODO: Whether numeric or not should be configurable + { + s << " -h " << _host; + } + if (_port != 0) + { + s << " -p " << _port; + } + if (_timeout != -1) + { + s << " -t " << _timeout; + } + return s.str(); +} + Short IceInternal::SslEndpoint::type() const { @@ -850,7 +897,7 @@ IceInternal::UdpEndpoint::UdpEndpoint(const string& ho, Int po) : } IceInternal::UdpEndpoint::UdpEndpoint(const string& str) : - _port(10000) + _port(0) { const string delim = " \t\n\r"; @@ -941,6 +988,22 @@ IceInternal::UdpEndpoint::streamWrite(Stream* s) const s->endWriteEncaps(); } +string +IceInternal::UdpEndpoint::toString() const +{ + ostringstream s; + s << "tcp"; + if (_host != getLocalHost(true)) // TODO: Whether numeric or not should be configurable + { + s << " -h " << _host; + } + if (_port != 0) + { + s << " -p " << _port; + } + return s.str(); +} + Short IceInternal::UdpEndpoint::type() const { |