/*********************************************************************** * * Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; version 2.1 * of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, Novell, Inc. * * To contact Novell about this file by physical or electronic mail, * you may find current contact information at www.novell.com. * ***********************************************************************/ #ifndef _CASA_GNOME_KEYRING_H #define _CASA_GNOME_KEYRING_H #include #include typedef enum { CASA_GNOME_KEYRING_RESULT_OK, CASA_GNOME_KEYRING_RESULT_DENIED, CASA_GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON, CASA_GNOME_KEYRING_RESULT_ALREADY_UNLOCKED, CASA_GNOME_KEYRING_RESULT_NO_SUCH_KEYRING, CASA_GNOME_KEYRING_RESULT_BAD_ARGUMENTS, CASA_GNOME_KEYRING_RESULT_IO_ERROR, CASA_GNOME_KEYRING_RESULT_CANCELLED, CASA_GNOME_KEYRING_RESULT_ALREADY_EXISTS } CASA_GnomeKeyringResult_T; #define GNOME_KEYRING_RESULT_OK CASA_GNOME_KEYRING_RESULT_OK #define GNOME_KEYRING_RESULT_DENIED CASA_GNOME_KEYRING_RESULT_DENIED #define GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON CASA_GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON #define GNOME_KEYRING_RESULT_ALREADY_UNLOCKED CASA_GNOME_KEYRING_RESULT_ALREADY_UNLOCKED #define GNOME_KEYRING_RESULT_NO_SUCH_KEYRING CASA_GNOME_KEYRING_RESULT_NO_SUCH_KEYRING #define GNOME_KEYRING_RESULT_BAD_ARGUMENTS CASA_GNOME_KEYRING_RESULT_BAD_ARGUMENTS #define GNOME_KEYRING_RESULT_IO_ERROR CASA_GNOME_KEYRING_RESULT_IO_ERROR #define GNOME_KEYRING_RESULT_CANCELLED CASA_GNOME_KEYRING_RESULT_CANCELLED #define GNOME_KEYRING_RESULT_ALREADY_EXISTS CASA_GNOME_KEYRING_RESULT_ALREADY_EXISTS #define GnomeKeyringResult CASA_GnomeKeyringResult_T typedef enum { CASA_GNOME_KEYRING_ITEM_GENERIC_SECRET, CASA_GNOME_KEYRING_ITEM_NETWORK_PASSWORD, CASA_GNOME_KEYRING_ITEM_NOTE, CASA_GNOME_KEYRING_ITEM_LAST_TYPE, CASA_GNOME_KEYRING_ITEM_NO_TYPE = 0xffffffff, } CASA_GnomeKeyringItemType_T; #define GNOME_KEYRING_ITEM_GENERIC_SECRET CASA_GNOME_KEYRING_ITEM_GENERIC_SECRET #define GNOME_KEYRING_ITEM_NETWORK_PASSWORD CASA_GNOME_KEYRING_ITEM_NETWORK_PASSWORD #define GNOME_KEYRING_ITEM_NOTE CASA_GNOME_KEYRING_ITEM_NOTE #define GNOME_KEYRING_ITEM_LAST_TYPE CASA_GNOME_KEYRING_ITEM_LAST_TYPE #define GNOME_KEYRING_ITEM_NO_TYPE CASA_GNOME_KEYRING_ITEM_NO_TYPE #define GnomeKeyringItemType CASA_GnomeKeyringItemType_T typedef enum { CASA_GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, CASA_GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 } CASA_GnomeKeyringAttributeType_T; #define GNOME_KEYRING_ATTRIBUTE_TYPE_STRING CASA_GNOME_KEYRING_ATTRIBUTE_TYPE_STRING #define GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 CASA_GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32 #define GnomeKeyringAttributeType CASA_GnomeKeyringAttributeType_T typedef struct GnomeKeyringAccessControl CASA_GnomeKeyringAccessControl_T; typedef struct GnomeKeyringApplicationRef CASA_GnomeKeyringApplicationRef_T; typedef GArray CASA_GnomeKeyringAttributeList_T; #define GnomeKeyringAccessControl CASA_GnomeKeyringAccessControl_T #define GnomeKeyringApplicationRef CASA_GnomeKeyringApplicationRef_T #define GnomeKeyringAttributeList CASA_GnomeKeyringAttributeList_T typedef enum { CASA_GNOME_KEYRING_ACCESS_READ = 1<<0, CASA_GNOME_KEYRING_ACCESS_WRITE = 1<<1, CASA_GNOME_KEYRING_ACCESS_REMOVE = 1<<2 } CASA_GnomeKeyringAccessType_T; #define GNOME_KEYRING_ACCESS_READ CASA_GNOME_KEYRING_ACCESS_READ #define GNOME_KEYRING_ACCESS_WRITE CASA_GNOME_KEYRING_ACCESS_WRITE #define GNOME_KEYRING_ACCESS_REMOVE CASA_GNOME_KEYRING_ACCESS_REMOVE #define GnomeKeyringAccessType CASA_GnomeKeyringAccessType_T typedef struct GnomeKeyringInfo CASA_GnomeKeyringInfo_T; typedef struct GnomeKeyringItemInfo CASA_GnomeKeyringItemInfo_T; #define GnomeKeyringInfo CASA_GnomeKeyringInfo_T #define GnomeKeyringItemInfo CASA_GnomeKeyringItemInfo_T typedef struct { char *name; CASA_GnomeKeyringAttributeType_T type; union { char *string; guint32 integer; } value; } CASA_GnomeKeyringAttribute_T; #define GnomeKeyringAttribute CASA_GnomeKeyringAttribute_T typedef struct { char *keyring; guint item_id; CASA_GnomeKeyringAttributeList_T *attributes; char *secret; } CASA_GnomeKeyringFound_T; #define GnomeKeyringFound CASA_GnomeKeyringFound_T typedef void (*CASA_GnomeKeyringOperationDoneCallback_T) ( CASA_GnomeKeyringResult_T result, gpointer data ); #define GnomeKeyringOperationDoneCallback CASA_GnomeKeyringOperationDoneCallback_T typedef void (*CASA_GnomeKeyringOperationGetStringCallback_T) ( CASA_GnomeKeyringResult_T result, const char *string, gpointer data ); #define GnomeKeyringOperationGetStringCallback CASA_GnomeKeyringOperationGetStringCallback_T typedef void (*CASA_GnomeKeyringOperationGetIntCallback_T) ( CASA_GnomeKeyringResult_T result, guint32 val, gpointer data ); #define GnomeKeyringOperationGetIntCallback CASA_GnomeKeyringOperationGetIntCallback_T typedef void (*CASA_GnomeKeyringOperationGetListCallback_T) ( CASA_GnomeKeyringResult_T result, GList *list, gpointer data ); #define GnomeKeyringOperationGetListCallback CASA_GnomeKeyringOperationGetListCallback_T typedef void (*CASA_GnomeKeyringOperationGetKeyringInfoCallback_T) ( CASA_GnomeKeyringResult_T result, CASA_GnomeKeyringInfo_T *info, gpointer data ); #define GnomeKeyringOperationGetKeyringInfoCallback CASA_GnomeKeyringOperationGetKeyringInfoCallback_T typedef void (*CASA_GnomeKeyringOperationGetItemInfoCallback_T) ( CASA_GnomeKeyringResult_T result, CASA_GnomeKeyringItemInfo_T*info, gpointer data ); #define GnomeKeyringOperationGetItemInfoCallback CASA_GnomeKeyringOperationGetItemInfoCallback_T typedef void (*CASA_GnomeKeyringOperationGetAttributesCallback_T) ( CASA_GnomeKeyringResult_T result, CASA_GnomeKeyringAttributeList_T *attributes, gpointer data ); #define GnomeKeyringOperationGetAttributesCallback CASA_GnomeKeyringOperationGetAttributesCallback_T #define CASA_gnome_keyring_attribute_list_index(a, i) g_array_index ((a), GnomeKeyringAttribute, (i)) #define gnome_keyring_attribute_list_index CASA_gnome_keyring_attribute_list_index #define CASA_gnome_keyring_attribute_list_new() (g_array_new (FALSE, FALSE, sizeof (GnomeKeyringAttribute))) #define gnome_keyring_attribute_list_new CASA_gnome_keyring_attribute_list_new void CASA_gnome_keyring_attribute_list_append_string ( CASA_GnomeKeyringAttributeList_T *attributes, const char *attribute, const char *value ); #define gnome_keyring_attribute_list_append_string CASA_gnome_keyring_attribute_list_append_string void CASA_gnome_keyring_attribute_list_append_uint32 ( CASA_GnomeKeyringAttributeList_T *attributes, const char *attribute, guint32 value ); #define gnome_keyring_attribute_list_append_uint32 CASA_gnome_keyring_attribute_list_append_uint32 GnomeKeyringAttributeList *CASA_gnome_keyring_attribute_list_copy ( CASA_GnomeKeyringAttributeList_T *attributes ); #define gnome_keyring_attribute_list_copy CASA_gnome_keyring_attribute_list_copy gboolean CASA_gnome_keyring_is_available (void); #define gnome_keyring_is_available CASA_gnome_keyring_is_available void CASA_gnome_keyring_free_password (char *password); #define gnome_keyring_free_password CASA_gnome_keyring_free_password void CASA_gnome_keyring_found_free (CASA_GnomeKeyringFound_T *found); #define gnome_keyring_found_free CASA_gnome_keyring_found_free void CASA_gnome_keyring_found_list_free (GList *found_list); #define gnome_keyring_found_list_free CASA_gnome_keyring_found_list_free void CASA_gnome_keyring_cancel_request (gpointer request); #define gnome_keyring_cancel_request CASA_gnome_keyring_cancel_request gpointer CASA_gnome_keyring_set_default_keyring ( const char *keyring, CASA_GnomeKeyringOperationDoneCallback_T callback, gpointer data, GDestroyNotify destroy_data ); #define gnome_keyring_set_default_keyring CASA_gnome_keyring_set_default_keyring CASA_GnomeKeyringResult_T CASA_gnome_keyring_set_default_keyring_sync ( const char *keyring ); #define gnome_keyring_set_default_keyring_sync CASA_gnome_keyring_set_default_keyring_sync gpointer CASA_gnome_keyring_get_default_keyring ( CASA_GnomeKeyringOperationGetStringCallback_T callback, gpointer data, GDestroyNotify destroy_data ); #define gnome_keyring_get_default_keyring CASA_gnome_keyring_get_default_keyring CASA_GnomeKeyringResult_T CASA_gnome_keyring_get_default_keyring_sync ( char **keyring ); #define gnome_keyring_get_default_keyring_sync CASA_gnome_keyring_get_default_keyring_sync CASA_GnomeKeyringResult_T CASA_gnome_keyring_list_keyring_names_sync ( GList **keyrings ); #define gnome_keyring_list_keyring_names_sync CASA_gnome_keyring_list_keyring_names_sync gpointer CASA_gnome_keyring_lock_all ( CASA_GnomeKeyringOperationDoneCallback_T callback, gpointer data, GDestroyNotify destroy_data ); #define gnome_keyring_lock_all CASA_gnome_keyring_lock_all CASA_GnomeKeyringResult_T CASA_gnome_keyring_lock_all_sync(void); #define gnome_keyring_lock_all_sync CASA_gnome_keyring_lock_all_sync /* NULL password means ask user */ CASA_GnomeKeyringResult_T CASA_gnome_keyring_create_sync ( const char *keyring_name, const char *password ); #define gnome_keyring_create_sync CASA_gnome_keyring_create_sync CASA_GnomeKeyringResult_T CASA_gnome_keyring_unlock_sync ( const char *keyring, const char *password ); #define gnome_keyring_unlock_sync CASA_gnome_keyring_unlock_sync gpointer CASA_gnome_keyring_lock ( const char *keyring, CASA_GnomeKeyringOperationDoneCallback_T callback, gpointer data, GDestroyNotify destroy_data ); #define gnome_keyring_lock CASA_gnome_keyring_lock CASA_GnomeKeyringResult_T CASA_gnome_keyring_lock_sync ( const char *keyring ); #define gnome_keyring_lock_sync CASA_gnome_keyring_lock_sync gpointer CASA_gnome_keyring_delete ( const char *keyring, CASA_GnomeKeyringOperationDoneCallback_T callback, gpointer data, GDestroyNotify destroy_data ); #define gnome_keyring_delete CASA_gnome_keyring_delete CASA_GnomeKeyringResult_T CASA_gnome_keyring_delete_sync ( const char *keyring ); #define gnome_keyring_delete_sync CASA_gnome_keyring_delete_sync CASA_GnomeKeyringResult_T CASA_gnome_keyring_get_info_sync ( const char *keyring, CASA_GnomeKeyringInfo_T **info ); #define gnome_keyring_get_info_sync CASA_gnome_keyring_get_info_sync CASA_GnomeKeyringResult_T CASA_gnome_keyring_set_info_sync ( const char *keyring, GnomeKeyringInfo *info ); #define gnome_keyring_set_info_sync CASA_gnome_keyring_set_info_sync CASA_GnomeKeyringResult_T CASA_gnome_keyring_list_item_ids_sync ( const char *keyring, GList **ids ); #define gnome_keyring_list_item_ids_sync CASA_gnome_keyring_list_item_ids_sync void CASA_gnome_keyring_info_free ( CASA_GnomeKeyringInfo_T *keyring_info ); #define gnome_keyring_info_free CASA_gnome_keyring_info_free CASA_GnomeKeyringInfo_T *CASA_gnome_keyring_info_copy ( CASA_GnomeKeyringInfo_T *keyring_info ); #define gnome_keyring_info_copy CASA_gnome_keyring_info_copy void CASA_gnome_keyring_info_set_lock_on_idle ( GnomeKeyringInfo *keyring_info, gboolean value ); gpointer CASA_gnome_keyring_find_items ( CASA_GnomeKeyringItemType_T type, CASA_GnomeKeyringAttributeList_T *attributes, CASA_GnomeKeyringOperationGetListCallback_T callback, gpointer data, GDestroyNotify destroy_data ); #define gnome_keyring_find_items CASA_gnome_keyring_find_items gpointer CASA_gnome_keyring_find_itemsv ( CASA_GnomeKeyringItemType_T type, CASA_GnomeKeyringOperationGetListCallback_T callback, gpointer data, GDestroyNotify destroy_data, ... ); #define gnome_keyring_find_itemsv CASA_gnome_keyring_find_itemsv CASA_GnomeKeyringResult_T CASA_gnome_keyring_find_items_sync ( CASA_GnomeKeyringItemType_T type, CASA_GnomeKeyringAttributeList_T *attributes, GList **found ); #define gnome_keyring_find_items_sync CASA_gnome_keyring_find_items_sync CASA_GnomeKeyringResult_T CASA_gnome_keyring_find_itemsv_sync ( CASA_GnomeKeyringItemType_T type, GList **found, ... ); #define gnome_keyring_find_itemsv_sync CASA_gnome_keyring_find_itemsv_sync CASA_GnomeKeyringResult_T CASA_gnome_keyring_item_create_sync ( const char *keyring, CASA_GnomeKeyringItemType_T type, const char *display_name, CASA_GnomeKeyringAttributeList_T *attributes, const char *secret, gboolean update_if_exists, guint32 *item_id ); #define gnome_keyring_item_create_sync CASA_gnome_keyring_item_create_sync CASA_GnomeKeyringResult_T CASA_gnome_keyring_item_delete_sync ( const char *keyring, guint32 id ); #define gnome_keyring_item_delete_sync CASA_gnome_keyring_item_delete_sync CASA_GnomeKeyringResult_T CASA_gnome_keyring_item_get_info_sync ( const char *keyring, guint32 id, CASA_GnomeKeyringItemInfo_T **info ); #define gnome_keyring_item_get_info_sync CASA_gnome_keyring_item_get_info_sync CASA_GnomeKeyringResult_T CASA_gnome_keyring_item_set_info_sync ( const char *keyring, guint32 id, CASA_GnomeKeyringItemInfo_T *info ); #define gnome_keyring_item_set_info_sync CASA_gnome_keyring_item_set_info_sync CASA_GnomeKeyringResult_T CASA_gnome_keyring_item_get_attributes_sync ( const char *keyring, guint32 id, CASA_GnomeKeyringAttributeList_T **attributes ); #define gnome_keyring_item_get_attributes_sync CASA_gnome_keyring_item_get_attributes_sync CASA_GnomeKeyringResult_T CASA_gnome_keyring_item_set_attributes_sync ( const char *keyring, guint32 id, CASA_GnomeKeyringAttributeList_T *attributes ); #define gnome_keyring_item_set_attributes_sync CASA_gnome_keyring_item_set_attributes_sync gpointer CASA_gnome_keyring_item_get_acl ( const char *keyring, guint32 id, CASA_GnomeKeyringOperationGetListCallback_T callback, gpointer data, GDestroyNotify destroy_data ); #define gnome_keyring_item_get_acl CASA_gnome_keyring_item_get_acl CASA_GnomeKeyringResult_T CASA_gnome_keyring_item_get_acl_sync ( const char *keyring, guint32 id, GList **acl ); #define gnome_keyring_item_get_acl_sync CASA_gnome_keyring_item_get_acl_sync gpointer CASA_gnome_keyring_item_set_acl ( const char *keyring, guint32 id, GList *acl, CASA_GnomeKeyringOperationDoneCallback_T callback, gpointer data, GDestroyNotify destroy_data ); #define gnome_keyring_item_set_acl CASA_gnome_keyring_item_set_acl CASA_GnomeKeyringResult_T CASA_gnome_keyring_item_set_acl_sync ( const char *keyring, guint32 id, GList *acl ); #define gnome_keyring_item_set_acl_sync CASA_gnome_keyring_item_set_acl_sync CASA_GnomeKeyringItemInfo_T *CASA_gnome_keyring_item_info_copy (CASA_GnomeKeyringItemInfo_T *item_info); #define gnome_keyring_item_info_copy CASA_gnome_keyring_item_info_copy void CASA_gnome_keyring_item_info_set_type ( CASA_GnomeKeyringItemInfo_T *item_info, CASA_GnomeKeyringItemType_T type ); #define gnome_keyring_item_info_set_type CASA_gnome_keyring_item_info_set_type void CASA_gnome_keyring_item_info_set_display_name ( CASA_GnomeKeyringItemInfo_T *item_info, const char *value ); #define gnome_keyring_item_info_set_display_name CASA_gnome_keyring_item_info_set_display_name CASA_GnomeKeyringApplicationRef_T *CASA_gnome_keyring_application_ref_new (void); #define gnome_keyring_application_ref_new CASA_gnome_keyring_application_ref_new CASA_GnomeKeyringApplicationRef_T *CASA_gnome_keyring_application_ref_copy (const CASA_GnomeKeyringApplicationRef_T *app); #define gnome_keyring_application_ref_copy CASA_gnome_keyring_application_ref_copy void CASA_gnome_keyring_application_ref_free (CASA_GnomeKeyringApplicationRef_T *app); #define gnome_keyring_application_ref_free CASA_gnome_keyring_application_ref_free CASA_GnomeKeyringAccessControl_T *CASA_gnome_keyring_access_control_new ( const CASA_GnomeKeyringApplicationRef_T *application, CASA_GnomeKeyringAccessType_T types_allowed ); #define gnome_keyring_access_control_new CASA_gnome_keyring_access_control_new CASA_GnomeKeyringAccessControl_T *CASA_gnome_keyring_access_control_copy (GnomeKeyringAccessControl *ac); #define gnome_keyring_access_control_copy CASA_gnome_keyring_access_control_copy void CASA_gnome_keyring_access_control_free (CASA_GnomeKeyringAccessControl_T *ac); #define gnome_keyring_access_control_free CASA_gnome_keyring_access_control_free GList * CASA_gnome_keyring_acl_copy (GList *list); #define gnome_keyring_acl_copy CASA_gnome_keyring_acl_copy void CASA_gnome_keyring_acl_free (GList *acl); #define gnome_keyring_acl_free CASA_gnome_keyring_acl_free char *CASA_gnome_keyring_item_ac_get_display_name (CASA_GnomeKeyringAccessControl_T *ac); #define gnome_keyring_item_ac_get_display_name CASA_gnome_keyring_item_ac_get_display_name void CASA_gnome_keyring_item_ac_set_display_name ( CASA_GnomeKeyringAccessControl_T *ac, const char *value ); #define gnome_keyring_item_ac_set_display_name CASA_gnome_keyring_item_ac_set_display_name char *CASA_gnome_keyring_item_ac_get_path_name (CASA_GnomeKeyringAccessControl_T *ac); #define gnome_keyring_item_ac_get_path_name CASA_gnome_keyring_item_ac_get_path_name void CASA_gnome_keyring_item_ac_set_path_name ( CASA_GnomeKeyringAccessControl_T *ac, const char *value ); #define gnome_keyring_item_ac_set_path_name CASA_gnome_keyring_item_ac_set_path_name CASA_GnomeKeyringAccessType_T CASA_gnome_keyring_item_ac_get_access_type (CASA_GnomeKeyringAccessControl_T *ac); #define gnome_keyring_item_ac_get_access_type CASA_gnome_keyring_item_ac_get_access_type void CASA_gnome_keyring_item_ac_set_access_type ( CASA_GnomeKeyringAccessControl_T *ac, const CASA_GnomeKeyringAccessType_T value ); #define gnome_keyring_item_ac_set_access_type CASA_gnome_keyring_item_ac_set_access_type /* Specialized Helpers for network passwords items */ typedef struct { char *keyring; guint32 item_id; char *protocol; char *server; char *object; char *authtype; guint32 port; char *user; char *domain; char *password; } CASA_GnomeKeyringNetworkPasswordData_T; #define GnomeKeyringNetworkPasswordData CASA_GnomeKeyringNetworkPasswordData_T void CASA_gnome_keyring_network_password_free (CASA_GnomeKeyringNetworkPasswordData_T *data); #define gnome_keyring_network_password_free CASA_gnome_keyring_network_password_free void CASA_gnome_keyring_network_password_list_free (GList *list); #define gnome_keyring_network_password_list_free CASA_gnome_keyring_network_password_list_free gpointer CASA_gnome_keyring_find_network_password ( const char *user, const char *domain, const char *server, const char *object, const char *protocol, const char *authtype, guint32 port, CASA_GnomeKeyringOperationGetListCallback_T callback, gpointer data, GDestroyNotify destroy_data ); #define gnome_keyring_find_network_password CASA_gnome_keyring_find_network_password CASA_GnomeKeyringResult_T CASA_gnome_keyring_find_network_password_sync ( const char *user, const char *domain, const char *server, const char *object, const char *protocol, const char *authtype, guint32 port, GList **result ); #define gnome_keyring_find_network_password_sync CASA_gnome_keyring_find_network_password_sync gpointer CASA_gnome_keyring_set_network_password ( const char *keyring, const char *user, const char *domain, const char *server, const char *object, const char *protocol, const char *authtype, guint32 port, const char *password, CASA_GnomeKeyringOperationGetIntCallback_T callback, gpointer data, GDestroyNotify destroy_data ); #define gnome_keyring_set_network_password CASA_gnome_keyring_set_network_password CASA_GnomeKeyringResult_T CASA_gnome_keyring_set_network_password_sync ( const char *keyring, const char *user, const char *domain, const char *server, const char *object, const char *protocol, const char *authtype, guint32 port, const char *password, guint32 *item_id ); #define gnome_keyring_set_network_password_sync CASA_gnome_keyring_set_network_password_sync #endif /* _CASA_GNOME_KEYRING_H */