1
/* ***** BEGIN LICENSE BLOCK *****
2
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
* The contents of this file are subject to the Mozilla Public License Version
5
* 1.1 (the "License"); you may not use this file except in compliance with
6
* the License. You may obtain a copy of the License at
7
* http://www.mozilla.org/MPL/
9
* Software distributed under the License is distributed on an "AS IS" basis,
10
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
* for the specific language governing rights and limitations under the
14
* The Original Code is the Netscape security libraries.
16
* The Initial Developer of the Original Code is
17
* Netscape Communications Corporation.
18
* Portions created by the Initial Developer are Copyright (C) 1994-2000
19
* the Initial Developer. All Rights Reserved.
23
* Alternatively, the contents of this file may be used under the terms of
24
* either the GNU General Public License Version 2 or later (the "GPL"), or
25
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26
* in which case the provisions of the GPL or the LGPL are applicable instead
27
* of those above. If you wish to allow use of your version of this file only
28
* under the terms of either the GPL or the LGPL, and not to allow others to
29
* use your version of this file under the terms of the MPL, indicate your
30
* decision by deleting the provisions above and replace them with the notice
31
* and other provisions required by the GPL or the LGPL. If you do not delete
32
* the provisions above, a recipient may use your version of this file under
33
* the terms of any one of the MPL, the GPL or the LGPL.
35
* ***** END LICENSE BLOCK ***** */
38
static const char CVS_ID[] = "@(#) $RCSfile: object.c,v $ $Revision: 1.2.28.1 $ $Date: 2006/03/02 22:45:14 $";
44
nss_dbm_mdObject_Finalize
46
NSSCKMDObject *mdObject,
47
NSSCKFWObject *fwObject,
48
NSSCKMDSession *mdSession,
49
NSSCKFWSession *fwSession,
50
NSSCKMDToken *mdToken,
51
NSSCKFWToken *fwToken,
52
NSSCKMDInstance *mdInstance,
53
NSSCKFWInstance *fwInstance
60
nss_dbm_mdObject_Destroy
62
NSSCKMDObject *mdObject,
63
NSSCKFWObject *fwObject,
64
NSSCKMDSession *mdSession,
65
NSSCKFWSession *fwSession,
66
NSSCKMDToken *mdToken,
67
NSSCKFWToken *fwToken,
68
NSSCKMDInstance *mdInstance,
69
NSSCKFWInstance *fwInstance
72
nss_dbm_object_t *object = (nss_dbm_object_t *)mdObject->etc;
73
return nss_dbm_db_delete_object(object->handle);
77
nss_dbm_mdObject_GetAttributeCount
79
NSSCKMDObject *mdObject,
80
NSSCKFWObject *fwObject,
81
NSSCKMDSession *mdSession,
82
NSSCKFWSession *fwSession,
83
NSSCKMDToken *mdToken,
84
NSSCKFWToken *fwToken,
85
NSSCKMDInstance *mdInstance,
86
NSSCKFWInstance *fwInstance,
90
nss_dbm_object_t *object = (nss_dbm_object_t *)mdObject->etc;
91
nss_dbm_session_t *session = (nss_dbm_session_t *)mdSession->etc;
92
return nss_dbm_db_get_object_attribute_count(object->handle, pError,
93
&session->deviceError);
97
nss_dbm_mdObject_GetAttributeTypes
99
NSSCKMDObject *mdObject,
100
NSSCKFWObject *fwObject,
101
NSSCKMDSession *mdSession,
102
NSSCKFWSession *fwSession,
103
NSSCKMDToken *mdToken,
104
NSSCKFWToken *fwToken,
105
NSSCKMDInstance *mdInstance,
106
NSSCKFWInstance *fwInstance,
107
CK_ATTRIBUTE_TYPE_PTR typeArray,
111
nss_dbm_object_t *object = (nss_dbm_object_t *)mdObject->etc;
112
nss_dbm_session_t *session = (nss_dbm_session_t *)mdSession->etc;
113
return nss_dbm_db_get_object_attribute_types(object->handle, typeArray,
114
ulCount, &session->deviceError);
118
nss_dbm_mdObject_GetAttributeSize
120
NSSCKMDObject *mdObject,
121
NSSCKFWObject *fwObject,
122
NSSCKMDSession *mdSession,
123
NSSCKFWSession *fwSession,
124
NSSCKMDToken *mdToken,
125
NSSCKFWToken *fwToken,
126
NSSCKMDInstance *mdInstance,
127
NSSCKFWInstance *fwInstance,
128
CK_ATTRIBUTE_TYPE attribute,
132
nss_dbm_object_t *object = (nss_dbm_object_t *)mdObject->etc;
133
nss_dbm_session_t *session = (nss_dbm_session_t *)mdSession->etc;
134
return nss_dbm_db_get_object_attribute_size(object->handle, attribute, pError,
135
&session->deviceError);
139
nss_dbm_mdObject_GetAttribute
141
NSSCKMDObject *mdObject,
142
NSSCKFWObject *fwObject,
143
NSSCKMDSession *mdSession,
144
NSSCKFWSession *fwSession,
145
NSSCKMDToken *mdToken,
146
NSSCKFWToken *fwToken,
147
NSSCKMDInstance *mdInstance,
148
NSSCKFWInstance *fwInstance,
149
CK_ATTRIBUTE_TYPE attribute,
153
nss_dbm_object_t *object = (nss_dbm_object_t *)mdObject->etc;
154
nss_dbm_session_t *session = (nss_dbm_session_t *)mdSession->etc;
155
return nss_dbm_db_get_object_attribute(object->handle, object->arena, attribute,
156
pError, &session->deviceError);
160
nss_dbm_mdObject_SetAttribute
162
NSSCKMDObject *mdObject,
163
NSSCKFWObject *fwObject,
164
NSSCKMDSession *mdSession,
165
NSSCKFWSession *fwSession,
166
NSSCKMDToken *mdToken,
167
NSSCKFWToken *fwToken,
168
NSSCKMDInstance *mdInstance,
169
NSSCKFWInstance *fwInstance,
170
CK_ATTRIBUTE_TYPE attribute,
174
nss_dbm_object_t *object = (nss_dbm_object_t *)mdObject->etc;
175
nss_dbm_session_t *session = (nss_dbm_session_t *)mdSession->etc;
176
return nss_dbm_db_set_object_attribute(object->handle, attribute, value,
177
&session->deviceError);
180
NSS_IMPLEMENT NSSCKMDObject *
181
nss_dbm_mdObject_factory
183
nss_dbm_object_t *object,
189
rv = nss_ZNEW(object->arena, NSSCKMDObject);
190
if( (NSSCKMDObject *)NULL == rv ) {
191
*pError = CKR_HOST_MEMORY;
192
return (NSSCKMDObject *)NULL;
195
rv->etc = (void *)object;
196
rv->Finalize = nss_dbm_mdObject_Finalize;
197
rv->Destroy = nss_dbm_mdObject_Destroy;
198
/* IsTokenObject can be deferred */
199
rv->GetAttributeCount = nss_dbm_mdObject_GetAttributeCount;
200
rv->GetAttributeTypes = nss_dbm_mdObject_GetAttributeTypes;
201
rv->GetAttributeSize = nss_dbm_mdObject_GetAttributeSize;
202
rv->GetAttribute = nss_dbm_mdObject_GetAttribute;
203
rv->SetAttribute = nss_dbm_mdObject_SetAttribute;
204
/* GetObjectSize can be deferred */