From 0b195851725cd2b0982d26a108e7239eca6b2052 Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Thu, 9 Oct 2008 15:20:49 +0000 Subject: Make Address/TcpAddress manipulation portable; extend SystemInfo functions to Windows; resolves QPID-1325 git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@703179 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/SystemInfo.h | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'cpp/src/qpid/sys/SystemInfo.h') diff --git a/cpp/src/qpid/sys/SystemInfo.h b/cpp/src/qpid/sys/SystemInfo.h index 73c3ca3c17..5a116cf8ee 100644 --- a/cpp/src/qpid/sys/SystemInfo.h +++ b/cpp/src/qpid/sys/SystemInfo.h @@ -21,6 +21,9 @@ * */ +#include "qpid/sys/IntegerTypes.h" +#include "qpid/Address.h" + namespace qpid { namespace sys { @@ -28,17 +31,38 @@ namespace sys { * Retrieve information about the system we are running on. * Results may be dependent on OS/hardware. */ -class SystemInfo -{ - public: - /** Estimate available concurrency, e.g. number of CPU cores. +namespace SystemInfo { + /** + * Estimate available concurrency, e.g. number of CPU cores. * -1 means estimate not available on this platform. */ - static long concurrency(); -}; + long concurrency(); + + /** + * Get the local host name and set it in the specified TcpAddress. + * Returns false if it can't be obtained and sets errno to any error value. + */ + bool getLocalHostname (TcpAddress &address); -}} // namespace qpid::sys + void getLocalIpAddresses (uint16_t port, std::vector
&addrList); + /** + * Retrieve system identifiers and versions. This is information that can + * generally be retrieved via POSIX uname(). + * + * @param osName Receives the OS name; e.g., GNU/Linux or Windows + * @param nodeName Receives the nodename. This may or may not match the + * set hostname from getLocalHostname(). + * @param release Receives the OS release identifier. + * @param version Receives the OS release version (kernel, build, sp, etc.) + * @param machine Receives the hardware type. + */ + void getSystemId (std::string &osName, + std::string &nodeName, + std::string &release, + std::string &version, + std::string &machine); +}}} // namespace qpid::sys::SystemInfo #endif /*!QPID_SYS_SYSTEMINFO_H*/ -- cgit v1.2.1