Added a getter for the library alias

This commit is contained in:
Martin Willi
2010-08-04 09:26:19 +02:00
parent 2e209becbc
commit 71151d3c1b
2 changed files with 20 additions and 0 deletions
@@ -186,8 +186,19 @@ struct private_pkcs11_library_t {
* dlopen() handle
*/
void *handle;
/**
* Name as passed to the constructor
*/
char *name;
};
METHOD(pkcs11_library_t, get_name, char*,
private_pkcs11_library_t *this)
{
return this->name;
}
METHOD(pkcs11_library_t, destroy, void,
private_pkcs11_library_t *this)
{
@@ -334,8 +345,10 @@ pkcs11_library_t *pkcs11_library_create(char *name, char *file)
INIT(this,
.public = {
.get_name = _get_name,
.destroy = _destroy,
},
.name = name,
.handle = dlopen(file, RTLD_LAZY),
);
@@ -37,6 +37,13 @@ struct pkcs11_library_t {
*/
CK_FUNCTION_LIST_PTR f;
/**
* Get the name this instance was created with.
*
* @return name, as passed to constructor
*/
char* (*get_name)(pkcs11_library_t *this);
/**
* Destroy a pkcs11_library_t.
*/