Commit 3e1aa057 authored by Thiago Camargo's avatar Thiago Camargo Committed by thiago

Multiple STUN Servers Support

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@7647 b35dd754-fafc-0310-a699-88a17e54d16e
parent d0159f47
...@@ -2124,5 +2124,14 @@ stun.settings.secondaryaddress = Sekund\u00e1rn\u00ed adresa ...@@ -2124,5 +2124,14 @@ stun.settings.secondaryaddress = Sekund\u00e1rn\u00ed adresa
stun.settings.primaryport = Prim\u00e1rn\u00ed port stun.settings.primaryport = Prim\u00e1rn\u00ed port
stun.settings.secondaryport = Sekund\u00e1rn\u00ed stun.settings.secondaryport = Sekund\u00e1rn\u00ed
stun.settings.enabled = Povoleno stun.settings.enabled = Povoleno
stun.settings.change = Zm\u011bna stun.settings.change = Zm\u011bna\
stun.external.title = External Stun Servers
stun.external.comment = Server will also send the following address(es) to client.
stun.external.server = Server
stun.external.port = Port
stun.external.error = You must inform Server and Port.
stun.external.add = Add
stun.external.delete = Delete
index.certificate-warning=Found RSA certificate that is not valid for the server domain. index.certificate-warning=Found RSA certificate that is not valid for the server domain.
\ No newline at end of file
...@@ -2043,6 +2043,14 @@ stun.settings.primaryport = Primary Port Value ...@@ -2043,6 +2043,14 @@ stun.settings.primaryport = Primary Port Value
stun.settings.secondaryport = Secondary Port Value stun.settings.secondaryport = Secondary Port Value
stun.settings.enabled = Enabled stun.settings.enabled = Enabled
stun.settings.change = Change stun.settings.change = Change
stun.external.title = External Stun Servers
stun.external.comment = Server will also send the following address(es) to client.
stun.external.server = Server
stun.external.port = Port
stun.external.error = You must inform Server and Port.
stun.external.add = Add
stun.external.delete = Delete
admin.console.restarting=Restarting admin console... admin.console.restarting=Restarting admin console...
global.click_test=Click to test... global.click_test=Click to test...
global.day=day global.day=day
......
...@@ -2340,7 +2340,15 @@ stun.settings.secondaryaddress = Secondary Address ...@@ -2340,7 +2340,15 @@ stun.settings.secondaryaddress = Secondary Address
stun.settings.primaryport = Primary Port Value stun.settings.primaryport = Primary Port Value
stun.settings.secondaryport = Secondary Port Value stun.settings.secondaryport = Secondary Port Value
stun.settings.enabled = Enabled stun.settings.enabled = Enabled
stun.settings.localenabled = Local Server Enabled
stun.settings.change = Change stun.settings.change = Change
stun.external.title = External Stun Servers
stun.external.comment = Server will also send the following address(es) to client.
stun.external.server = Server
stun.external.port = Port
stun.external.error = You must inform Server and Port.
stun.external.add = Add
stun.external.delete = Delete
# Import signed certificate page # Import signed certificate page
......
...@@ -2123,4 +2123,12 @@ stun.settings.primaryport = Puerto Primario ...@@ -2123,4 +2123,12 @@ stun.settings.primaryport = Puerto Primario
stun.settings.secondaryport = Puerto Secundario stun.settings.secondaryport = Puerto Secundario
stun.settings.enabled = Habilitado stun.settings.enabled = Habilitado
stun.settings.change = Cambiar stun.settings.change = Cambiar
stun.external.title = External Stun Servers
stun.external.comment = Server will also send the following address(es) to client.
stun.external.server = Server
stun.external.port = Port
stun.external.error = You must inform Server and Port.
stun.external.add = Add
stun.external.delete = Delete
index.certificate-warning=Se ha encontrado un certificado RSA que no es v\u00e1lido para el dominio del servidor. index.certificate-warning=Se ha encontrado un certificado RSA que no es v\u00e1lido para el dominio del servidor.
\ No newline at end of file
...@@ -1710,6 +1710,14 @@ stun.settings.primaryport = Primary Port Value ...@@ -1710,6 +1710,14 @@ stun.settings.primaryport = Primary Port Value
stun.settings.secondaryport = Secondary Port Value stun.settings.secondaryport = Secondary Port Value
stun.settings.enabled = Enabled stun.settings.enabled = Enabled
stun.settings.change = Change stun.settings.change = Change
stun.external.title = External Stun Servers
stun.external.comment = Server will also send the following address(es) to client.
stun.external.server = Server
stun.external.port = Port
stun.external.error = You must inform Server and Port.
stun.external.add = Add
stun.external.delete = Delete
httpbind.settings.enabled.legend=Service Enabled httpbind.settings.enabled.legend=Service Enabled
httpbind.settings.info=HTTP binding allows clients using the HTTP protocol to connect to Wildfire. httpbind.settings.info=HTTP binding allows clients using the HTTP protocol to connect to Wildfire.
httpbind.settings.label_disable=Disabled httpbind.settings.label_disable=Disabled
......
...@@ -2050,6 +2050,14 @@ stun.settings.primaryport = Primary Port Value ...@@ -2050,6 +2050,14 @@ stun.settings.primaryport = Primary Port Value
stun.settings.secondaryport = Secondary Port Value stun.settings.secondaryport = Secondary Port Value
stun.settings.enabled = Enabled stun.settings.enabled = Enabled
stun.settings.change = Change stun.settings.change = Change
stun.external.title = External Stun Servers
stun.external.comment = Server will also send the following address(es) to client.
stun.external.server = Server
stun.external.port = Port
stun.external.error = You must inform Server and Port.
stun.external.add = Add
stun.external.delete = Delete
admin.console.restarting=Restarting admin console... admin.console.restarting=Restarting admin console...
global.click_test=Click to test... global.click_test=Click to test...
global.day=day global.day=day
......
...@@ -2025,6 +2025,14 @@ stun.settings.primaryport = Primary Port Value ...@@ -2025,6 +2025,14 @@ stun.settings.primaryport = Primary Port Value
stun.settings.secondaryport = Secondary Port Value stun.settings.secondaryport = Secondary Port Value
stun.settings.enabled = Enabled stun.settings.enabled = Enabled
stun.settings.change = Change stun.settings.change = Change
stun.external.title = External Stun Servers
stun.external.comment = Server will also send the following address(es) to client.
stun.external.server = Server
stun.external.port = Port
stun.external.error = You must inform Server and Port.
stun.external.add = Add
stun.external.delete = Delete
global.click_test=Click to test... global.click_test=Click to test...
global.day=day global.day=day
global.days=days global.days=days
......
...@@ -2123,4 +2123,12 @@ stun.settings.primaryport = Porta Prim\u00e1ria ...@@ -2123,4 +2123,12 @@ stun.settings.primaryport = Porta Prim\u00e1ria
stun.settings.secondaryport = Porta Secund\u00e1ria stun.settings.secondaryport = Porta Secund\u00e1ria
stun.settings.enabled = Habilitado stun.settings.enabled = Habilitado
stun.settings.change = Modificar stun.settings.change = Modificar
stun.external.title = External Stun Servers
stun.external.comment = Server will also send the following address(es) to client.
stun.external.server = Server
stun.external.port = Port
stun.external.error = You must inform Server and Port.
stun.external.add = Add
stun.external.delete = Delete
setup.admin.settings.username-error=Nenhum usu\u00e1rio informado, ou o usu\u00e1rio informado n\u00e3o foi encontrado. setup.admin.settings.username-error=Nenhum usu\u00e1rio informado, ou o usu\u00e1rio informado n\u00e3o foi encontrado.
\ No newline at end of file
...@@ -1903,4 +1903,12 @@ stun.settings.secondaryaddress = \u4e8c\u7ea7\u5730\u5740 ...@@ -1903,4 +1903,12 @@ stun.settings.secondaryaddress = \u4e8c\u7ea7\u5730\u5740
stun.settings.primaryport = \u4e00\u7ea7\u7aef\u53e3\u503c stun.settings.primaryport = \u4e00\u7ea7\u7aef\u53e3\u503c
stun.settings.secondaryport = \u4e8c\u7ea7\u7aef\u53e3\u503c stun.settings.secondaryport = \u4e8c\u7ea7\u7aef\u53e3\u503c
stun.settings.enabled = \u542f\u7528 stun.settings.enabled = \u542f\u7528
stun.settings.change = \u53d8\u66f4 stun.settings.change = \u53d8\u66f4\
stun.external.title = External Stun Servers
stun.external.comment = Server will also send the following address(es) to client.
stun.external.server = Server
stun.external.port = Port
stun.external.error = You must inform Server and Port.
stun.external.add = Add
stun.external.delete = Delete
...@@ -50,14 +50,14 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou ...@@ -50,14 +50,14 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
private StunServer stunServer = null; private StunServer stunServer = null;
private String name = "stun"; private String name = "stun";
private boolean enabled = false; private boolean enabled = false;
private boolean localEnabled = false;
private String primaryAddress; private String primaryAddress;
private String secondaryAddress; private String secondaryAddress;
private int primaryPort = 3478; private int primaryPort = 3478;
private int secondaryPort = 3479; private int secondaryPort = 3479;
private String externalServerAddress = null; private List<StunServerAddress> externalServers = null;
private int externalServerPort = 3478;
public static final String NAMESPACE = "google:jingleinfo"; public static final String NAMESPACE = "google:jingleinfo";
...@@ -72,11 +72,11 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou ...@@ -72,11 +72,11 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
* Load config using JiveGlobals * Load config using JiveGlobals
*/ */
private void loadSTUNConfig() { private void loadSTUNConfig() {
primaryAddress = JiveGlobals.getProperty("stun.address.primary"); primaryAddress = JiveGlobals.getProperty("stun.address.primary");
secondaryAddress = JiveGlobals.getProperty("stun.address.secondary"); secondaryAddress = JiveGlobals.getProperty("stun.address.secondary");
externalServerAddress = JiveGlobals.getProperty("stun.external.address"); externalServers = getStunServerAddresses(JiveGlobals.getProperty("stun.external.addresses"));
externalServerAddress = JiveGlobals.getProperty("stun.external.port");
if (primaryAddress == null || primaryAddress.equals("")) if (primaryAddress == null || primaryAddress.equals(""))
primaryAddress = JiveGlobals.getProperty("xmpp.domain", primaryAddress = JiveGlobals.getProperty("xmpp.domain",
...@@ -99,6 +99,7 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou ...@@ -99,6 +99,7 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
} }
this.enabled = JiveGlobals.getBooleanProperty("stun.enabled", true); this.enabled = JiveGlobals.getBooleanProperty("stun.enabled", true);
this.localEnabled = JiveGlobals.getBooleanProperty("stun.local.enabled", true);
} }
...@@ -118,13 +119,15 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou ...@@ -118,13 +119,15 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
public void start() { public void start() {
if (isEnabled()) { if (isEnabled()) {
startServer(); startService();
if (isLocalEnabled())
startLocalServer();
} else { } else {
XMPPServer.getInstance().getIQDiscoItemsHandler().removeServerItemsProvider(this); XMPPServer.getInstance().getIQDiscoItemsHandler().removeServerItemsProvider(this);
} }
} }
public void startServer() { public void startLocalServer() {
try { try {
InetAddress primary = InetAddress.getByName(primaryAddress); InetAddress primary = InetAddress.getByName(primaryAddress);
...@@ -136,34 +139,37 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou ...@@ -136,34 +139,37 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
stunServer.start(); stunServer.start();
} else } else
setEnabled(false); setLocalEnabled(false);
} catch (SocketException e) { } catch (SocketException e) {
Log.error("Disabling STUN server", e); Log.error("Disabling STUN server", e);
setEnabled(false); setLocalEnabled(false);
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
Log.error("Disabling STUN server", e); Log.error("Disabling STUN server", e);
setEnabled(false); setLocalEnabled(false);
}
} }
if (stunServer != null) { public void startService() {
routingTable.addRoute(getAddress(), this); routingTable.addRoute(getAddress(), this);
XMPPServer server = XMPPServer.getInstance(); XMPPServer server = XMPPServer.getInstance();
server.getIQDiscoItemsHandler().addServerItemsProvider(this); server.getIQDiscoItemsHandler().addServerItemsProvider(this);
} }
}
public void stop() { public void stop() {
super.stop(); super.stop();
this.enabled = false; this.enabled = false;
if (stunServer != null)
stunServer.stop();
stunServer = null;
XMPPServer.getInstance().getIQDiscoItemsHandler().removeComponentItem(getAddress().toString()); XMPPServer.getInstance().getIQDiscoItemsHandler().removeComponentItem(getAddress().toString());
if (routingTable != null) if (routingTable != null)
routingTable.removeRoute(getAddress()); routingTable.removeRoute(getAddress());
} }
public void stopLocal() {
if (stunServer != null)
stunServer.stop();
stunServer = null;
}
public String getName() { public String getName() {
return serviceName; return serviceName;
} }
...@@ -210,10 +216,19 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou ...@@ -210,10 +216,19 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
return; return;
} else if (NAMESPACE.equals(namespace)) { } else if (NAMESPACE.equals(namespace)) {
if (isEnabled()) {
Element stun = childElementCopy.addElement("stun"); Element stun = childElementCopy.addElement("stun");
if (isLocalEnabled()) {
Element server = stun.addElement("server"); Element server = stun.addElement("server");
server.addAttribute("host", primaryAddress); server.addAttribute("host", primaryAddress);
server.addAttribute("udp", String.valueOf(primaryPort)); server.addAttribute("udp", String.valueOf(primaryPort));
}
for (StunServerAddress stunServerAddress : externalServers) {
Element server = stun.addElement("server");
server.addAttribute("host", stunServerAddress.getServer());
server.addAttribute("udp", stunServerAddress.getPort());
}
}
} else { } else {
// Answer an error since the server can't handle the requested namespace // Answer an error since the server can't handle the requested namespace
...@@ -245,6 +260,31 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou ...@@ -245,6 +260,31 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
return new JID(null, getServiceDomain(), null); return new JID(null, getServiceDomain(), null);
} }
public List<StunServerAddress> getExternalServers() {
return externalServers;
}
public void addExternalServer(String server, String port) {
externalServers.add(new StunServerAddress(server, port));
String property = "";
for (StunServerAddress stunServerAddress : externalServers) {
if (!property.equals("")) property += ";";
property += stunServerAddress.getServer() + ":" + stunServerAddress.getPort();
}
JiveGlobals.setProperty("stun.external.addresses", property);
}
public void removeExternalServer(int index) {
externalServers.remove(index);
String property = "";
for (StunServerAddress stunServerAddress : externalServers) {
if (!property.equals("")) property += ";";
property += stunServerAddress.getServer() + ":" + stunServerAddress.getPort();
}
JiveGlobals.setProperty("stun.external.addresses", property);
}
public Iterator<DiscoServerItem> getItems() { public Iterator<DiscoServerItem> getItems() {
List<DiscoServerItem> items = new ArrayList<DiscoServerItem>(); List<DiscoServerItem> items = new ArrayList<DiscoServerItem>();
if (!isEnabled()) { if (!isEnabled()) {
...@@ -313,20 +353,46 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou ...@@ -313,20 +353,46 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
return enabled; return enabled;
} }
/**
* Get if the local STUN Server is enabled.
*
* @return enabled
*/
public boolean isLocalEnabled() {
return localEnabled;
}
/** /**
* Set the service enable status. * Set the service enable status.
* *
* @param enabled boolean to enable or disable * @param enabled boolean to enable or disable
* @param localEnabled local Server enable or disable
*/ */
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled, boolean localEnabled) {
this.enabled = enabled; this.enabled = enabled;
this.localEnabled = localEnabled;
if (isEnabled()) { if (isEnabled()) {
startServer(); startService();
if (isLocalEnabled())
startLocalServer();
} else { } else {
stop(); stop();
} }
} }
/**
* Set the Local STUN Server enable status.
*
* @param enabled boolean to enable or disable
*/
public void setLocalEnabled(boolean enabled) {
this.localEnabled = enabled;
if (isLocalEnabled())
startLocalServer();
else
stopLocal();
}
/** /**
* Get the secondary Port used by the STUN server * Get the secondary Port used by the STUN server
* *
...@@ -378,7 +444,62 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou ...@@ -378,7 +444,62 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
} }
} }
} catch (Exception e) { } catch (Exception e) {
// Do Nothing
} }
return list; return list;
} }
/**
* Provides easy abstract to store STUN Server Addresses and Ports
*/
public class StunServerAddress {
private String server;
private String port;
public StunServerAddress(String server, String port) {
this.server = server;
this.port = port;
}
/**
* Get the Host Address
*
* @return Host Address
*/
public String getServer() {
return server;
}
/**
* Get STUN port
*
* @return the Server Port
*/
public String getPort() {
return port;
}
}
/**
* Abstraction method used to convert a String into a STUN Server Address List
*
* @param addresses the String representation of Server Addresses with their respective Ports (server1:port1;server2:port2)
* @return STUN Server Addresses List
*/
public List<StunServerAddress> getStunServerAddresses(String addresses) {
List<StunServerAddress> list = new ArrayList<StunServerAddress>();
if (addresses == null || addresses.equals("")) return list;
String servers[] = addresses.split(";");
for (String server : servers) {
String address[] = server.split(":");
list.add(new StunServerAddress(address[0], address[1]));
}
return list;
}
} }
...@@ -51,14 +51,16 @@ ...@@ -51,14 +51,16 @@
STUNService stunService = XMPPServer.getInstance().getSTUNService(); STUNService stunService = XMPPServer.getInstance().getSTUNService();
boolean save = request.getParameter("save") != null; boolean save = request.getParameter("save") != null;
boolean add = request.getParameter("add") != null;
int remove = ParamUtils.getIntParameter(request, "remove", -1);
boolean success = false; boolean success = false;
boolean enabled = false; boolean enabled = false;
boolean localEnabled = false;
String primaryAddress; String primaryAddress;
String secondaryAddress; String secondaryAddress;
int primaryPort = 3478; int primaryPort = 3478;
int secondaryPort = 3576; int secondaryPort = 3479;
if (save) { if (save) {
primaryPort = ParamUtils.getIntParameter(request, "primaryPort", primaryPort); primaryPort = ParamUtils.getIntParameter(request, "primaryPort", primaryPort);
...@@ -76,23 +78,47 @@ ...@@ -76,23 +78,47 @@
enabled = ParamUtils.getBooleanParameter(request, "enabled", enabled); enabled = ParamUtils.getBooleanParameter(request, "enabled", enabled);
JiveGlobals.setProperty("stun.enabled", String.valueOf(enabled)); JiveGlobals.setProperty("stun.enabled", String.valueOf(enabled));
localEnabled = ParamUtils.getBooleanParameter(request, "localEnabled", localEnabled);
JiveGlobals.setProperty("stun.local.enabled", String.valueOf(localEnabled));
stunService.stop(); stunService.stop();
stunService.initialize(XMPPServer.getInstance()); stunService.initialize(XMPPServer.getInstance());
stunService.setEnabled(enabled); if (!enabled) localEnabled = false;
stunService.setEnabled(enabled, localEnabled);
success = stunService.isEnabled() == enabled && stunService.isLocalEnabled() == localEnabled;
} else if (remove > -1) {
stunService.removeExternalServer(remove);
success = true;
} else if (add) {
String server = ParamUtils.getParameter(request, "externalServer", true);
String port = ParamUtils.getParameter(request, "externalPort", true);
success = stunService.isEnabled() == enabled; if (server != null && port != null)
if (!server.equals("") && !port.equals("")) {
if (server.indexOf(';') == -1 && server.indexOf(',') == -1 && server.indexOf('@') == -1) {
if (port.indexOf(';') == -1 && port.indexOf(',') == -1 && port.indexOf('@') == -1) {
stunService.addExternalServer(server, port);
success = true;
}
}
}
} }
%> %>
<html> <html>
<head> <head>
<title><fmt:message key="stun.settings.title" /></title> <title>
<fmt:message key="stun.settings.title"/>
</title>
<meta name="pageID" content="stun-settings"/> <meta name="pageID" content="stun-settings"/>
</head> </head>
<body> <body>
<p> <p>
<fmt:message key="stun.settings.desc" /> <fmt:message key="stun.settings.desc"/>
</p> </p>
<% if (success) { %> <% if (success) { %>
...@@ -103,7 +129,9 @@ ...@@ -103,7 +129,9 @@
<tr> <tr>
<td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" <td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16"
border="0" alt="Success"></td> border="0" alt="Success"></td>
<td class="jive-icon-label"><fmt:message key="stun.settings.success" /></td> <td class="jive-icon-label">
<fmt:message key="stun.settings.success"/>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
...@@ -118,7 +146,25 @@ ...@@ -118,7 +146,25 @@
<tr> <tr>
<td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" <td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16"
border="0"></td> border="0"></td>
<td class="jive-icon-label"><fmt:message key="stun.settings.error" /> <td class="jive-icon-label">
<fmt:message key="stun.settings.error"/>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<% } else if (add) { %>
<div class="jive-error">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16"
border="0"></td>
<td class="jive-icon-label">
<fmt:message key="stun.external.error"/>
</td> </td>
</tr> </tr>
</tbody> </tbody>
...@@ -128,19 +174,22 @@ ...@@ -128,19 +174,22 @@
<% } %> <% } %>
<form action="" method="post" name="settings"> <form action="" method="post" name="settings">
<div class="jive-contentBoxHeader"> <div class="jive-contentBoxHeader">
<fmt:message key="stun.settings.title" /> <fmt:message key="stun.settings.title"/>
</div> </div>
<div class="jive-contentBox"> <div class="jive-contentBox">
<p> <p>
<fmt:message key="stun.settings.comment" /> <fmt:message key="stun.settings.comment"/>
</p> </p>
<table cellpadding="3" cellspacing="0" border="0" width="100%"> <table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody> <tbody>
<tr> <tr>
<td align="left"><fmt:message key="stun.settings.primaryaddress" />:&nbsp<select size="1" <td align="left">
<fmt:message key="stun.settings.primaryaddress"/>
:&nbsp<select size="1"
maxlength="100" maxlength="100"
name="primaryAddress" name="primaryAddress"
align="left"> align="left">
...@@ -160,9 +209,11 @@ ...@@ -160,9 +209,11 @@
<option value="<%=sname%>"><%=sname%> <option value="<%=sname%>"><%=sname%>
</option> </option>
</td> </td>
</tr> </tr>
<tr> <tr>
<td align="left"> <fmt:message key="stun.settings.secondaryaddress" />:&nbsp<select size="1" <td align="left">
<fmt:message key="stun.settings.secondaryaddress"/>
:&nbsp<select size="1"
maxlength="100" maxlength="100"
name="secondaryAddress" name="secondaryAddress"
align="left"> align="left">
...@@ -179,35 +230,129 @@ ...@@ -179,35 +230,129 @@
<option value="127.0.0.1">127.0.0.1</option> <option value="127.0.0.1">127.0.0.1</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td align="left"> <fmt:message key="stun.settings.primaryport" />:&nbsp<input type="text" size="20" <td align="left">
<fmt:message key="stun.settings.primaryport"/>
:&nbsp<input type="text" size="20"
maxlength="100" maxlength="100"
name="primaryPort" name="primaryPort"
value="<%=stunService.getPrimaryPort()%>" value="<%=stunService.getPrimaryPort()%>"
align="left"> align="left">
</td> </td>
</tr> </tr>
<tr> <tr>
<td align="left"><fmt:message key="stun.settings.secondaryport" />:&nbsp<input type="text" size="20" <td align="left">
<fmt:message key="stun.settings.secondaryport"/>
:&nbsp<input type="text" size="20"
maxlength="100" maxlength="100"
name="secondaryPort" name="secondaryPort"
value="<%=stunService.getSecondaryPort()%>" value="<%=stunService.getSecondaryPort()%>"
align="left"> align="left">
</td> </td>
</tr> </tr>
<tr> <tr>
<td align="left"><fmt:message key="stun.settings.enabled" />:&nbsp<input type="checkbox" <td align="left">
<fmt:message key="stun.settings.localenabled"/>
:&nbsp<input type="checkbox"
name="localEnabled"
<%=stunService.isLocalEnabled()?"checked":""%>
align="left">
</td>
</tr>
<tr>
<td align="left">
<fmt:message key="stun.settings.enabled"/>
:&nbsp<input type="checkbox"
name="enabled" name="enabled"
<%=stunService.isEnabled()?"checked":""%> <%=stunService.isEnabled()?"checked":""%>
align="left"> align="left">
</td> </td>
</tr>
<tr>
<td>
&nbsp;
</td>
</tr>
<tr>
<td>
<input type="hidden" name="save">
<input type="button" name="set" value="<fmt:message key="stun.settings.change" />"
onclick="checkAndSubmit()">
</td>
</tr>
</tbody>
</table>
</div>
</form>
<form action="" method="post" name="add">
<div class="jive-contentBoxHeader">
<fmt:message key="stun.external.title"/>
</div>
<div class="jive-contentBox">
<p>
<fmt:message key="stun.external.comment"/>
</p>
<table cellpadding="3" cellspacing="0" border="0" width="300">
<thead>
<tr>
<th nowrap align="left">
<fmt:message key="stun.external.server"/>
</th>
<th nowrap align="left">
<fmt:message key="stun.external.port"/>
</th>
<th nowrap align="left">
<fmt:message key="stun.external.delete"/>
</th>
</tr>
</thead>
<tbody>
<%
int i = 0;
for (STUNService.StunServerAddress stunServerAddress : stunService.getExternalServers()) {
%>
<tr>
<td align="left">
<%=stunServerAddress.getServer()%>
</td>
<td align="left">
<%=stunServerAddress.getPort()%>
</td>
<td align="center">
<a href="#" onclick="document.add.remove.value=<%=i++%>;document.add.submit();">
<img src="images/delete-16x16.gif" width="16" height="16" border="0"
alt="<fmt:message key="global.click_delete" />">
</a>
</td>
</tr>
<%
}
%>
<input type="hidden" name="remove" value="">
<tr>
<td align="left">
<input type="text" name="externalServer" size="20" maxlength="50">
</td>
<td align="left">
<input type="text" name="externalPort" size="6" maxlength="6">
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
</tr>
<tr>
<td>
<input type="submit" name="add" value="<fmt:message key="stun.external.add"/>">
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<input type="hidden" name="save">
<input type="button" name="set" value="<fmt:message key="stun.settings.change" />" onclick="checkAndSubmit()">
</form> </form>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment