Merge branch 'master' into sam460ex

This commit is contained in:
François Revol
2013-03-09 03:50:12 +01:00
146 changed files with 8432 additions and 1291 deletions
+115
View File
@@ -0,0 +1,115 @@
/*
* Copyright 2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _KEY_H
#define _KEY_H
#include <DataIO.h>
#include <Message.h>
#include <ObjectList.h>
#include <String.h>
enum BKeyPurpose {
B_KEY_PURPOSE_ANY,
B_KEY_PURPOSE_GENERIC,
B_KEY_PURPOSE_KEYRING,
B_KEY_PURPOSE_WEB,
B_KEY_PURPOSE_NETWORK,
B_KEY_PURPOSE_VOLUME
};
enum BKeyType {
B_KEY_TYPE_ANY,
B_KEY_TYPE_GENERIC,
B_KEY_TYPE_PASSWORD,
B_KEY_TYPE_CERTIFICATE
};
class BKey {
public:
BKey();
BKey(BKeyPurpose purpose,
const char* identifier,
const char* secondaryIdentifier = NULL,
const uint8* data = NULL,
size_t length = 0);
BKey(BKey& other);
virtual ~BKey();
virtual BKeyType Type() const { return B_KEY_TYPE_GENERIC; };
void Unset();
status_t SetTo(BKeyPurpose purpose,
const char* identifier,
const char* secondaryIdentifier = NULL,
const uint8* data = NULL,
size_t length = 0);
void SetPurpose(BKeyPurpose purpose);
BKeyPurpose Purpose() const;
void SetIdentifier(const char* identifier);
const char* Identifier() const;
void SetSecondaryIdentifier(const char* identifier);
const char* SecondaryIdentifier() const;
status_t SetData(const uint8* data, size_t length);
size_t DataLength() const;
const uint8* Data() const;
status_t GetData(uint8* buffer, size_t bufferSize) const;
const char* Owner() const;
bigtime_t CreationTime() const;
virtual status_t Flatten(BMessage& message) const;
virtual status_t Unflatten(const BMessage& message);
BKey& operator=(const BKey& other);
bool operator==(const BKey& other) const;
bool operator!=(const BKey& other) const;
virtual void PrintToStream();
private:
friend class BKeyStore;
BKeyPurpose fPurpose;
BString fIdentifier;
BString fSecondaryIdentifier;
BString fOwner;
bigtime_t fCreationTime;
mutable BMallocIO fData;
};
class BPasswordKey : public BKey {
public:
BPasswordKey();
BPasswordKey(const char* password,
BKeyPurpose purpose, const char* identifier,
const char* secondaryIdentifier = NULL);
BPasswordKey(BPasswordKey& other);
virtual ~BPasswordKey();
virtual BKeyType Type() const { return B_KEY_TYPE_PASSWORD; };
status_t SetTo(const char* password,
BKeyPurpose purpose,
const char* identifier,
const char* secondaryIdentifier = NULL);
status_t SetPassword(const char* password);
const char* Password() const;
virtual void PrintToStream();
};
#endif // _KEY_H
+103
View File
@@ -0,0 +1,103 @@
/*
* Copyright 2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _KEY_STORE_H
#define _KEY_STORE_H
#include <Key.h>
class BKeyStore {
public:
BKeyStore();
virtual ~BKeyStore();
status_t GetKey(BKeyType type, const char* identifier,
BKey& key);
status_t GetKey(BKeyType type, const char* identifier,
const char* secondaryIdentifier, BKey& key);
status_t GetKey(BKeyType type, const char* identifier,
const char* secondaryIdentifier,
bool secondaryIdentifierOptional,
BKey& key);
status_t GetKey(const char* keyring,
BKeyType type, const char* identifier,
BKey& key);
status_t GetKey(const char* keyring,
BKeyType type, const char* identifier,
const char* secondaryIdentifier, BKey& key);
status_t GetKey(const char* keyring,
BKeyType type, const char* identifier,
const char* secondaryIdentifier,
bool secondaryIdentifierOptional,
BKey& key);
status_t AddKey(const BKey& key);
status_t AddKey(const char* keyring, const BKey& key);
status_t RemoveKey(const BKey& key);
status_t RemoveKey(const char* keyring, const BKey& key);
status_t GetNextKey(uint32& cookie, BKey& key);
status_t GetNextKey(BKeyType type, BKeyPurpose purpose,
uint32& cookie, BKey& key);
status_t GetNextKey(const char* keyring,
uint32& cookie, BKey& key);
status_t GetNextKey(const char* keyring,
BKeyType type, BKeyPurpose purpose,
uint32& cookie, BKey& key);
// Keyrings
status_t AddKeyring(const char* keyring);
status_t RemoveKeyring(const char* keyring);
status_t GetNextKeyring(uint32& cookie,
BString& keyring);
status_t SetUnlockKey(const char* keyring,
const BKey& key);
status_t RemoveUnlockKey(const char* keyring);
// Master keyring
status_t SetMasterUnlockKey(const BKey& key);
status_t RemoveMasterUnlockKey();
status_t AddKeyringToMaster(const char* keyring);
status_t RemoveKeyringFromMaster(const char* keyring);
status_t GetNextMasterKeyring(uint32& cookie,
BString& keyring);
// Locking
bool IsKeyringUnlocked(const char* keyring);
status_t LockKeyring(const char* keyring);
status_t LockMasterKeyring();
// Applications
status_t GetNextApplication(uint32& cookie,
BString& signature) const;
status_t GetNextApplication(const char* keyring,
uint32& cookie, BString& signature) const;
status_t RemoveApplication(const char* signature);
status_t RemoveApplication(const char* keyring,
const char* signature);
// Service functions
status_t GeneratePassword(BPasswordKey& password,
size_t length, uint32 flags);
float PasswordStrength(const char* password);
private:
status_t _SendKeyMessage(BMessage& message,
BMessage* reply) const;
};
#endif // _KEY_STORE_H
+1
View File
@@ -122,6 +122,7 @@ public:
float MaxContentWidth() const;
BMenuItem* FindMarked();
int32 FindMarkedIndex();
BMenu* Supermenu() const;
BMenuItem* Superitem() const;
+8
View File
@@ -36,8 +36,16 @@ private:
private:
int32 fCookie;
// The iteration cookie for next_dev()
// Initialized to 0
BMessenger* fTarget;
// BMessenger referring to the target to
// which the watching notification
// messages are sent. The object is
// allocated and owned by the roster,
// or NULL if not watching.
uint32 _reserved[3];
// FBC
};
+48
View File
@@ -0,0 +1,48 @@
/*
* Copyright 2012, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Michael Lotz, [email protected]
*/
#ifndef _KEY_STORE_DEFS_H
#define _KEY_STORE_DEFS_H
namespace BPrivate {
const char* kKeyStoreServerSignature
= "application/x-vnd.Haiku-keystore_server";
enum {
// Replies
KEY_STORE_SUCCESS = 'KRok',
KEY_STORE_ERROR = 'KRer',
KEY_STORE_RESULT = 'KRrs',
// KeyStore requests
KEY_STORE_GET_KEY = 'KgtK',
KEY_STORE_GET_NEXT_KEY = 'KgnK',
KEY_STORE_ADD_KEY = 'KadK',
KEY_STORE_REMOVE_KEY = 'KrmK',
KEY_STORE_ADD_KEYRING = 'KaKR',
KEY_STORE_REMOVE_KEYRING = 'KrKR',
KEY_STORE_GET_NEXT_KEYRING = 'KnKR',
KEY_STORE_SET_UNLOCK_KEY = 'KsuK',
KEY_STORE_REMOVE_UNLOCK_KEY = 'KruK',
KEY_STORE_ADD_KEYRING_TO_MASTER = 'KarM',
KEY_STORE_REMOVE_KEYRING_FROM_MASTER = 'KrrM',
KEY_STORE_GET_NEXT_MASTER_KEYRING = 'KnrM',
KEY_STORE_IS_KEYRING_UNLOCKED = 'KuKR',
KEY_STORE_LOCK_KEYRING = 'KlKR',
KEY_STORE_GET_NEXT_APPLICATION = 'KnKA',
KEY_STORE_REMOVE_APPLICATION = 'KrKA',
};
} // namespace BPrivate
#endif // _KEY_STORE_DEFS_H
+3 -1
View File
@@ -133,6 +133,7 @@ public:
float Height() const;
bool IsExpanded() const;
bool IsSelected() const;
private:
// Blows up into the debugger if the validation fails.
@@ -326,8 +327,9 @@ public:
// Does not delete row or children at this time.
// todo: Make delete row and children
void RemoveRow(BRow* row);
void UpdateRow(BRow* row);
bool SwapRows(int32 index1, int32 index2, BRow*
parentRow1 = NULL, BRow* parentRow2 = NULL);
void Clear();
// Appearance (DEPRECATED)