void CSAuthenticated::handleStoredAssetIdsGet()
{
	_assetIdStream.reset(new std::stringstream());

	if (AssetClient::ptr client = _client.lock()) {
		AssetServer& server(client->getParentServer());
		
		std::string uuidStr(_currentRequest->getUUID());
		std::string prefix(uuidStr.substr(0, 3));
		_storage->getStoredAssetIDsWithPrefix(prefix, _assetIdStream, boost::bind(&CSAuthenticated::storedAssetIdsGetCompleted, this));
	}
}
Beispiel #2
0
        UUID UUID::RandomUUID()
        {
            char uuid[UUID_STR_SIZE];
            memset(uuid, 0, sizeof(uuid));

            int fd = fopen("/proc/sys/kernel/random/uuid", "r");

            if(fd)
            {
                fread(uuid, sizeof(uuid), sizeof(uuid), fd);
                fclose(fd);
            }
            Aws::String uuidStr(uuid);
            return UUID(uuidStr);
        }
Beispiel #3
0
String createCanonicalUUIDString()
{
#if PLATFORM(QT)
    QUuid uuid = QUuid::createUuid();
    String canonicalUuidStr = uuid.toString().mid(1, 36).toLower(); // remove opening and closing bracket and make it lower.
    ASSERT(canonicalUuidStr[uuidVersionIdentifierIndex] == uuidVersionRequired);
    return canonicalUuidStr;
#elif OS(WINDOWS)
    GUID uuid = { 0 };
    HRESULT hr = CoCreateGuid(&uuid);
    if (FAILED(hr))
        return String();
    wchar_t uuidStr[40];
    int num = StringFromGUID2(uuid, reinterpret_cast<LPOLESTR>(uuidStr), ARRAYSIZE(uuidStr));
    ASSERT(num == 39);
    String canonicalUuidStr = String(uuidStr + 1, num - 3).lower(); // remove opening and closing bracket and make it lower.
    ASSERT(canonicalUuidStr[uuidVersionIdentifierIndex] == uuidVersionRequired);
    return canonicalUuidStr;
#elif OS(DARWIN)
    CFUUIDRef uuid = CFUUIDCreate(0);
    CFStringRef uuidStrRef = CFUUIDCreateString(0, uuid);
    String uuidStr(uuidStrRef);
    CFRelease(uuidStrRef);
    CFRelease(uuid);
    String canonicalUuidStr = uuidStr.lower(); // make it lower.
    ASSERT(canonicalUuidStr[uuidVersionIdentifierIndex] == uuidVersionRequired);
    return canonicalUuidStr;
#elif OS(LINUX)
    FILE* fptr = fopen("/proc/sys/kernel/random/uuid", "r");
    if (!fptr)
        return String();
    char uuidStr[37];
    char* result = fgets(uuidStr, sizeof(uuidStr), fptr);
    fclose(fptr);
    if (!result)
        return String();
    String canonicalUuidStr = String(uuidStr).lower(); // make it lower.
    ASSERT(canonicalUuidStr[uuidVersionIdentifierIndex] == uuidVersionRequired);
    return canonicalUuidStr;
#else
    notImplemented();
    return String();
#endif
}