OLD | NEW |
1 /* dso.h -*- mode:C; c-file-style: "eay" -*- */ | 1 /* dso.h -*- mode:C; c-file-style: "eay" -*- */ |
2 /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL | 2 /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL |
3 * project 2000. | 3 * project 2000. |
4 */ | 4 */ |
5 /* ==================================================================== | 5 /* ==================================================================== |
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | 6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 /* The default DSO_METHOD-specific function for converting filenames to | 163 /* The default DSO_METHOD-specific function for converting filenames to |
164 * a canonical native form. */ | 164 * a canonical native form. */ |
165 DSO_NAME_CONVERTER_FUNC dso_name_converter; | 165 DSO_NAME_CONVERTER_FUNC dso_name_converter; |
166 /* The default DSO_METHOD-specific function for converting filenames to | 166 /* The default DSO_METHOD-specific function for converting filenames to |
167 * a canonical native form. */ | 167 * a canonical native form. */ |
168 DSO_MERGER_FUNC dso_merger; | 168 DSO_MERGER_FUNC dso_merger; |
169 | 169 |
170 /* [De]Initialisation handlers. */ | 170 /* [De]Initialisation handlers. */ |
171 int (*init)(DSO *dso); | 171 int (*init)(DSO *dso); |
172 int (*finish)(DSO *dso); | 172 int (*finish)(DSO *dso); |
| 173 |
| 174 /* Return pathname of the module containing location */ |
| 175 int (*pathbyaddr)(void *addr,char *path,int sz); |
| 176 /* Perform global symbol lookup, i.e. among *all* modules */ |
| 177 void *(*globallookup)(const char *symname); |
173 } DSO_METHOD; | 178 } DSO_METHOD; |
174 | 179 |
175 /**********************************************************************/ | 180 /**********************************************************************/ |
176 /* The low-level handle type used to refer to a loaded shared library */ | 181 /* The low-level handle type used to refer to a loaded shared library */ |
177 | 182 |
178 struct dso_st | 183 struct dso_st |
179 { | 184 { |
180 DSO_METHOD *meth; | 185 DSO_METHOD *meth; |
181 /* Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS | 186 /* Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS |
182 * doesn't use anything but will need to cache the filename | 187 * doesn't use anything but will need to cache the filename |
183 * for use in the dso_bind handler. All in all, let each | 188 * for use in the dso_bind handler. All in all, let each |
184 * method control its own destiny. "Handles" and such go in | 189 * method control its own destiny. "Handles" and such go in |
185 * a STACK. */ | 190 * a STACK. */ |
186 » STACK *meth_data; | 191 » STACK_OF(void) *meth_data; |
187 int references; | 192 int references; |
188 int flags; | 193 int flags; |
189 /* For use by applications etc ... use this for your bits'n'pieces, | 194 /* For use by applications etc ... use this for your bits'n'pieces, |
190 * don't touch meth_data! */ | 195 * don't touch meth_data! */ |
191 CRYPTO_EX_DATA ex_data; | 196 CRYPTO_EX_DATA ex_data; |
192 /* If this callback function pointer is set to non-NULL, then it will | 197 /* If this callback function pointer is set to non-NULL, then it will |
193 * be used in DSO_load() in place of meth->dso_name_converter. NB: This | 198 * be used in DSO_load() in place of meth->dso_name_converter. NB: This |
194 * should normally set using DSO_set_name_converter(). */ | 199 * should normally set using DSO_set_name_converter(). */ |
195 DSO_NAME_CONVERTER_FUNC name_converter; | 200 DSO_NAME_CONVERTER_FUNC name_converter; |
196 /* If this callback function pointer is set to non-NULL, then it will | 201 /* If this callback function pointer is set to non-NULL, then it will |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 * shl_unload, shl_findsym, etc) will be used and incorporated into | 294 * shl_unload, shl_findsym, etc) will be used and incorporated into |
290 * this method. If not, this method will return NULL. */ | 295 * this method. If not, this method will return NULL. */ |
291 DSO_METHOD *DSO_METHOD_dl(void); | 296 DSO_METHOD *DSO_METHOD_dl(void); |
292 | 297 |
293 /* If WIN32 is defined, use DLLs. If not, return NULL. */ | 298 /* If WIN32 is defined, use DLLs. If not, return NULL. */ |
294 DSO_METHOD *DSO_METHOD_win32(void); | 299 DSO_METHOD *DSO_METHOD_win32(void); |
295 | 300 |
296 /* If VMS is defined, use shared images. If not, return NULL. */ | 301 /* If VMS is defined, use shared images. If not, return NULL. */ |
297 DSO_METHOD *DSO_METHOD_vms(void); | 302 DSO_METHOD *DSO_METHOD_vms(void); |
298 | 303 |
| 304 /* This function writes null-terminated pathname of DSO module |
| 305 * containing 'addr' into 'sz' large caller-provided 'path' and |
| 306 * returns the number of characters [including trailing zero] |
| 307 * written to it. If 'sz' is 0 or negative, 'path' is ignored and |
| 308 * required amount of charachers [including trailing zero] to |
| 309 * accomodate pathname is returned. If 'addr' is NULL, then |
| 310 * pathname of cryptolib itself is returned. Negative or zero |
| 311 * return value denotes error. |
| 312 */ |
| 313 int DSO_pathbyaddr(void *addr,char *path,int sz); |
| 314 |
| 315 /* This function should be used with caution! It looks up symbols in |
| 316 * *all* loaded modules and if module gets unloaded by somebody else |
| 317 * attempt to dereference the pointer is doomed to have fatal |
| 318 * consequences. Primary usage for this function is to probe *core* |
| 319 * system functionality, e.g. check if getnameinfo(3) is available |
| 320 * at run-time without bothering about OS-specific details such as |
| 321 * libc.so.versioning or where does it actually reside: in libc |
| 322 * itself or libsocket. */ |
| 323 void *DSO_global_lookup(const char *name); |
| 324 |
| 325 /* If BeOS is defined, use shared images. If not, return NULL. */ |
| 326 DSO_METHOD *DSO_METHOD_beos(void); |
| 327 |
299 /* BEGIN ERROR CODES */ | 328 /* BEGIN ERROR CODES */ |
300 /* The following lines are auto generated by the script mkerr.pl. Any changes | 329 /* The following lines are auto generated by the script mkerr.pl. Any changes |
301 * made after this point may be overwritten when the script is next run. | 330 * made after this point may be overwritten when the script is next run. |
302 */ | 331 */ |
303 void ERR_load_DSO_strings(void); | 332 void ERR_load_DSO_strings(void); |
304 | 333 |
305 /* Error codes for the DSO functions. */ | 334 /* Error codes for the DSO functions. */ |
306 | 335 |
307 /* Function codes. */ | 336 /* Function codes. */ |
| 337 #define DSO_F_BEOS_BIND_FUNC 144 |
| 338 #define DSO_F_BEOS_BIND_VAR 145 |
| 339 #define DSO_F_BEOS_LOAD 146 |
| 340 #define DSO_F_BEOS_NAME_CONVERTER 147 |
| 341 #define DSO_F_BEOS_UNLOAD 148 |
308 #define DSO_F_DLFCN_BIND_FUNC 100 | 342 #define DSO_F_DLFCN_BIND_FUNC 100 |
309 #define DSO_F_DLFCN_BIND_VAR 101 | 343 #define DSO_F_DLFCN_BIND_VAR 101 |
310 #define DSO_F_DLFCN_LOAD 102 | 344 #define DSO_F_DLFCN_LOAD 102 |
311 #define DSO_F_DLFCN_MERGER 130 | 345 #define DSO_F_DLFCN_MERGER 130 |
312 #define DSO_F_DLFCN_NAME_CONVERTER 123 | 346 #define DSO_F_DLFCN_NAME_CONVERTER 123 |
313 #define DSO_F_DLFCN_UNLOAD 103 | 347 #define DSO_F_DLFCN_UNLOAD 103 |
314 #define DSO_F_DL_BIND_FUNC 104 | 348 #define DSO_F_DL_BIND_FUNC 104 |
315 #define DSO_F_DL_BIND_VAR 105 | 349 #define DSO_F_DL_BIND_VAR 105 |
316 #define DSO_F_DL_LOAD 106 | 350 #define DSO_F_DL_LOAD 106 |
317 #define DSO_F_DL_MERGER 131 | 351 #define DSO_F_DL_MERGER 131 |
318 #define DSO_F_DL_NAME_CONVERTER 124 | 352 #define DSO_F_DL_NAME_CONVERTER 124 |
319 #define DSO_F_DL_UNLOAD 107 | 353 #define DSO_F_DL_UNLOAD 107 |
320 #define DSO_F_DSO_BIND_FUNC 108 | 354 #define DSO_F_DSO_BIND_FUNC 108 |
321 #define DSO_F_DSO_BIND_VAR 109 | 355 #define DSO_F_DSO_BIND_VAR 109 |
322 #define DSO_F_DSO_CONVERT_FILENAME 126 | 356 #define DSO_F_DSO_CONVERT_FILENAME 126 |
323 #define DSO_F_DSO_CTRL 110 | 357 #define DSO_F_DSO_CTRL 110 |
324 #define DSO_F_DSO_FREE 111 | 358 #define DSO_F_DSO_FREE 111 |
325 #define DSO_F_DSO_GET_FILENAME 127 | 359 #define DSO_F_DSO_GET_FILENAME 127 |
326 #define DSO_F_DSO_GET_LOADED_FILENAME 128 | 360 #define DSO_F_DSO_GET_LOADED_FILENAME 128 |
| 361 #define DSO_F_DSO_GLOBAL_LOOKUP 139 |
327 #define DSO_F_DSO_LOAD 112 | 362 #define DSO_F_DSO_LOAD 112 |
328 #define DSO_F_DSO_MERGE 132 | 363 #define DSO_F_DSO_MERGE 132 |
329 #define DSO_F_DSO_NEW_METHOD 113 | 364 #define DSO_F_DSO_NEW_METHOD 113 |
| 365 #define DSO_F_DSO_PATHBYADDR 140 |
330 #define DSO_F_DSO_SET_FILENAME 129 | 366 #define DSO_F_DSO_SET_FILENAME 129 |
331 #define DSO_F_DSO_SET_NAME_CONVERTER 122 | 367 #define DSO_F_DSO_SET_NAME_CONVERTER 122 |
332 #define DSO_F_DSO_UP_REF 114 | 368 #define DSO_F_DSO_UP_REF 114 |
| 369 #define DSO_F_GLOBAL_LOOKUP_FUNC 138 |
| 370 #define DSO_F_PATHBYADDR 137 |
333 #define DSO_F_VMS_BIND_SYM 115 | 371 #define DSO_F_VMS_BIND_SYM 115 |
334 #define DSO_F_VMS_LOAD 116 | 372 #define DSO_F_VMS_LOAD 116 |
335 #define DSO_F_VMS_MERGER 133 | 373 #define DSO_F_VMS_MERGER 133 |
336 #define DSO_F_VMS_UNLOAD 117 | 374 #define DSO_F_VMS_UNLOAD 117 |
337 #define DSO_F_WIN32_BIND_FUNC 118 | 375 #define DSO_F_WIN32_BIND_FUNC 118 |
338 #define DSO_F_WIN32_BIND_VAR 119 | 376 #define DSO_F_WIN32_BIND_VAR 119 |
| 377 #define DSO_F_WIN32_GLOBALLOOKUP 142 |
| 378 #define DSO_F_WIN32_GLOBALLOOKUP_FUNC 143 |
339 #define DSO_F_WIN32_JOINER 135 | 379 #define DSO_F_WIN32_JOINER 135 |
340 #define DSO_F_WIN32_LOAD 120 | 380 #define DSO_F_WIN32_LOAD 120 |
341 #define DSO_F_WIN32_MERGER 134 | 381 #define DSO_F_WIN32_MERGER 134 |
342 #define DSO_F_WIN32_NAME_CONVERTER 125 | 382 #define DSO_F_WIN32_NAME_CONVERTER 125 |
| 383 #define DSO_F_WIN32_PATHBYADDR 141 |
343 #define DSO_F_WIN32_SPLITTER 136 | 384 #define DSO_F_WIN32_SPLITTER 136 |
344 #define DSO_F_WIN32_UNLOAD 121 | 385 #define DSO_F_WIN32_UNLOAD 121 |
345 | 386 |
346 /* Reason codes. */ | 387 /* Reason codes. */ |
347 #define DSO_R_CTRL_FAILED 100 | 388 #define DSO_R_CTRL_FAILED 100 |
348 #define DSO_R_DSO_ALREADY_LOADED 110 | 389 #define DSO_R_DSO_ALREADY_LOADED 110 |
349 #define DSO_R_EMPTY_FILE_STRUCTURE 113 | 390 #define DSO_R_EMPTY_FILE_STRUCTURE 113 |
350 #define DSO_R_FAILURE 114 | 391 #define DSO_R_FAILURE 114 |
351 #define DSO_R_FILENAME_TOO_BIG 101 | 392 #define DSO_R_FILENAME_TOO_BIG 101 |
352 #define DSO_R_FINISH_FAILED 102 | 393 #define DSO_R_FINISH_FAILED 102 |
353 #define DSO_R_INCORRECT_FILE_SYNTAX 115 | 394 #define DSO_R_INCORRECT_FILE_SYNTAX 115 |
354 #define DSO_R_LOAD_FAILED 103 | 395 #define DSO_R_LOAD_FAILED 103 |
355 #define DSO_R_NAME_TRANSLATION_FAILED 109 | 396 #define DSO_R_NAME_TRANSLATION_FAILED 109 |
356 #define DSO_R_NO_FILENAME 111 | 397 #define DSO_R_NO_FILENAME 111 |
357 #define DSO_R_NO_FILE_SPECIFICATION 116 | 398 #define DSO_R_NO_FILE_SPECIFICATION 116 |
358 #define DSO_R_NULL_HANDLE 104 | 399 #define DSO_R_NULL_HANDLE 104 |
359 #define DSO_R_SET_FILENAME_FAILED 112 | 400 #define DSO_R_SET_FILENAME_FAILED 112 |
360 #define DSO_R_STACK_ERROR 105 | 401 #define DSO_R_STACK_ERROR 105 |
361 #define DSO_R_SYM_FAILURE 106 | 402 #define DSO_R_SYM_FAILURE 106 |
362 #define DSO_R_UNLOAD_FAILED 107 | 403 #define DSO_R_UNLOAD_FAILED 107 |
363 #define DSO_R_UNSUPPORTED 108 | 404 #define DSO_R_UNSUPPORTED 108 |
364 | 405 |
365 #ifdef __cplusplus | 406 #ifdef __cplusplus |
366 } | 407 } |
367 #endif | 408 #endif |
368 #endif | 409 #endif |
OLD | NEW |