Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*) set HTTPS port if enabled *) improved data structures (may not be final) *) moved UPnP to own package
- Loading branch information
Showing
5 changed files
with
214 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// UPnPMapping.java | ||
// (C) 2014 by Marc Nause; marc.nause@gmx.de | ||
// first published 26.08.2014 on http://yacy.net | ||
// | ||
// This is a part of YaCy, a peer-to-peer based web search engine | ||
// | ||
// LICENSE | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program; if not, write to the Free Software | ||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
||
package net.yacy.utils.upnp; | ||
|
||
/** | ||
* Simple value holder class for all values required for UPnP mapping. Class is | ||
* package private since we only need to create new instances in the UPnP | ||
* package. | ||
* | ||
* @author Marc Nause | ||
*/ | ||
class UPnPMapping { | ||
|
||
private final String PROTOCOL; | ||
private final String DESCRIPTION; | ||
private final String CONFIG_PORT_KEY; | ||
private final String CONFIG_ENABLED_KEY; | ||
private int port; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param configPortKey | ||
* key for port in yacy.config | ||
* @param configEnabledKey | ||
* key for flag if port is enabled in yacy.config (optional, set | ||
* to empty or <code>null</code> if none is required | ||
* @param protocol | ||
* {"TCP"|"UDP"} | ||
* @param description | ||
* human readable description, may be displayed in router | ||
*/ | ||
UPnPMapping(final String configPortKey, final String configEnabledKey, | ||
final String protocol, final String description) { | ||
PROTOCOL = protocol; | ||
DESCRIPTION = description; | ||
CONFIG_PORT_KEY = configPortKey; | ||
CONFIG_ENABLED_KEY = configEnabledKey; | ||
} | ||
|
||
public int getPort() { | ||
return port; | ||
} | ||
|
||
public void setPort(int port) { | ||
this.port = port; | ||
} | ||
|
||
public String getProtocol() { | ||
return PROTOCOL; | ||
} | ||
|
||
public String getDescription() { | ||
return DESCRIPTION; | ||
} | ||
|
||
public String getConfigPortKey() { | ||
return CONFIG_PORT_KEY; | ||
} | ||
|
||
public String getConfigEnabledKey() { | ||
return CONFIG_ENABLED_KEY; | ||
} | ||
|
||
public boolean isConfigEnabledKeyEmpty() { | ||
return CONFIG_ENABLED_KEY == null || CONFIG_ENABLED_KEY.isEmpty(); | ||
} | ||
|
||
} |
Oops, something went wrong.