From 1274944f9ef93ddec2558eb6f80a608d599ee2f9 Mon Sep 17 00:00:00 2001 From: ELynx Date: Fri, 9 Sep 2016 00:47:12 +0300 Subject: [PATCH] Interface for single module #18 --- .../elynx/pogoxmitm/module/ModuleManager.java | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 app/src/main/java/com/elynx/pogoxmitm/module/ModuleManager.java diff --git a/app/src/main/java/com/elynx/pogoxmitm/module/ModuleManager.java b/app/src/main/java/com/elynx/pogoxmitm/module/ModuleManager.java new file mode 100644 index 0000000..860afed --- /dev/null +++ b/app/src/main/java/com/elynx/pogoxmitm/module/ModuleManager.java @@ -0,0 +1,69 @@ +package com.elynx.pogoxmitm.module; + +import com.github.aeonlucid.pogoprotos.networking.Requests; + +import com.google.protobuf.ByteString; + +import java.util.List; + +/** + * Interface defining communications between MitM provider and single hack + */ +public interface ModuleManager { + /** + * Module name in module list + * @return Module name + */ + String userspaceName(); + + /** + * Module description in module list + * @return Module brief description + */ + String userspaceBrief(); + + /** + * Module "about" info, presented to user on demand + * Will be rendered as HTML + * @return Module about info + */ + String userspaceInfo(); + + /** + * Called once per module life cycle + * Upon call module starts with default environment + * Failed modules do not receive any communications, and are off/disabled in module list + * @return True if module may be executed, False otherwise + */ + boolean init(); + + /** + * Types of requests this module wants to receive + * May be different from response types + * @return Request types processed in module + */ + List requestTypes(); + + /** + * Types of responses this module wants to receive + * May be different from request types + * @return Response types processed in module + */ + List responseTypes(); + + /** + * Process request from client to server + * @param type Type of request + * @param data Data of request + * @return Modified data if changes are made, null otherwise + */ + ByteString processRequest(Requests.RequestType type, ByteString data); + + /** + * Process response from server to client + * @param type Type of response + * @param data Data of response + * @return Modified data if changes are made, null otherwise + */ + ByteString processResponse(Requests.RequestType type, ByteString data); +}