Package net.yacy.upnp.messages

Examples of net.yacy.upnp.messages.ActionMessage


  }
 
  private boolean testWANInterface( UPNPService srv ) {
    UPNPMessageFactory tmp = UPNPMessageFactory.getNewInstance( srv );
   
    ActionMessage msg = tmp.getMessage( "GetExternalIPAddress" );
    String ipToParse = null;
    try {
      ipToParse = msg.service().getOutActionArgumentValue( "NewExternalIPAddress" );
    } catch ( UPNPResponseException ex ) {
      // ok probably not the IP interface
    } catch ( IOException ex ) {
      // not really normal
      log.warn( "IOException occured during device detection", ex );
View Full Code Here


   * @return a String representing the external IP
   * @throws UPNPResponseException if the devices returns an error code
   * @throws IOException if some error occurs during communication with the device
   */
  public String getExternalIPAddress() throws UPNPResponseException, IOException {
    ActionMessage msg = msgFactory.getMessage( "GetExternalIPAddress" );
    return msg.service().getOutActionArgumentValue( "NewExternalIPAddress" );
  }
View Full Code Here

   * @throws IOException if some error occurs during communication with the device
   * @throws UPNPResponseException if some unexpected error occurs on the UPNP device
   */
  public ActionResponse getGenericPortMappingEntry( int newPortMappingIndex ) throws IOException, UPNPResponseException {

    ActionMessage msg = msgFactory.getMessage( "GetGenericPortMappingEntry" );
    msg.setInputParameter( "NewPortMappingIndex", newPortMappingIndex );

    try {
      return msg.service();
    } catch ( UPNPResponseException ex ) {
      if ( ex.getDetailErrorCode() == 714 ) {
        return null;
      }
      throw ex;
View Full Code Here

  public ActionResponse getSpecificPortMappingEntry( String remoteHost, int externalPort, String protocol ) throws IOException, UPNPResponseException {
    remoteHost = remoteHost == null ? "" : remoteHost;
    checkPortMappingProtocol( protocol );
    checkPortRange( externalPort );
   
    ActionMessage msg = msgFactory.getMessage( "GetSpecificPortMappingEntry" );
    msg.setInputParameter( "NewRemoteHost", remoteHost )
       .setInputParameter( "NewExternalPort", externalPort )
       .setInputParameter( "NewProtocol", protocol );

    try {
      return msg.service();
    } catch ( UPNPResponseException ex ) {
      if ( ex.getDetailErrorCode() == 714 ) {
        return null;
      }
      throw ex;
View Full Code Here

    }
    checkPortRange( internalPort );
    description = description == null ? "" : description;
    if ( leaseDuration < 0 ) throw new IllegalArgumentException( "Invalid leaseDuration (" + leaseDuration + ") value" );

    ActionMessage msg = msgFactory.getMessage( "AddPortMapping" );
    msg.setInputParameter( "NewRemoteHost", remoteHost )
       .setInputParameter( "NewExternalPort", externalPort )
       .setInputParameter( "NewProtocol", protocol )
       .setInputParameter( "NewInternalPort", internalPort )
       .setInputParameter( "NewInternalClient", internalClient )
       .setInputParameter( "NewEnabled", true )
       .setInputParameter( "NewPortMappingDescription", description )
       .setInputParameter( "NewLeaseDuration", leaseDuration );
    try {
      msg.service();
      return true;
    } catch ( UPNPResponseException ex ) {
      if ( ex.getDetailErrorCode() == 718 ) {
        return false;
      }
View Full Code Here

  public boolean deletePortMapping( String remoteHost, int externalPort, String protocol ) throws IOException, UPNPResponseException {
   
    remoteHost = remoteHost == null ? "" : remoteHost;
    checkPortMappingProtocol( protocol );
    checkPortRange( externalPort );
    ActionMessage msg = msgFactory.getMessage( "DeletePortMapping" );
    msg.setInputParameter( "NewRemoteHost", remoteHost )
       .setInputParameter( "NewExternalPort", externalPort )
       .setInputParameter( "NewProtocol", protocol );
    try {
      msg.service();
      return true;
    } catch ( UPNPResponseException ex ) {
      if ( ex.getDetailErrorCode() == 714 ) {
        return false;
      }
View Full Code Here

TOP

Related Classes of net.yacy.upnp.messages.ActionMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.