mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-02 17:50:53 +02:00
added Environment::nodeId()
This commit is contained in:
parent
b5b35cb173
commit
5ae8225ece
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Environment.h
|
// Environment.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/include/Poco/Environment.h#2 $
|
// $Id: //poco/1.3/Foundation/include/Poco/Environment.h#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Core
|
// Package: Core
|
||||||
@ -51,6 +51,8 @@ class Foundation_API Environment
|
|||||||
/// and some general system information.
|
/// and some general system information.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
typedef UInt8 NodeId[6]; /// Ethernet address.
|
||||||
|
|
||||||
static std::string get(const std::string& name);
|
static std::string get(const std::string& name);
|
||||||
/// Returns the value of the environment variable
|
/// Returns the value of the environment variable
|
||||||
/// with the given name. Throws a NotFoundException
|
/// with the given name. Throws a NotFoundException
|
||||||
@ -80,6 +82,18 @@ public:
|
|||||||
|
|
||||||
static std::string nodeName();
|
static std::string nodeName();
|
||||||
/// Returns the node (or host) name.
|
/// Returns the node (or host) name.
|
||||||
|
|
||||||
|
static void nodeId(NodeId& id);
|
||||||
|
/// Returns the Ethernet address of the first Ethernet
|
||||||
|
/// adapter found on the system.
|
||||||
|
///
|
||||||
|
/// Throws a SystemException if no Ethernet adapter is available.
|
||||||
|
|
||||||
|
static std::string nodeId();
|
||||||
|
/// Returns the Ethernet address (format "xx:xx:xx:xx:xx:xx")
|
||||||
|
/// of the first Ethernet adapter found on the system.
|
||||||
|
///
|
||||||
|
/// Throws a SystemException if no Ethernet adapter is available.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Environment_UNIX.h
|
// Environment_UNIX.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/include/Poco/Environment_UNIX.h#2 $
|
// $Id: //poco/1.3/Foundation/include/Poco/Environment_UNIX.h#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Core
|
// Package: Core
|
||||||
@ -51,6 +51,8 @@ namespace Poco {
|
|||||||
class Foundation_API EnvironmentImpl
|
class Foundation_API EnvironmentImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
typedef UInt8 NodeId[6]; /// Ethernet address.
|
||||||
|
|
||||||
static std::string getImpl(const std::string& name);
|
static std::string getImpl(const std::string& name);
|
||||||
static bool hasImpl(const std::string& name);
|
static bool hasImpl(const std::string& name);
|
||||||
static void setImpl(const std::string& name, const std::string& value);
|
static void setImpl(const std::string& name, const std::string& value);
|
||||||
@ -58,6 +60,7 @@ public:
|
|||||||
static std::string osVersionImpl();
|
static std::string osVersionImpl();
|
||||||
static std::string osArchitectureImpl();
|
static std::string osArchitectureImpl();
|
||||||
static std::string nodeNameImpl();
|
static std::string nodeNameImpl();
|
||||||
|
static void nodeIdImpl(NodeId& id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::map<std::string, std::string> StringMap;
|
typedef std::map<std::string, std::string> StringMap;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Environment_VMS.h
|
// Environment_VMS.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/include/Poco/Environment_VMS.h#2 $
|
// $Id: //poco/1.3/Foundation/include/Poco/Environment_VMS.h#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Core
|
// Package: Core
|
||||||
@ -50,6 +50,8 @@ namespace Poco {
|
|||||||
class Foundation_API EnvironmentImpl
|
class Foundation_API EnvironmentImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
typedef UInt8 NodeId[6]; /// Ethernet address.
|
||||||
|
|
||||||
static std::string getImpl(const std::string& name);
|
static std::string getImpl(const std::string& name);
|
||||||
static bool hasImpl(const std::string& name);
|
static bool hasImpl(const std::string& name);
|
||||||
static void setImpl(const std::string& name, const std::string& value);
|
static void setImpl(const std::string& name, const std::string& value);
|
||||||
@ -57,6 +59,7 @@ public:
|
|||||||
static std::string osVersionImpl();
|
static std::string osVersionImpl();
|
||||||
static std::string osArchitectureImpl();
|
static std::string osArchitectureImpl();
|
||||||
static std::string nodeNameImpl();
|
static std::string nodeNameImpl();
|
||||||
|
static void nodeIdImpl(NodeId& id);
|
||||||
|
|
||||||
static std::string getsyi(unsigned short code);
|
static std::string getsyi(unsigned short code);
|
||||||
/// a wrapper for $GETSYIW
|
/// a wrapper for $GETSYIW
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Environment_WIN32.h
|
// Environment_WIN32.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/include/Poco/Environment_WIN32.h#2 $
|
// $Id: //poco/1.3/Foundation/include/Poco/Environment_WIN32.h#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Core
|
// Package: Core
|
||||||
@ -49,6 +49,8 @@ namespace Poco {
|
|||||||
class Foundation_API EnvironmentImpl
|
class Foundation_API EnvironmentImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
typedef UInt8 NodeId[6]; /// Ethernet address.
|
||||||
|
|
||||||
static std::string getImpl(const std::string& name);
|
static std::string getImpl(const std::string& name);
|
||||||
static bool hasImpl(const std::string& name);
|
static bool hasImpl(const std::string& name);
|
||||||
static void setImpl(const std::string& name, const std::string& value);
|
static void setImpl(const std::string& name, const std::string& value);
|
||||||
@ -56,6 +58,7 @@ public:
|
|||||||
static std::string osVersionImpl();
|
static std::string osVersionImpl();
|
||||||
static std::string osArchitectureImpl();
|
static std::string osArchitectureImpl();
|
||||||
static std::string nodeNameImpl();
|
static std::string nodeNameImpl();
|
||||||
|
static void nodeIdImpl(NodeId& id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Environment_WIN32U.h
|
// Environment_WIN32U.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/include/Poco/Environment_WIN32U.h#2 $
|
// $Id: //poco/1.3/Foundation/include/Poco/Environment_WIN32U.h#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Core
|
// Package: Core
|
||||||
@ -49,6 +49,8 @@ namespace Poco {
|
|||||||
class Foundation_API EnvironmentImpl
|
class Foundation_API EnvironmentImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
typedef UInt8 NodeId[6]; /// Ethernet address.
|
||||||
|
|
||||||
static std::string getImpl(const std::string& name);
|
static std::string getImpl(const std::string& name);
|
||||||
static bool hasImpl(const std::string& name);
|
static bool hasImpl(const std::string& name);
|
||||||
static void setImpl(const std::string& name, const std::string& value);
|
static void setImpl(const std::string& name, const std::string& value);
|
||||||
@ -56,6 +58,7 @@ public:
|
|||||||
static std::string osVersionImpl();
|
static std::string osVersionImpl();
|
||||||
static std::string osArchitectureImpl();
|
static std::string osArchitectureImpl();
|
||||||
static std::string nodeNameImpl();
|
static std::string nodeNameImpl();
|
||||||
|
static void nodeIdImpl(NodeId& id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// File.h
|
// File.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/include/Poco/File.h#3 $
|
// $Id: //poco/1.3/Foundation/include/Poco/File.h#6 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Filesystem
|
// Package: Filesystem
|
||||||
@ -141,6 +141,12 @@ public:
|
|||||||
|
|
||||||
Timestamp created() const;
|
Timestamp created() const;
|
||||||
/// Returns the creation date of the file.
|
/// Returns the creation date of the file.
|
||||||
|
///
|
||||||
|
/// Not all platforms or filesystems (e.g. Linux and most Unix
|
||||||
|
/// platforms with the exception of FreeBSD and Mac OS X)
|
||||||
|
/// maintain the creation date of a file.
|
||||||
|
/// On such platforms, created() returns
|
||||||
|
/// the time of the last inode modification.
|
||||||
|
|
||||||
Timestamp getLastModified() const;
|
Timestamp getLastModified() const;
|
||||||
/// Returns the modification date of the file.
|
/// Returns the modification date of the file.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// UUIDGenerator.h
|
// UUIDGenerator.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/include/Poco/UUIDGenerator.h#2 $
|
// $Id: //poco/1.3/Foundation/include/Poco/UUIDGenerator.h#3 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: UUID
|
// Package: UUID
|
||||||
@ -45,6 +45,7 @@
|
|||||||
#include "Poco/Mutex.h"
|
#include "Poco/Mutex.h"
|
||||||
#include "Poco/Random.h"
|
#include "Poco/Random.h"
|
||||||
#include "Poco/Timestamp.h"
|
#include "Poco/Timestamp.h"
|
||||||
|
#include "Poco/Environment.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@ -100,12 +101,12 @@ protected:
|
|||||||
void getNode();
|
void getNode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FastMutex _mutex;
|
FastMutex _mutex;
|
||||||
Random _random;
|
Random _random;
|
||||||
Timestamp _lastTime;
|
Timestamp _lastTime;
|
||||||
int _ticks;
|
int _ticks;
|
||||||
UInt8 _node[6];
|
Environment::NodeId _node;
|
||||||
bool _haveNode;
|
bool _haveNode;
|
||||||
|
|
||||||
UUIDGenerator(const UUIDGenerator&);
|
UUIDGenerator(const UUIDGenerator&);
|
||||||
UUIDGenerator& operator = (const UUIDGenerator&);
|
UUIDGenerator& operator = (const UUIDGenerator&);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Environment.cpp
|
// Environment.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/src/Environment.cpp#2 $
|
// $Id: //poco/1.3/Foundation/src/Environment.cpp#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Core
|
// Package: Core
|
||||||
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Poco/Environment.h"
|
#include "Poco/Environment.h"
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_VMS)
|
#if defined(POCO_OS_FAMILY_VMS)
|
||||||
@ -102,4 +103,26 @@ std::string Environment::nodeName()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string Environment::nodeId()
|
||||||
|
{
|
||||||
|
NodeId id;
|
||||||
|
nodeId(id);
|
||||||
|
char result[18];
|
||||||
|
std::sprintf(result, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||||
|
id[0],
|
||||||
|
id[1],
|
||||||
|
id[2],
|
||||||
|
id[3],
|
||||||
|
id[4],
|
||||||
|
id[5]);
|
||||||
|
return std::string(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Environment::nodeId(NodeId& id)
|
||||||
|
{
|
||||||
|
return EnvironmentImpl::nodeIdImpl(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Environment_UNIX.cpp
|
// Environment_UNIX.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/src/Environment_UNIX.cpp#2 $
|
// $Id: //poco/1.3/Foundation/src/Environment_UNIX.cpp#3 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Core
|
// Package: Core
|
||||||
@ -118,3 +118,135 @@ std::string EnvironmentImpl::nodeNameImpl()
|
|||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// nodeIdImpl
|
||||||
|
//
|
||||||
|
#if defined(POCO_OS_FAMILY_BSD) || POCO_OS == POCO_OS_QNX
|
||||||
|
//
|
||||||
|
// BSD variants
|
||||||
|
//
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <ifaddrs.h>
|
||||||
|
#include <net/if_dl.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
|
void EnvironmentImpl::nodeIdImpl(NodeId& id)
|
||||||
|
{
|
||||||
|
struct ifaddrs* ifaphead;
|
||||||
|
int rc = getifaddrs(&ifaphead);
|
||||||
|
if (rc) throw SystemException("cannot get network adapter list");
|
||||||
|
|
||||||
|
bool foundAdapter = false;
|
||||||
|
for (struct ifaddrs* ifap = ifaphead; ifap; ifap = ifap->ifa_next)
|
||||||
|
{
|
||||||
|
if (ifap->ifa_addr && ifap->ifa_addr->sa_family == AF_LINK)
|
||||||
|
{
|
||||||
|
struct sockaddr_dl* sdl = reinterpret_cast<struct sockaddr_dl*>(ifap->ifa_addr);
|
||||||
|
caddr_t ap = (caddr_t) (sdl->sdl_data + sdl->sdl_nlen);
|
||||||
|
int alen = sdl->sdl_alen;
|
||||||
|
if (ap && alen > 0)
|
||||||
|
{
|
||||||
|
std::memcpy(&id, ap, sizeof(id));
|
||||||
|
foundAdapter = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
freeifaddrs(ifaphead);
|
||||||
|
if (!foundAdapter) throw SystemException("cannot determine MAC address (no suitable network adapter found)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Poco
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined(__CYGWIN__) || POCO_OS == POCO_OS_LINUX
|
||||||
|
//
|
||||||
|
// Linux, Cygwin
|
||||||
|
//
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
|
void EnvironmentImpl::nodeIdImpl(NodeId& id)
|
||||||
|
{
|
||||||
|
struct ifreq ifr;
|
||||||
|
|
||||||
|
int s = socket(PF_INET, SOCK_DGRAM, 0);
|
||||||
|
if (s == -1) throw SystemException("cannot open socket");
|
||||||
|
|
||||||
|
strcpy(ifr.ifr_name, "eth0");
|
||||||
|
int rc = ioctl(s, SIOCGIFHWADDR, &ifr);
|
||||||
|
close(s);
|
||||||
|
if (rc < 0) throw SystemException("cannot get MAC address");
|
||||||
|
struct sockaddr* sa = reinterpret_cast<struct sockaddr*>(&ifr.ifr_addr);
|
||||||
|
std::memcpy(&id, sa->sa_data, sizeof(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Poco
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined(POCO_OS_FAMILY_UNIX)
|
||||||
|
//
|
||||||
|
// General Unix
|
||||||
|
//
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#if defined(sun) || defined(__sun)
|
||||||
|
#include <sys/sockio.h>
|
||||||
|
#endif
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include <net/if_arp.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
|
void EnvironmentImpl::nodeIdImpl(NodeId& id)
|
||||||
|
{
|
||||||
|
char name[MAXHOSTNAMELEN];
|
||||||
|
if (gethostname(name, sizeof(name)))
|
||||||
|
throw SystemException("cannot get host name");
|
||||||
|
|
||||||
|
struct hostent* pHost = gethostbyname(name);
|
||||||
|
if (!pHost) throw SystemException("cannot get host IP address");
|
||||||
|
|
||||||
|
int s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
|
if (s == -1) throw SystemException("cannot open socket");
|
||||||
|
|
||||||
|
struct arpreq ar;
|
||||||
|
std::memset(&ar, 0, sizeof(ar));
|
||||||
|
struct sockaddr_in* pAddr = reinterpret_cast<struct sockaddr_in*>(&ar.arp_pa);
|
||||||
|
pAddr->sin_family = AF_INET;
|
||||||
|
std::memcpy(&pAddr->sin_addr, *pHost->h_addr_list, sizeof(struct in_addr));
|
||||||
|
int rc = ioctl(s, SIOCGARP, &ar);
|
||||||
|
close(s);
|
||||||
|
if (rc < 0) throw SystemException("cannot get MAC address");
|
||||||
|
std::memcpy(&id, ar.arp_ha.sa_data, sizeof(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Poco
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Environment_VMS.cpp
|
// Environment_VMS.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/src/Environment_VMS.cpp#2 $
|
// $Id: //poco/1.3/Foundation/src/Environment_VMS.cpp#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Core
|
// Package: Core
|
||||||
@ -43,6 +43,19 @@
|
|||||||
#include <syidef.h>
|
#include <syidef.h>
|
||||||
#include <iledef.h>
|
#include <iledef.h>
|
||||||
#include <lnmdef.h>
|
#include <lnmdef.h>
|
||||||
|
#include <ioctl.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include <inet.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include <net/if_arp.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define MAXHOSTNAMELEN 64
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@ -108,6 +121,30 @@ std::string EnvironmentImpl::nodeNameImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EnvironmentImpl::nodeIdImpl(NodeId& id)
|
||||||
|
{
|
||||||
|
char name[MAXHOSTNAMELEN];
|
||||||
|
if (gethostname(name, sizeof(name)))
|
||||||
|
throw SystemException("cannot get host name");
|
||||||
|
|
||||||
|
struct hostent* pHost = gethostbyname(name);
|
||||||
|
if (!pHost) throw SystemException("cannot get host IP address");
|
||||||
|
|
||||||
|
int s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
|
if (s == -1) throw SystemException("cannot open socket");
|
||||||
|
|
||||||
|
struct arpreq ar;
|
||||||
|
std::memset(&ar, 0, sizeof(ar));
|
||||||
|
struct sockaddr_in* pAddr = reinterpret_cast<struct sockaddr_in*>(&ar.arp_pa);
|
||||||
|
pAddr->sin_family = AF_INET;
|
||||||
|
std::memcpy(&pAddr->sin_addr, *pHost->h_addr_list, sizeof(struct in_addr));
|
||||||
|
int rc = ioctl(s, SIOCGARP, &ar);
|
||||||
|
close(s);
|
||||||
|
if (rc < 0) throw SystemException("cannot get MAC address");
|
||||||
|
std::memcpy(&id, ar.arp_ha.sa_data, sizeof(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string EnvironmentImpl::getsyi(unsigned short code)
|
std::string EnvironmentImpl::getsyi(unsigned short code)
|
||||||
{
|
{
|
||||||
#pragma pointer_size save
|
#pragma pointer_size save
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Environment_WIN32.cpp
|
// Environment_WIN32.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/src/Environment_WIN32.cpp#2 $
|
// $Id: //poco/1.3/Foundation/src/Environment_WIN32.cpp#4 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Core
|
// Package: Core
|
||||||
@ -38,6 +38,7 @@
|
|||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "Poco/UnWindows.h"
|
#include "Poco/UnWindows.h"
|
||||||
|
#include <iphlpapi.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@ -144,4 +145,50 @@ std::string EnvironmentImpl::nodeNameImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EnvironmentImpl::nodeIdImpl(NodeId& id)
|
||||||
|
{
|
||||||
|
PIP_ADAPTER_INFO pAdapterInfo;
|
||||||
|
PIP_ADAPTER_INFO pAdapter = 0;
|
||||||
|
ULONG len = sizeof(IP_ADAPTER_INFO);
|
||||||
|
pAdapterInfo = reinterpret_cast<IP_ADAPTER_INFO*>(new char[len]);
|
||||||
|
// Make an initial call to GetAdaptersInfo to get
|
||||||
|
// the necessary size into len
|
||||||
|
DWORD rc = GetAdaptersInfo(pAdapterInfo, &len);
|
||||||
|
if (rc == ERROR_BUFFER_OVERFLOW)
|
||||||
|
{
|
||||||
|
delete [] reinterpret_cast<char*>(pAdapterInfo);
|
||||||
|
pAdapterInfo = reinterpret_cast<IP_ADAPTER_INFO*>(new char[len]);
|
||||||
|
}
|
||||||
|
else if (rc != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
throw SystemException("cannot get network adapter list");
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
if (GetAdaptersInfo(pAdapterInfo, &len) == NO_ERROR)
|
||||||
|
{
|
||||||
|
pAdapter = pAdapterInfo;
|
||||||
|
while (pAdapter && !found)
|
||||||
|
{
|
||||||
|
if (pAdapter->Type == MIB_IF_TYPE_ETHERNET && pAdapter->AddressLength == sizeof(id))
|
||||||
|
{
|
||||||
|
std::memcpy(&id, pAdapter->Address, pAdapter->AddressLength);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
pAdapter = pAdapter->Next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else throw SystemException("cannot get network adapter list");
|
||||||
|
if (!found) throw SystemException("no Ethernet adapter found");
|
||||||
|
}
|
||||||
|
catch (Exception&)
|
||||||
|
{
|
||||||
|
delete [] reinterpret_cast<char*>(pAdapterInfo);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
delete [] reinterpret_cast<char*>(pAdapterInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Environment_WIN32U.cpp
|
// Environment_WIN32U.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/src/Environment_WIN32U.cpp#2 $
|
// $Id: //poco/1.3/Foundation/src/Environment_WIN32U.cpp#4 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Core
|
// Package: Core
|
||||||
@ -41,6 +41,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "Poco/UnWindows.h"
|
#include "Poco/UnWindows.h"
|
||||||
|
#include <iphlpapi.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@ -159,4 +160,50 @@ std::string EnvironmentImpl::nodeNameImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EnvironmentImpl::nodeIdImpl(NodeId& id)
|
||||||
|
{
|
||||||
|
PIP_ADAPTER_INFO pAdapterInfo;
|
||||||
|
PIP_ADAPTER_INFO pAdapter = 0;
|
||||||
|
ULONG len = sizeof(IP_ADAPTER_INFO);
|
||||||
|
pAdapterInfo = reinterpret_cast<IP_ADAPTER_INFO*>(new char[len]);
|
||||||
|
// Make an initial call to GetAdaptersInfo to get
|
||||||
|
// the necessary size into len
|
||||||
|
DWORD rc = GetAdaptersInfo(pAdapterInfo, &len);
|
||||||
|
if (rc == ERROR_BUFFER_OVERFLOW)
|
||||||
|
{
|
||||||
|
delete [] reinterpret_cast<char*>(pAdapterInfo);
|
||||||
|
pAdapterInfo = reinterpret_cast<IP_ADAPTER_INFO*>(new char[len]);
|
||||||
|
}
|
||||||
|
else if (rc != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
throw SystemException("cannot get network adapter list");
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
if (GetAdaptersInfo(pAdapterInfo, &len) == NO_ERROR)
|
||||||
|
{
|
||||||
|
pAdapter = pAdapterInfo;
|
||||||
|
while (pAdapter && !found)
|
||||||
|
{
|
||||||
|
if (pAdapter->Type == MIB_IF_TYPE_ETHERNET && pAdapter->AddressLength == sizeof(id))
|
||||||
|
{
|
||||||
|
std::memcpy(&id, pAdapter->Address, pAdapter->AddressLength);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
pAdapter = pAdapter->Next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else throw SystemException("cannot get network adapter list");
|
||||||
|
if (!found) throw SystemException("no Ethernet adapter found");
|
||||||
|
}
|
||||||
|
catch (Exception&)
|
||||||
|
{
|
||||||
|
delete [] reinterpret_cast<char*>(pAdapterInfo);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
delete [] reinterpret_cast<char*>(pAdapterInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// File_UNIX.cpp
|
// File_UNIX.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/src/File_UNIX.cpp#3 $
|
// $Id: //poco/1.3/Foundation/src/File_UNIX.cpp#10 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Filesystem
|
// Package: Filesystem
|
||||||
@ -38,7 +38,6 @@
|
|||||||
#include "Poco/Buffer.h"
|
#include "Poco/Buffer.h"
|
||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -46,6 +45,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@ -97,7 +97,7 @@ bool FileImpl::canReadImpl() const
|
|||||||
{
|
{
|
||||||
poco_assert (!_path.empty());
|
poco_assert (!_path.empty());
|
||||||
|
|
||||||
if(geteuid() == 0)
|
if (geteuid() == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -119,7 +119,7 @@ bool FileImpl::canWriteImpl() const
|
|||||||
{
|
{
|
||||||
poco_assert (!_path.empty());
|
poco_assert (!_path.empty());
|
||||||
|
|
||||||
if(geteuid() == 0)
|
if (geteuid() == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -209,9 +209,19 @@ Timestamp FileImpl::createdImpl() const
|
|||||||
{
|
{
|
||||||
poco_assert (!_path.empty());
|
poco_assert (!_path.empty());
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
struct stat64 st;
|
||||||
|
if (stat64(_path.c_str(), &st) == 0)
|
||||||
|
return Timestamp::fromEpochTime(st.st_birthtime);
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
struct stat st;
|
||||||
|
if (stat(_path.c_str(), &st) == 0)
|
||||||
|
return Timestamp::fromEpochTime(st.st_birthtime);
|
||||||
|
#else
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat(_path.c_str(), &st) == 0)
|
if (stat(_path.c_str(), &st) == 0)
|
||||||
return Timestamp::fromEpochTime(st.st_ctime);
|
return Timestamp::fromEpochTime(st.st_ctime);
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
handleLastErrorImpl(_path);
|
handleLastErrorImpl(_path);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// File_VMS.cpp
|
// File_VMS.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/src/File_VMS.cpp#3 $
|
// $Id: //poco/1.3/Foundation/src/File_VMS.cpp#4 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Filesystem
|
// Package: Filesystem
|
||||||
@ -186,7 +186,7 @@ Timestamp FileImpl::createdImpl() const
|
|||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat(_path.c_str(), &st) == 0)
|
if (stat(_path.c_str(), &st) == 0)
|
||||||
return Timestamp(st.st_mtime);
|
return Timestamp(st.st_ctime);
|
||||||
else
|
else
|
||||||
handleLastErrorImpl(_path);
|
handleLastErrorImpl(_path);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// UUIDGenerator.cpp
|
// UUIDGenerator.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/src/UUIDGenerator.cpp#2 $
|
// $Id: //poco/1.3/Foundation/src/UUIDGenerator.cpp#4 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: UUID
|
// Package: UUID
|
||||||
@ -62,7 +62,7 @@ UUID UUIDGenerator::create()
|
|||||||
|
|
||||||
if (!_haveNode)
|
if (!_haveNode)
|
||||||
{
|
{
|
||||||
getNode();
|
Environment::nodeId(_node);
|
||||||
_haveNode = true;
|
_haveNode = true;
|
||||||
}
|
}
|
||||||
Timestamp::UtcTimeVal tv = timeStamp();
|
Timestamp::UtcTimeVal tv = timeStamp();
|
||||||
@ -153,210 +153,3 @@ UUIDGenerator& UUIDGenerator::defaultGenerator()
|
|||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// platform-specific code below
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
|
||||||
//
|
|
||||||
// Windows
|
|
||||||
//
|
|
||||||
#include "Poco/UnWindows.h"
|
|
||||||
#include <iphlpapi.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
void UUIDGenerator::getNode()
|
|
||||||
{
|
|
||||||
PIP_ADAPTER_INFO pAdapterInfo;
|
|
||||||
PIP_ADAPTER_INFO pAdapter = 0;
|
|
||||||
ULONG len = sizeof(IP_ADAPTER_INFO);
|
|
||||||
pAdapterInfo = reinterpret_cast<IP_ADAPTER_INFO*>(new char[len]);
|
|
||||||
// Make an initial call to GetAdaptersInfo to get
|
|
||||||
// the necessary size into len
|
|
||||||
DWORD rc = GetAdaptersInfo(pAdapterInfo, &len);
|
|
||||||
if (rc == ERROR_BUFFER_OVERFLOW)
|
|
||||||
{
|
|
||||||
delete [] reinterpret_cast<char*>(pAdapterInfo);
|
|
||||||
pAdapterInfo = reinterpret_cast<IP_ADAPTER_INFO*>(new char[len]);
|
|
||||||
}
|
|
||||||
else if (rc != ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
throw SystemException("cannot get network adapter list");
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
bool found = false;
|
|
||||||
if (GetAdaptersInfo(pAdapterInfo, &len) == NO_ERROR)
|
|
||||||
{
|
|
||||||
pAdapter = pAdapterInfo;
|
|
||||||
while (pAdapter && !found)
|
|
||||||
{
|
|
||||||
if (pAdapter->Type == MIB_IF_TYPE_ETHERNET && pAdapter->AddressLength == sizeof(_node))
|
|
||||||
{
|
|
||||||
std::memcpy(_node, pAdapter->Address, pAdapter->AddressLength);
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
pAdapter = pAdapter->Next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else throw SystemException("cannot get network adapter list");
|
|
||||||
if (!found) throw SystemException("no Ethernet adapter found");
|
|
||||||
}
|
|
||||||
catch (Exception&)
|
|
||||||
{
|
|
||||||
delete [] reinterpret_cast<char*>(pAdapterInfo);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
delete [] reinterpret_cast<char*>(pAdapterInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
||||||
|
|
||||||
|
|
||||||
#elif defined(POCO_OS_FAMILY_BSD) || POCO_OS == POCO_OS_QNX
|
|
||||||
//
|
|
||||||
// BSD variants
|
|
||||||
//
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <ifaddrs.h>
|
|
||||||
#include <net/if_dl.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
void UUIDGenerator::getNode()
|
|
||||||
{
|
|
||||||
struct ifaddrs* ifaphead;
|
|
||||||
int rc = getifaddrs(&ifaphead);
|
|
||||||
if (rc) throw SystemException("cannot get network adapter list");
|
|
||||||
|
|
||||||
bool foundAdapter = false;
|
|
||||||
for (struct ifaddrs* ifap = ifaphead; ifap; ifap = ifap->ifa_next)
|
|
||||||
{
|
|
||||||
if (ifap->ifa_addr && ifap->ifa_addr->sa_family == AF_LINK)
|
|
||||||
{
|
|
||||||
struct sockaddr_dl* sdl = reinterpret_cast<struct sockaddr_dl*>(ifap->ifa_addr);
|
|
||||||
caddr_t ap = (caddr_t) (sdl->sdl_data + sdl->sdl_nlen);
|
|
||||||
int alen = sdl->sdl_alen;
|
|
||||||
if (ap && alen > 0)
|
|
||||||
{
|
|
||||||
std::memcpy(_node, ap, sizeof(_node));
|
|
||||||
foundAdapter = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
freeifaddrs(ifaphead);
|
|
||||||
if (!foundAdapter) throw SystemException("cannot determine MAC address (no suitable network adapter found)");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
||||||
|
|
||||||
|
|
||||||
#elif defined(__CYGWIN__) || POCO_OS == POCO_OS_LINUX
|
|
||||||
//
|
|
||||||
// Linux
|
|
||||||
//
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
void UUIDGenerator::getNode()
|
|
||||||
{
|
|
||||||
struct ifreq ifr;
|
|
||||||
|
|
||||||
int s = socket(PF_INET, SOCK_DGRAM, 0);
|
|
||||||
if (s == -1) throw SystemException("cannot open socket");
|
|
||||||
|
|
||||||
strcpy(ifr.ifr_name, "eth0");
|
|
||||||
int rc = ioctl(s, SIOCGIFHWADDR, &ifr);
|
|
||||||
close(s);
|
|
||||||
if (rc < 0) throw SystemException("cannot get MAC address");
|
|
||||||
struct sockaddr* sa = reinterpret_cast<struct sockaddr*>(&ifr.ifr_addr);
|
|
||||||
std::memcpy(_node, sa->sa_data, sizeof(_node));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
||||||
|
|
||||||
|
|
||||||
#elif defined(POCO_OS_FAMILY_UNIX) || defined(POCO_OS_FAMILY_VMS)
|
|
||||||
//
|
|
||||||
// Unix/VMS
|
|
||||||
//
|
|
||||||
#if defined(__VMS)
|
|
||||||
#include <ioctl.h>
|
|
||||||
#else
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#endif
|
|
||||||
#if defined(sun) || defined(__sun)
|
|
||||||
#include <sys/sockio.h>
|
|
||||||
#endif
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
#if defined(__VMS)
|
|
||||||
#include <inet.h>
|
|
||||||
#else
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#endif
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
#include <net/if_arp.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__VMS)
|
|
||||||
#define MAXHOSTNAMELEN 64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
|
|
||||||
|
|
||||||
void UUIDGenerator::getNode()
|
|
||||||
{
|
|
||||||
char name[MAXHOSTNAMELEN];
|
|
||||||
if (gethostname(name, sizeof(name)))
|
|
||||||
throw SystemException("cannot get host name");
|
|
||||||
|
|
||||||
struct hostent* pHost = gethostbyname(name);
|
|
||||||
if (!pHost) throw SystemException("cannot get host IP address");
|
|
||||||
|
|
||||||
int s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
|
||||||
if (s == -1) throw SystemException("cannot open socket");
|
|
||||||
|
|
||||||
struct arpreq ar;
|
|
||||||
std::memset(&ar, 0, sizeof(ar));
|
|
||||||
struct sockaddr_in* pAddr = reinterpret_cast<struct sockaddr_in*>(&ar.arp_pa);
|
|
||||||
pAddr->sin_family = AF_INET;
|
|
||||||
std::memcpy(&pAddr->sin_addr, *pHost->h_addr_list, sizeof(struct in_addr));
|
|
||||||
int rc = ioctl(s, SIOCGARP, &ar);
|
|
||||||
close(s);
|
|
||||||
if (rc < 0) throw SystemException("cannot get MAC address");
|
|
||||||
std::memcpy(_node, ar.arp_ha.sa_data, sizeof(_node));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// CoreTest.cpp
|
// CoreTest.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/testsuite/src/CoreTest.cpp#2 $
|
// $Id: //poco/1.3/Foundation/testsuite/src/CoreTest.cpp#4 $
|
||||||
//
|
//
|
||||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@ -143,6 +143,7 @@ void CoreTest::testEnvironment()
|
|||||||
std::cout << "OS Version: " << Environment::osVersion() << std::endl;
|
std::cout << "OS Version: " << Environment::osVersion() << std::endl;
|
||||||
std::cout << "OS Architecture: " << Environment::osArchitecture() << std::endl;
|
std::cout << "OS Architecture: " << Environment::osArchitecture() << std::endl;
|
||||||
std::cout << "Node Name: " << Environment::nodeName() << std::endl;
|
std::cout << "Node Name: " << Environment::nodeName() << std::endl;
|
||||||
|
std::cout << "Node ID: " << Environment::nodeId() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// PathTest.cpp
|
// PathTest.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/svn/Foundation/testsuite/src/PathTest.cpp#2 $
|
// $Id: //poco/1.3/Foundation/testsuite/src/PathTest.cpp#2 $
|
||||||
//
|
//
|
||||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@ -822,7 +822,7 @@ void PathTest::testParseWindows4()
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
p.parse("ü:\\", Path::PATH_WINDOWS);
|
p.parse("~:\\", Path::PATH_WINDOWS);
|
||||||
fail("bad path - must throw exception");
|
fail("bad path - must throw exception");
|
||||||
}
|
}
|
||||||
catch (PathSyntaxException&)
|
catch (PathSyntaxException&)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user