@@ -0,0 +1,2050 @@
+/**%0A * %0A */%0Apackage org.jitsi.turnserver.listeners;%0A%0Aimport java.util.logging.Level;%0Aimport java.util.logging.Logger;%0A%0Aimport org.ice4j.StunMessageEvent;%0Aimport org.ice4j.message.Message;%0Aimport org.ice4j.message.Response;%0Aimport org.ice4j.stack.RequestListener;%0Aimport org.ice4j.stack.StunStack;%0A%0A/**%0A * The class that would be handling and responding to incoming ConnectionBind requests that are%0A * validated and sends a success or error response%0A * %0A * @author Aakash Garg%0A */%0Apublic class ConnectionBindRequestListener %0A%09%09implements RequestListener %0A%7B%0A%0A%09/**%0A%09 * The %3Ctt%3ELogger%3C/tt%3E used by the %3Ctt%3EConnectionBindRequestListener%3C/tt%3E class%0A%09 * and its instances for logging output.%0A%09 */%0A%09private static final Logger logger %0A%09%09= Logger.getLogger(ConnectionBindRequestListener.class.getName());%0A%0A%09private final StunStack stunStack;%0A%0A%09/**%0A%09 * The indicator which determines whether this%0A%09 * %3Ctt%3EConnectionBindrequestListener%3C/tt%3E is currently started.%0A%09 */%0A%09private boolean started = false;%0A%0A%09/**%0A%09 * Creates a new ConnectionBindRequestListener%0A%09 * %0A%09 * @param stunStack%0A%09 */%0A%09public ConnectionBindRequestListener(StunStack stunStack) %0A%09%7B%0A%09%09this.stunStack = stunStack;%0A%09%7D%0A%0A%09@Override%0A%09public void processRequest(StunMessageEvent evt)%0A%09%09%09throws IllegalArgumentException %0A%09%7B%0A%09%09if (logger.isLoggable(Level.FINER))%0A%09%09%7B%0A%09%09%09logger.finer(%22Received request %22 + evt);%0A%09%09%7D%0A%09%09Message message = evt.getMessage();%0A%09%09if(message.getMessageType()==Message.ALLOCATE_REQUEST)%0A%09%09%7B%0A%09%09    Response response = null;%0A%09%09    //processing logic%0A%09%09%7D%0A%09%09else%0A%09%09%7B%0A%09%09    return;%0A%09%09%7D%0A%09%7D%0A%0A%09/**%0A%09 * Starts this %3Ctt%3EConnectionBindRequestListener%3C/tt%3E. If it is not currently%0A%09 * running, does nothing.%0A%09 */%0A%09public void start() %0A%09%7B%0A%09%09if (!started) %0A%09%09%7B%0A%09%09%09stunStack.addRequestListener(this);%0A%09%09%09started = true;%0A%09%09%7D%0A%09%7D%0A%0A%09/**%0A%09 * Stops this %3Ctt%3EConnectionBindRequestListenerr%3C/tt%3E. A stopped%0A%09 * %3Ctt%3EConnectionBindRequestListenerr%3C/tt%3E can be restarted by calling%0A%09 * %7B@link #start()%7D on it.%0A%09 */%0A%09public void stop() %0A%09%7B%0A%09%09stunStack.removeRequestListener(this);%0A%09%09started = false;%0A%09%7D%0A%0A%7D%0A

Add ConnectionBindRequestListener