Interface DynamicLinker


  • public interface DynamicLinker
    Low level secure dynamic linker access.
    • Field Detail

      • DEBUG

        static final boolean DEBUG
      • DEBUG_LOOKUP

        static final boolean DEBUG_LOOKUP
    • Method Detail

      • openLibraryGlobal

        long openLibraryGlobal​(NativeLibrary.LibPath libpath,
                               boolean debug)
                        throws SecurityException
        If a SecurityManager is installed, user needs link permissions for the named library.

        Opens the named library, allowing system wide access for other users.

        Parameters:
        libpath - the LibPath for the library to open
        debug - set to true to enable debugging
        Returns:
        the library handle, maybe 0 if not found.
        Throws:
        SecurityException - if user is not granted access for the named library.
      • openLibraryLocal

        long openLibraryLocal​(NativeLibrary.LibPath libpath,
                              boolean debug)
                       throws SecurityException
        If a SecurityManager is installed, user needs link permissions for the named library.

        Opens the named library, restricting access to this process.

        Parameters:
        libpath - the LibPath for the library to open
        debug - set to true to enable debugging
        Returns:
        the library handle, maybe 0 if not found.
        Throws:
        SecurityException - if user is not granted access for the named library.
      • lookupLibraryPathname

        String lookupLibraryPathname​(long libraryHandle,
                                     String symbolName)
                              throws SecurityException
        Security checks are implicit by previous call of #openLibraryLocal(String, boolean) or #openLibraryGlobal(String, boolean) retrieving the librarHandle.
        Parameters:
        libraryHandle - a library handle previously retrieved via #openLibraryLocal(String, boolean) or #openLibraryGlobal(String, boolean).
        symbolName - optional symbol name for an OS which requires the symbol's address to retrieve the path of the containing library
        Returns:
        the library pathname if found and supported by OS or null.
        Throws:
        IllegalArgumentException - in case case libraryHandle is unknown.
        SecurityException - if user is not granted access for the given library handle
      • lookupSymbolGlobal

        long lookupSymbolGlobal​(String symbolName)
                         throws SecurityException
        If a SecurityManager is installed, user needs link permissions for all libraries, i.e. for new RuntimePermission("loadLibrary.*");!
        Parameters:
        symbolName - global symbol name to lookup up system wide.
        Returns:
        the library handle, maybe 0 if not found.
        Throws:
        SecurityException - if user is not granted access for all libraries.
      • lookupSymbol

        long lookupSymbol​(long libraryHandle,
                          String symbolName)
                   throws SecurityException,
                          IllegalArgumentException
        Security checks are implicit by previous call of #openLibraryLocal(String, boolean) or #openLibraryGlobal(String, boolean) retrieving the librarHandle.
        Parameters:
        libraryHandle - a library handle previously retrieved via #openLibraryLocal(String, boolean) or #openLibraryGlobal(String, boolean).
        symbolName - global symbol name to lookup up system wide.
        Returns:
        the library handle, maybe 0 if not found.
        Throws:
        IllegalArgumentException - in case case libraryHandle is unknown.
        SecurityException - if user is not granted access for the given library handle
      • closeLibrary

        void closeLibrary​(long libraryHandle,
                          boolean debug)
                   throws SecurityException,
                          IllegalArgumentException
        Security checks are implicit by previous call of #openLibraryLocal(String, boolean) or #openLibraryGlobal(String, boolean) retrieving the librarHandle.
        Parameters:
        libraryHandle - a library handle previously retrieved via #openLibraryLocal(String, boolean) or #openLibraryGlobal(String, boolean).
        debug - set to true to enable debugging
        Throws:
        IllegalArgumentException - in case case libraryHandle is unknown.
        SecurityException - if user is not granted access for the given library handle
      • getLastError

        String getLastError()
        Returns a string containing the last error. Maybe called for debuging purposed if any method fails.
        Returns:
        error string, maybe null. A null or non-null value has no semantics.