1*95eee1a3SMichael Lotz /* 2*95eee1a3SMichael Lotz * Copyright 2012, Michael Lotz, mmlr@mlotz.ch. All Rights Reserved. 3*95eee1a3SMichael Lotz * Distributed under the terms of the MIT License. 4*95eee1a3SMichael Lotz */ 5*95eee1a3SMichael Lotz #ifndef _KEYRING_H 6*95eee1a3SMichael Lotz #define _KEYRING_H 7*95eee1a3SMichael Lotz 8*95eee1a3SMichael Lotz 9*95eee1a3SMichael Lotz #include <Key.h> 10*95eee1a3SMichael Lotz #include <Message.h> 11*95eee1a3SMichael Lotz 12*95eee1a3SMichael Lotz 13*95eee1a3SMichael Lotz class Keyring { 14*95eee1a3SMichael Lotz public: 15*95eee1a3SMichael Lotz Keyring(const char* name, 16*95eee1a3SMichael Lotz const BMessage& data); 17*95eee1a3SMichael Lotz ~Keyring(); 18*95eee1a3SMichael Lotz 19*95eee1a3SMichael Lotz const char* Name() const { return fName; } 20*95eee1a3SMichael Lotz const BMessage& Data() const { return fData; } 21*95eee1a3SMichael Lotz 22*95eee1a3SMichael Lotz bool IsAccessible(); 23*95eee1a3SMichael Lotz 24*95eee1a3SMichael Lotz status_t FindKey(const BString& identifier, 25*95eee1a3SMichael Lotz const BString& secondaryIdentifier, 26*95eee1a3SMichael Lotz bool secondaryIdentifierOptional, 27*95eee1a3SMichael Lotz BMessage* _foundKeyMessage); 28*95eee1a3SMichael Lotz status_t FindKey(BKeyType type, BKeyPurpose purpose, 29*95eee1a3SMichael Lotz uint32 index, 30*95eee1a3SMichael Lotz BMessage& _foundKeyMessage); 31*95eee1a3SMichael Lotz 32*95eee1a3SMichael Lotz status_t AddKey(const BString& identifier, 33*95eee1a3SMichael Lotz const BString& secondaryIdentifier, 34*95eee1a3SMichael Lotz const BMessage& keyMessage); 35*95eee1a3SMichael Lotz status_t RemoveKey(const BString& identifier, 36*95eee1a3SMichael Lotz const BMessage& keyMessage); 37*95eee1a3SMichael Lotz 38*95eee1a3SMichael Lotz static int Compare(const Keyring* one, 39*95eee1a3SMichael Lotz const Keyring* two); 40*95eee1a3SMichael Lotz static int Compare(const BString* name, 41*95eee1a3SMichael Lotz const Keyring* keyring); 42*95eee1a3SMichael Lotz 43*95eee1a3SMichael Lotz private: 44*95eee1a3SMichael Lotz BString fName; 45*95eee1a3SMichael Lotz BMessage fData; 46*95eee1a3SMichael Lotz }; 47*95eee1a3SMichael Lotz 48*95eee1a3SMichael Lotz 49*95eee1a3SMichael Lotz #endif // _KEYRING_H 50