version 1.68.4.6, 2008/02/13 08:30:11
|
version 1.69, 2007/05/30 20:41:28
|
|
|
#endif | #endif |
#endif | #endif |
| |
#if defined (PEGASUS_OS_TYPE_UNIX) || \ |
#if defined (PEGASUS_OS_TYPE_UNIX) || (PEGASUS_OS_VMS) |
defined (PEGASUS_OS_VMS) |
|
# ifndef PEGASUS_OS_OS400 | # ifndef PEGASUS_OS_OS400 |
# include <unistd.h> | # include <unistd.h> |
# endif | # endif |
|
|
# define PEGASUS_GID_T Uint32 | # define PEGASUS_GID_T Uint32 |
#endif | #endif |
| |
#if defined(PEGASUS_OS_TYPE_WINDOWS) |
|
# define PEGASUS_SYSTEM_ERRORMSG_NLS \ |
|
System::getErrorMSG_NLS(GetLastError(),0) |
|
# define PEGASUS_SYSTEM_NETWORK_ERRORMSG_NLS \ |
|
System::getErrorMSG_NLS(WSAGetLastError(),0) |
|
# define PEGASUS_SYSTEM_ERRORMSG \ |
|
System::getErrorMSG(GetLastError(),0) |
|
# define PEGASUS_SYSTEM_NETWORK_ERRORMSG \ |
|
System::getErrorMSG(WSAGetLastError(),0) |
|
#elif defined(PEGASUS_OS_ZOS) |
|
# define PEGASUS_SYSTEM_ERRORMSG_NLS \ |
|
System::getErrorMSG_NLS(errno,__errno2()) |
|
# define PEGASUS_SYSTEM_NETWORK_ERRORMSG_NLS \ |
|
System::getErrorMSG_NLS(errno,__errno2()) |
|
# define PEGASUS_SYSTEM_ERRORMSG \ |
|
System::getErrorMSG(errno,__errno2()) |
|
# define PEGASUS_SYSTEM_NETWORK_ERRORMSG \ |
|
System::getErrorMSG(errno,__errno2()) |
|
#else |
|
# define PEGASUS_SYSTEM_ERRORMSG_NLS \ |
|
System::getErrorMSG_NLS(errno,0) |
|
# define PEGASUS_SYSTEM_NETWORK_ERRORMSG_NLS \ |
|
System::getErrorMSG_NLS(errno,0) |
|
# define PEGASUS_SYSTEM_ERRORMSG \ |
|
System::getErrorMSG(errno,0) |
|
# define PEGASUS_SYSTEM_NETWORK_ERRORMSG \ |
|
System::getErrorMSG(errno,0) |
|
#endif |
|
|
|
// | // |
// Protocal Type | // Protocal Type |
// | // |
|
|
class PEGASUS_COMMON_LINKAGE System | class PEGASUS_COMMON_LINKAGE System |
{ | { |
public: | public: |
|
|
/* Creates a String object containing the system message |
|
from the errno and if supported from a second level error |
|
number. The _NLS Method is looking up an internationalized version of |
|
the message. |
|
@param errorCode The system errno. |
|
@param errorCode2 The secondary error number like errno2 on z/OS |
|
*/ |
|
static String getErrorMSG_NLS(int errorCode,int errorCode2); |
|
static String getErrorMSG(int errorCode,int errorCode2); |
|
|
|
/** getCurrentTime - Gets the current time as seconds and milliseconds | /** getCurrentTime - Gets the current time as seconds and milliseconds |
into the provided variables using system functions. | into the provided variables using system functions. |
@param seconds Return for the seconds component of the time. | @param seconds Return for the seconds component of the time. |
|
|
static String getHostName(); | static String getHostName(); |
static String getFullyQualifiedHostName (); | static String getFullyQualifiedHostName (); |
static String getSystemCreationClassName (); | static String getSystemCreationClassName (); |
|
static String getHostIP(const String &hostName); |
| |
// Gets IP address assosiated with hostName. af indicates the |
static Uint32 _acquireIP(const char* hostname); |
// type of address (ipv4 or ipv6) returned. |
|
static Boolean getHostIP(const String &hostName, int *af, String &hostIP); |
|
|
|
// Gets IP address in binary form. af indicates the type of |
|
// address (ipv4 or ipv6) returned. Address will be copied to dst. |
|
static Boolean _acquireIP(const char* hostname, int *af, void *dst); |
|
|
|
/** |
|
Returns true if IPv6 stack is active by checking return code from |
|
Socket::createSocket() and getSocketError() calls. |
|
|
|
ATTN: We return true if some error other than |
|
PEGASUS_INVALID_ADDRESS_FAMILY is returned while creating the socket |
|
because we will not be sure whether the IPv6 stack is active or not |
|
from the returned error code. Return value of "true" from this method |
|
should not be trusted absolutely. |
|
*/ |
|
#ifdef PEGASUS_ENABLE_IPV6 |
|
static Boolean isIPv6StackActive(); |
|
#endif |
|
| |
static Uint32 lookupPort( | static Uint32 lookupPort( |
const char * serviceName, | const char * serviceName, |
Uint32 defaultPort); | Uint32 defaultPort); |
| |
/** | /** |
|
Attempts to validate that the input hostName represents the same host as |
|
the host represented by the value returned by the |
|
getFullyQualifiedHostName() method. |
|
|
|
@param hostName the host name to validate |
|
|
|
@return True if the input hostName can be validated to represent the |
|
same host; |
|
False otherwise |
|
*/ |
|
static Boolean sameHost (const String & hostName); |
|
|
|
/** |
Attempts to find the given IP address(32bit) on any of the local defined | Attempts to find the given IP address(32bit) on any of the local defined |
network interfaces | network interfaces |
*/ | */ |
|
|
*/ | */ |
static Boolean isLocalHost(const String& hostName); | static Boolean isLocalHost(const String& hostName); |
| |
/** |
|
Checks binIPAddress represented by address family and returns true |
|
if binary representation matches with loopback ip address. binIPAddress |
|
must be in host-byte order. |
|
*/ |
|
static Boolean isLoopBack(int af, void *binIPAddress); |
|
|
|
static String getEffectiveUserName(); | static String getEffectiveUserName(); |
| |
/** | /** |
|
|
| |
/** | /** |
Changes the process user context to the specified user and group. | Changes the process user context to the specified user and group. |
IMPORTANT: This method is not reentrant and not async signal safe. |
IMPORTANT: This method uses non-reentrant functions and should only |
It should only be called in a single-threaded program. |
be called in a single-threaded program. |
@param userName User name to set as the process user context. | @param userName User name to set as the process user context. |
@param uid User ID to set as the process user context. | @param uid User ID to set as the process user context. |
@param gid Group ID to set as the process group context. | @param gid Group ID to set as the process group context. |