version 1.74, 2007/09/07 18:05:46
|
version 1.81, 2008/02/06 20:50:45
|
|
|
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/String.h> | #include <Pegasus/Common/String.h> |
|
#include <Pegasus/Common/Array.h> |
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
#include <Pegasus/Common/Logger.h> | #include <Pegasus/Common/Logger.h> |
#include <Pegasus/Common/Network.h> | #include <Pegasus/Common/Network.h> |
|
|
#include <windows.h> | #include <windows.h> |
#endif | #endif |
| |
#if defined (PEGASUS_OS_TYPE_UNIX) || (PEGASUS_OS_VMS) |
#if defined (PEGASUS_OS_TYPE_UNIX) || \ |
|
defined (PEGASUS_OS_VMS) |
# include <unistd.h> | # include <unistd.h> |
# include <fcntl.h> // File locking | # include <fcntl.h> // File locking |
# define PEGASUS_UID_T uid_t | # define PEGASUS_UID_T uid_t |
|
|
char* buf = 0, | char* buf = 0, |
size_t buflen = 0); | size_t buflen = 0); |
| |
|
#if defined(PEGASUS_OS_ZOS) || \ |
|
defined(PEGASUS_OS_VMS) || \ |
|
defined(PEGASUS_ENABLE_IPV6) |
|
|
// The following 2 methods are wrappers around system functions | // The following 2 methods are wrappers around system functions |
// getaddrinfo/getnameinfo. | // getaddrinfo/getnameinfo. |
// In addition to calling corresponding system functions, these | // In addition to calling corresponding system functions, these |
|
|
size_t servlen, | size_t servlen, |
int flags); | int flags); |
| |
|
#endif |
|
|
// Gets IP address assosiated with hostName. af indicates the | // Gets IP address assosiated with hostName. af indicates the |
// type of address (ipv4 or ipv6) returned. | // type of address (ipv4 or ipv6) returned. |
static Boolean getHostIP(const String &hostName, int *af, String &hostIP); | static Boolean getHostIP(const String &hostName, int *af, String &hostIP); |
| |
// Gets IP address in binary form. af indicates the type of | // Gets IP address in binary form. af indicates the type of |
// address (ipv4 or ipv6) returned. Address will be copied to dst. | // address (ipv4 or ipv6) returned. Address will be copied to dst. |
static Boolean _acquireIP(const char* hostname, int *af, void *dst); |
static Boolean acquireIP(const char* hostname, int *af, void *dst); |
| |
/** | /** |
Returns true if IPv6 stack is active by checking return code from | Returns true if IPv6 stack is active by checking return code from |
|
|
static Boolean isIPv6StackActive(); | static Boolean isIPv6StackActive(); |
#endif | #endif |
| |
|
/** |
|
Returns all interface addresses. Both ip4 and ip6 interface addresses |
|
will be returned. |
|
*/ |
|
static Array<String> getInterfaceAddrs(); |
|
|
static Uint32 lookupPort( | static Uint32 lookupPort( |
const char * serviceName, | const char * serviceName, |
Uint32 defaultPort); | Uint32 defaultPort); |
|
|
| |
/** | /** |
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 uses non-reentrant functions and should only |
IMPORTANT: This method is not reentrant and not async signal safe. |
be called in a single-threaded program. |
It should only 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. |