summaryrefslogtreecommitdiff
path: root/p11-kit/pin.h
diff options
context:
space:
mode:
authorStef Walter <stefw@collabora.co.uk>2011-06-24 15:31:02 +0200
committerStef Walter <stefw@collabora.co.uk>2011-07-06 12:49:26 +0200
commitfd7dee836d0b14efc48bf59955c8a12a72561043 (patch)
treeb4dd8ffef5688edd3ca4321037d6acd2999cf929 /p11-kit/pin.h
parent2cc2ab90a6b96ea75dfe4d6413e41539075e8f8a (diff)
downloadp11-kit-fd7dee836d0b14efc48bf59955c8a12a72561043.tar.gz
Add P11KitPin structure, which encapsulates a returned pin.
* Lets us use variable size buffers. * Helps minimize copying.
Diffstat (limited to 'p11-kit/pin.h')
-rw-r--r--p11-kit/pin.h44
1 files changed, 32 insertions, 12 deletions
diff --git a/p11-kit/pin.h b/p11-kit/pin.h
index bb5daae..532aa54 100644
--- a/p11-kit/pin.h
+++ b/p11-kit/pin.h
@@ -41,6 +41,8 @@
extern "C" {
#endif
+typedef struct _P11KitPin P11KitPin;
+
typedef enum {
P11_KIT_PIN_FLAGS_USER_LOGIN = 1,
P11_KIT_PIN_FLAGS_SO_LOGIN = 2,
@@ -52,31 +54,49 @@ typedef enum {
#define P11_KIT_PIN_FALLBACK ""
-typedef int (*p11_kit_pin_callback) (const char *pinfile,
+typedef void (*p11_kit_pin_destroy_func) (void *callback_data);
+
+P11KitPin* p11_kit_pin_new (const unsigned char *value,
+ size_t length);
+
+P11KitPin* p11_kit_pin_new_for_string (const char *value);
+
+P11KitPin* p11_kit_pin_new_for_buffer (unsigned char *buffer,
+ size_t length,
+ p11_kit_pin_destroy_func destroy);
+
+P11KitPin* p11_kit_pin_ref (P11KitPin *pin);
+
+void p11_kit_pin_unref (P11KitPin *pin);
+
+const unsigned char * p11_kit_pin_get_value (P11KitPin *pin,
+ size_t *length);
+
+typedef P11KitPin* (*p11_kit_pin_callback) (const char *pinfile,
P11KitUri *pin_uri,
const char *pin_description,
P11KitPinFlags pin_flags,
- void *callback_data,
- char *pin,
- size_t pin_length);
-
-typedef void (*p11_kit_pin_callback_destroy) (void *callback_data);
+ void *callback_data);
-int p11_kit_pin_register_callback (const char *pinfile,
+int p11_kit_pin_register_callback (const char *pinfile,
p11_kit_pin_callback callback,
void *callback_data,
- p11_kit_pin_callback_destroy callback_destroy);
+ p11_kit_pin_destroy_func callback_destroy);
-void p11_kit_pin_unregister_callback (const char *pinfile,
+void p11_kit_pin_unregister_callback (const char *pinfile,
p11_kit_pin_callback callback,
void *callback_data);
-int p11_kit_pin_retrieve (const char *pinfile,
+P11KitPin* p11_kit_pin_retrieve (const char *pinfile,
+ P11KitUri *pin_uri,
+ const char *pin_description,
+ P11KitPinFlags pin_flags);
+
+P11KitPin* p11_kit_pin_file_callback (const char *pinfile,
P11KitUri *pin_uri,
const char *pin_description,
P11KitPinFlags pin_flags,
- char *pin,
- size_t pin_max);
+ void *callback_data);
#ifdef __cplusplus
} /* extern "C" */