Add support for dynamically created and destroyed mutexes. This will
[openssl.git] / crypto / crypto.h
index 9a3a6f8b00fc9ee0a2ced2df3376f6fd2baf7f1e..9e5f2e29226b325df0dd580ac0a3eff881ecf3da 100644 (file)
@@ -150,6 +150,12 @@ extern "C" {
 #define CRYPTO_add(a,b,c)      ((*(a))+=(b))
 #endif
 
+/* Some applications as well as some parts of OpenSSL need to allocate
+   and deallocate locks in a dynamic fashion.  The following typedef
+   makes this possible in a type-safe manner.  */
+typedef struct CRYPTO_dynlock_value CRYPTO_dynlock;
+
+
 /* The following can be used to detect memory leaks in the SSLeay library.
  * It used, it turns on malloc checking */
 
@@ -299,6 +305,16 @@ unsigned long CRYPTO_thread_id(void);
 const char *CRYPTO_get_lock_name(int type);
 int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,
                    int line);
+void CRYPTO_set_dynlock_create_callback(CRYPTO_dynlock *(*dyn_create_function)
+       (char *file, int line));
+void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)
+       (int mode, CRYPTO_dynlock *l, const char *file, int line));
+void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)
+       (CRYPTO_dynlock *l, const char *file, int line));
+void CRYPTO_set_dynlock_size(int dynlock_size);
+int CRYPTO_get_new_dynlockid(void);
+void CRYPTO_destroy_dynlockid(int i);
+CRYPTO_dynlock *CRYPTO_get_dynlock_value(int i);
 
 /* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions --
  * call the latter last if you need different functions */
@@ -371,12 +387,15 @@ void ERR_load_CRYPTO_strings(void);
 
 /* Function codes. */
 #define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX                100
+#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID               103
 #define CRYPTO_F_CRYPTO_GET_NEW_LOCKID                  101
 #define CRYPTO_F_CRYPTO_SET_EX_DATA                     102
 
 /* Reason codes. */
+#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK             100
 
 #ifdef  __cplusplus
 }
 #endif
 #endif
+