From: Martin Willi Date: Wed, 14 Jul 2010 10:32:40 +0000 (+0200) Subject: Added a getter for the library alias X-Git-Tag: 4.5.0~626 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=71151d3c1bf57e2542b2bfd7093d41884893a697;p=thirdparty%2Fstrongswan.git Added a getter for the library alias --- diff --git a/src/libstrongswan/plugins/pkcs11/pkcs11_library.c b/src/libstrongswan/plugins/pkcs11/pkcs11_library.c index 6701494e17..adafa17bba 100644 --- a/src/libstrongswan/plugins/pkcs11/pkcs11_library.c +++ b/src/libstrongswan/plugins/pkcs11/pkcs11_library.c @@ -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), ); diff --git a/src/libstrongswan/plugins/pkcs11/pkcs11_library.h b/src/libstrongswan/plugins/pkcs11/pkcs11_library.h index 4ca9e05b54..c24929ae0d 100644 --- a/src/libstrongswan/plugins/pkcs11/pkcs11_library.h +++ b/src/libstrongswan/plugins/pkcs11/pkcs11_library.h @@ -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. */