From a72d9db309c2ac4ec40dcd54159663138aeb0052 Mon Sep 17 00:00:00 2001 From: Maximilien LEDOUX Date: Tue, 15 Mar 2022 12:31:09 +0100 Subject: [PATCH] =?UTF-8?q?Regex=20:=20corrig=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../protocol/StandardizedDefinitions.java | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/lightcontainer/protocol/StandardizedDefinitions.java b/app/src/main/java/lightcontainer/protocol/StandardizedDefinitions.java index 9e699b0..5848f78 100644 --- a/app/src/main/java/lightcontainer/protocol/StandardizedDefinitions.java +++ b/app/src/main/java/lightcontainer/protocol/StandardizedDefinitions.java @@ -15,7 +15,7 @@ public class StandardizedDefinitions { private final static String PASSWORD = PASSCHAR + "{5,50}"; private final static String BL = "\\x20"; private final static String FILENAME = PASSCHAR + "{1,20}"; - private final static String DOMAIN = DIGIT_LETTER + "{5,20}[.]"; + private final static String DOMAIN = "[a-z-A-Z0-9\\.]{5,20}"; private final static String HASH_FILENAME = DIGIT_LETTER + "{50,200}"; private final static String HASH_FILECONTENT = DIGIT_LETTER + "{50,200}"; private final static String FILE_INFO = HASH_FILENAME + BL + SIZE + BL + HASH_FILECONTENT; @@ -23,34 +23,34 @@ public class StandardizedDefinitions { //Regex à utiliser dans les différents protocoles. //SBE s'annonce à FFE. - public final static String SBE_HELLO = "HELLO" + BL + "(" + DOMAIN + ")" + BL + "(" + PORT + ")" + LINE; + public final static String SBE_HELLO = "^HELLO" + BL + "(" + DOMAIN + ")" + BL + "(" + PORT + ")" + LINE + "$"; //FFE demande à SBE une tâche. SBE répond à FFE. - public final static String FFE_SENDFILE = "SENDFILE" + BL + FILE_INFO + LINE; - public final static String SBE_SEND_RESULT_OK = "SEND_OK" + LINE; - public final static String SBE_SEND_RESULT_ERROR = "SEND_ERROR" + LINE; - public final static String FFE_ERASE_FILE = "ERASEFILE" + BL + HASH_FILENAME + LINE; - public final static String SBE_ERASE_RESULT_OK = "ERASE_OK" + LINE; - public final static String SBE_ERASE_RESULT_ERROR = "ERASE_ERROR" + LINE; - public final static String FFE_RETRIEVE_FILE = "RETRIEVEFILE" + BL + HASH_FILENAME + LINE; - public final static String SBE_RETRIEVE_RESULT_OK = "RETRIEVE_OK" + BL + "(" + FILE_INFO + ")" + LINE; - public final static String SBE_RETRIEVE_RESULT_ERROR = "RETRIEVE_ERROR" + LINE; + public final static String FFE_SENDFILE = "^SENDFILE" + BL + FILE_INFO + LINE + "$"; + public final static String SBE_SEND_RESULT_OK = "^SEND_OK" + LINE + "$"; + public final static String SBE_SEND_RESULT_ERROR = "^SEND_ERROR" + LINE + "$"; + public final static String FFE_ERASE_FILE = "^ERASEFILE" + BL + HASH_FILENAME + LINE + "$"; + public final static String SBE_ERASE_RESULT_OK = "^ERASE_OK" + LINE + "$"; + public final static String SBE_ERASE_RESULT_ERROR = "^ERASE_ERROR" + LINE + "$"; + public final static String FFE_RETRIEVE_FILE = "^RETRIEVEFILE" + BL + HASH_FILENAME + LINE + "$"; + public final static String SBE_RETRIEVE_RESULT_OK = "^RETRIEVE_OK" + BL + "(" + FILE_INFO + ")" + LINE + "$"; + public final static String SBE_RETRIEVE_RESULT_ERROR = "^RETRIEVE_ERROR" + LINE + "$"; //Client demande à FFE une tâche. FFE répond à client. - public final static String CLIENT_SIGN_IN = "SIGNIN" + BL + "(" + LOGIN + ")" + BL + "(" + PASSWORD + ")" + LINE; - public final static String CLIENT_SIGN_UP = "SIGNUP" + BL + "(" + LOGIN + ")" + BL + "(" + PASSWORD + ")" + LINE; - public final static String FFE_SIGN_OK = "SIGN_OK" + LINE; - public final static String FFE_SIGN_ERROR = "SIGN_ERROR" + LINE; - public final static String CLIENT_FILE_LIST = "FILELIST" + LINE; - public final static String FFE_FILE_LIST_RESULT = "FILES" + "((" + PASSCHAR + "{1,20})!(" + DIGIT + "{1,10})){0,50}" + LINE; - public final static String CLIENT_SAVE_FILE = "SAVEFILE" + BL + "(" + FILENAME + ")" + BL + "(" + SIZE + ")" + LINE; - public final static String FFE_SAVE_FILE_OK = "SAVEFILE_OK" + LINE; - public final static String FFE_SAVE_FILE_ERROR = "SAVEFILE_ERROR" + LINE; - public final static String CLIENT_GET_FILE = "GETFILE" + BL + "(" + FILENAME + ")" + LINE; - public final static String FFE_GET_FILE_RESULT_OK = "GETFILE_OK" + BL + FILENAME + BL + SIZE + LINE; - public final static String FFE_GET_FILE_RESULT_ERROR = "GETFILE_ERROR" + LINE; - public final static String CLIENT_REMOVE_FILE = "REMOVEFILE" + BL + "(" + FILENAME + ")" + LINE; - public final static String FFE_REMOVE_OK = "REMOVEFILE_OK" + LINE; - public final static String FFE_REMOVE_ERROR = "REMOVEFILE_ERROR" + LINE; - public final static String CLIENT_SIGN_OUT = "SIGNOUT" + LINE; + public final static String CLIENT_SIGN_IN = "^SIGNIN" + BL + "(" + LOGIN + ")" + BL + "(" + PASSWORD + ")" + LINE + "$"; + public final static String CLIENT_SIGN_UP = "^SIGNUP" + BL + "(" + LOGIN + ")" + BL + "(" + PASSWORD + ")" + LINE + "$"; + public final static String FFE_SIGN_OK = "^SIGN_OK" + LINE + "$"; + public final static String FFE_SIGN_ERROR = "^SIGN_ERROR" + LINE + "$"; + public final static String CLIENT_FILE_LIST = "^FILELIST" + LINE + "$"; + public final static String FFE_FILE_LIST_RESULT = "^FILES" + "((" + PASSCHAR + "{1,20})!(" + DIGIT + "{1,10})){0,50}" + LINE + "$"; + public final static String CLIENT_SAVE_FILE = "^SAVEFILE" + BL + "(" + FILENAME + ")" + BL + "(" + SIZE + ")" + LINE + "$"; + public final static String FFE_SAVE_FILE_OK = "^SAVEFILE_OK" + LINE + "$"; + public final static String FFE_SAVE_FILE_ERROR = "^SAVEFILE_ERROR" + LINE + "$"; + public final static String CLIENT_GET_FILE = "^GETFILE" + BL + "(" + FILENAME + ")" + LINE + "$"; + public final static String FFE_GET_FILE_RESULT_OK = "^GETFILE_OK" + BL + FILENAME + BL + SIZE + LINE + "$"; + public final static String FFE_GET_FILE_RESULT_ERROR = "^GETFILE_ERROR" + LINE + "$"; + public final static String CLIENT_REMOVE_FILE = "^REMOVEFILE" + BL + "(" + FILENAME + ")" + LINE + "$"; + public final static String FFE_REMOVE_OK = "^REMOVEFILE_OK" + LINE + "$"; + public final static String FFE_REMOVE_ERROR = "^REMOVEFILE_ERROR" + LINE + "$"; + public final static String CLIENT_SIGN_OUT = "^SIGNOUT" + LINE + "$"; }