Skip to content

A free, open-source alternative to Burp Suite: an intercepting proxy and web app security testing suite with Repeater, Intruder, Collaborator and a built-in OWASP ZAP scanner. Linux, AGPL-3.0.

1.4 KB
Raw Blame
package opensuite.core;

/**
 * The suite's side of an extension loaded at run time. The suite never keeps
 * what the extension hands it: a listener becomes a stand-in, one of the
 * suite's own objects, that offers each call to the extension's thread and
 * returns at once. So a callback that throws or blocks cannot hold the thread
 * that raised the event. Found for the code that is calling through
 * {@link ExtensionCode}, the loader its classes came from.
 */
public interface ExtensionRunner {

    /** Offer one call to the extension and return at once, whether or not it is taken. */
    void offer(Runnable call);

    /**
     * A stand-in for {@code listener}: it offers every call to the extension,
     * and is remembered so it can be taken off the suite's lists when the
     * extension unloads.
     */
    <T> T standIn(Class<? super T> type, T listener);

    /** The stand-in registered in place of {@code listener}, or null when this extension made none. */
    <T> T standInFor(T listener);

    /**
     * A stand-in for a sink an extension registered: {@code receive} is offered
     * to the extension, and {@code singleItem} answers what the sink said when
     * it registered, since the menus ask for that without waiting.
     */
    SuiteContext.MessageSink sink(SuiteContext.MessageSink sink);

    /** Run {@code undo} when the extension unloads, before anything else is done to it. */
    void onUnload(Runnable undo);
}