CASA/c_adlib/ad_gk/native/ad_gk.h
2006-02-01 17:48:29 +00:00

133 lines
3.1 KiB
C

/***********************************************************************
*
* 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 _AD_GK_H_
#define _AD_GK_H_
#include <stdio.h>
#include <stdint.h>
#include <glib.h>
#include <gnome-keyring.h>
#include <string.h>
#define SUCCESS 0
#define FAILURE -1
#define KEY_SIZE 128
#define VAL_SIZE 128
enum KeyringResultExtended { GNOME_KEYRING_RESULT_NO_SUCH_ITEM = 128,
GNOME_KEYRING_RESULT_CANNOT_DELETE_SECRET_VALUE,
GNOME_KEYRING_RESULT_MALFORMED_XML,
GNOME_KEYRING_RESULT_CANNOT_CREATE_KEYRING
};
typedef struct _KeyringInfo
{
int32_t lockOnIdle;
uint32_t lockTimeout;
uint32_t mTime;
uint32_t cTime;
int32_t isLocked;
}KeyringInfo;
typedef struct _ItemInfo
{
int32_t itemType;
char *displayName;
char *secret;
uint32_t mTime;
uint32_t cTime;
}ItemInfo;
typedef struct _Attribute
{
uint32_t type;
char *key;
char *value;
}Attribute;
int GetKeyrings(GList **retList);
int GetKeyringInfo(char *keyring,KeyringInfo *info);
int GetItems(char *keyring, GList **itemList);
int GetItemInfo(char *keyring, int itemId, ItemInfo *info);
int GetAttributeList(char *keyring, int itemId, GList **);
int FreeAttributeList(GList *attrList);
int
UnlockRing(char *keyring, char *password);
int
SetItemAttributes (char *keyring, guint32 item_id, Attribute **attrs, int length);
int
CreateItem(char *keyring, int32_t itemType, char *display_name, char *secret, Attribute **attrs, int attrcnt);
int
RemoveItem (char *keyring, guint32 itemid);
int
SetPassword (char *keyring, guint32 itemid, char *secret);
typedef struct _GetKeyringsCbData
{
GList **keyringList;
GMainLoop *loop;
}GetKeyringsCbData;
typedef struct _GetKeyringInfoCbData
{
KeyringInfo *info;
GMainLoop *loop;
}GetKeyringInfoCbData;
typedef struct _GetItemsCbData
{
GList **itemList;
GMainLoop *loop;
}GetItemsCbData;
typedef struct _GetItemInfoCbData
{
ItemInfo *info;
GMainLoop *loop;
}GetItemInfoCbData;
typedef struct _GetAttributeListCbData
{
GList **attrList;
GMainLoop *loop;
}GetAttributeListCbData;
typedef struct _OperationCompleted
{
char *OperationName;
GnomeKeyringResult result;
}OperationCompleted;
#endif