From d108e2008ec7205ef3907296fd3e5a810e45919b Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 9 Dec 2008 20:09:51 +0000 Subject: First shot at renaming the project. --- ckcapi-session.h | 150 ------------------------------------------------------- 1 file changed, 150 deletions(-) delete mode 100644 ckcapi-session.h (limited to 'ckcapi-session.h') diff --git a/ckcapi-session.h b/ckcapi-session.h deleted file mode 100644 index f486277..0000000 --- a/ckcapi-session.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 2007 Stef Walter - * - * 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; either - * version 2 of the License, or (at your option) any later version. - * - * 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 - * 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, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef CKCAPI_SESSION_H -#define CKCAPI_SESSION_H - -#include "ckcapi.h" - -/* Callback to cleanup a current operation */ -typedef void (*CkCapiSessionCancel) (struct _CkCapiSession* sess); - -/* Represents an open session */ -typedef struct _CkCapiSession -{ - CK_SESSION_HANDLE id; /* Unique ID for this session */ - CK_SLOT_ID slot; - int in_call; /* Whether this session is use in PKCS#11 function */ - - HCERTSTORE store; /* Handle to an open certificate store */ - - BOOL read_write; /* A read-write session? */ - - int operation_type; /* Whether an operation is happening or not */ - void* operation_data; /* Data for this operation */ - CkCapiSessionCancel operation_cancel; /* Callback to cancel operation when necessary */ - - CkCapiHash* object_data; - - CK_NOTIFY notify_callback; /* Application specified callback */ - CK_VOID_PTR user_data; /* Argument for above */ - - int refs; /* Reference count */ - HANDLE mutex; /* Mutex for protecting this structure */ -} -CkCapiSession; - -/* Debug print something related to a session */ -#define DBGS(sess, msg) \ - ckcapi_debug("S%d: %s", (sess) ? (sess)->id : 0, (msg)) - -/* Create a session */ -CK_RV ckcapi_session_create (CK_SLOT_ID slot, CkCapiSession** ret); - -/* Destroy a session */ -void ckcapi_session_destroy (CkCapiSession* sess); - -/* Register a new session */ -CK_RV ckcapi_session_register (CkCapiSession* sess); - -/* Get information about a session */ -void ckcapi_session_get_info (CkCapiSession* sess, - CK_SESSION_INFO_PTR info); - -/* Get a session from a handle, and lock it */ -CK_RV ckcapi_session_get_lock_ref (CK_ULONG id, BOOL writable, - CkCapiSession **sess); - -/* Get a session from a handle, remove it from list, and lock it */ -CK_RV ckcapi_session_remove_lock_ref (CK_ULONG id, CkCapiSession **sess); - -/* Unlock and unreference a session */ -void ckcapi_session_unref_unlock (CkCapiSession* sess); - -/* Close all sessions on a certain slot/token */ -CK_RV ckcapi_session_close_all (CK_SLOT_ID slot); - - - -/* Start a find operation on a session */ -CK_RV ckcapi_session_find_init (CkCapiSession* sess, - CK_ATTRIBUTE_PTR templ, - CK_ULONG count); - -/* Return results from a find operation */ -CK_RV ckcapi_session_find (CkCapiSession* sess, - CK_OBJECT_HANDLE_PTR objects, - CK_ULONG max_object_count, - CK_ULONG_PTR object_count); - -/* End a find operation */ -CK_RV ckcapi_session_find_final (CkCapiSession* sess); - - -/* Start a sign operation on a session */ -CK_RV ckcapi_session_sign_init (CkCapiSession* sess, - CK_MECHANISM_PTR mech, - CkCapiObjectData *objdata); - -/* Perform sign operation */ -CK_RV ckcapi_session_sign (CkCapiSession* sess, - CK_BYTE_PTR data, CK_ULONG n_data, - CK_BYTE_PTR sig, CK_ULONG_PTR n_sig); - -/* Start a decrypt operation on a session */ -CK_RV ckcapi_session_decrypt_init (CkCapiSession* sess, - CK_MECHANISM_PTR mech, - CkCapiObjectData *objdata); - -/* Perform decrypt operation */ -CK_RV ckcapi_session_decrypt (CkCapiSession* sess, - CK_BYTE_PTR encdata, CK_ULONG n_encdata, - CK_BYTE_PTR result, CK_ULONG_PTR n_result); - -/* Get object data for an object */ -CK_RV ckcapi_session_get_object_data (CkCapiSession* sess, - CkCapiObject* obj, - CkCapiObjectData** objdata); - -/* Get object data for an object handle */ -CK_RV ckcapi_session_get_object_data_for (CkCapiSession* sess, - CK_OBJECT_HANDLE hand, - CkCapiObjectData** objdata); - -/* Set object data for an object */ -void ckcapi_session_take_object_data (CkCapiSession* sess, - CkCapiObject* obj, - CkCapiObjectData* objdata); - -/* Clear object data for an object */ -void ckcapi_session_clear_object_data (CkCapiSession* sess, - CkCapiObject* obj); - -/* Enumerate object data for all objects */ -typedef void (*CkCapiEnumObjectData) (CkCapiSession* sess, - CkCapiObject* obj, - CkCapiObjectData* data, - void* arg); -void ckcapi_session_enum_object_data (CkCapiSession* sess, - CkCapiEnumObjectData enum_func, - void* arg); - -void ckcapi_session_cleanup_all (void); - -#endif /* CKCAPI_SESSION_H */ -- cgit v1.2.3