New function, DSO_pathbyaddr, to find pathname for loaded shared object
[openssl.git] / crypto / dso / dso.h
index 3de99f5d00bddc23526037c5e995295ad5e1fc70..c9d736654ac54de3e712c8664d3febd55bba08f1 100644 (file)
@@ -170,6 +170,9 @@ typedef struct dso_meth_st
        /* [De]Initialisation handlers. */
        int (*init)(DSO *dso);
        int (*finish)(DSO *dso);
+
+       /* Return pathname of the module containing location */
+       int (*pathbyaddr)(void *addr,char *path,int sz);
        } DSO_METHOD;
 
 /**********************************************************************/
@@ -296,6 +299,17 @@ DSO_METHOD *DSO_METHOD_win32(void);
 /* If VMS is defined, use shared images. If not, return NULL. */
 DSO_METHOD *DSO_METHOD_vms(void);
 
+/* This function writes null-terminated pathname of DSO module
+ * containing 'addr' into 'sz' large caller-provided 'path' and
+ * returns the number of characters [including trailing zero]
+ * written to it. If 'sz' is 0 or negative, 'path' is ignored and
+ * required amount of charachers [including trailing zero] to
+ * accomodate pathname is returned. If 'addr' is NULL, then
+ * pathname of cryptolib itself is returned. Negative or zero
+ * return value denotes error.
+ */
+int DSO_pathbyaddr(void *addr,char *path,int sz);
+
 /* BEGIN ERROR CODES */
 /* The following lines are auto generated by the script mkerr.pl. Any changes
  * made after this point may be overwritten when the script is next run.
@@ -342,6 +356,7 @@ void ERR_load_DSO_strings(void);
 #define DSO_F_WIN32_NAME_CONVERTER                      125
 #define DSO_F_WIN32_SPLITTER                            136
 #define DSO_F_WIN32_UNLOAD                              121
+#define DSO_F_PATHBYADDR                                137
 
 /* Reason codes. */
 #define DSO_R_CTRL_FAILED                               100