1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package de.tudarmstadt.informatik.hostage.protocol;
- import java.util.List;
- import de.tudarmstadt.informatik.hostage.wrapper.Packet;
- /**
- * Interface for protocols that are used by the application.
- * @author Mihai Plasoianu
- * @author Wulf Pfeiffer
- */
- public interface Protocol {
- /**
- * Represents who starts the communication once the connection is established.
- */
- public static enum TALK_FIRST {
- SERVER, CLIENT
- };
- /**
- * Returns the default port on which the protocol is running.
- * @return the default port used by the protocol (range: 0-65535)
- */
- int getDefaultPort();
- /**
- * Returns who starts the communication (server or client)
- * @return TALK_FIRST.server if the server starts or TALK_FIRST.client if the client starts.
- */
- TALK_FIRST whoTalksFirst();
- /**
- * Determines the next message that is sent by the server.
- * @param packet last message that was sent by the client.
- * @return next message that will be sent.
- */
- List<Packet> processMessage(Packet packet);
- /**
- * Returns whether the communication is ended and the connection should be closed or not.
- * @return true if the connection should be closed, else false.
- */
- boolean isClosed();
- /**
- * Returns if the protocol uses SSL/TLS connection or not.
- * @return true if SSL/TLS is used, else false.
- */
- boolean isSecure();
- /**
- * Returns what type the protocol is using, Strings or ByteArrays.
- * @return the class that the protocol is using.
- */
- Class<? extends Object> getType();
-
- /**
- * Returns the name of the protocol.
- * @return name of the protocol
- */
- @Override
- String toString();
-
- }
|