public Address getAddress() throws UtilityException { return new Address(socket.getLocalAddress().getAddress()); }
public Address getAddress() throws UtilityException { return new Address(socket.getLocalAddress().getAddress()); }
public MappedResponseChangedSourceAddressReflectedFrom() { super(); try { port = 0; address = new Address("0.0.0.0"); } catch (UtilityException ue) { ue.getMessage(); ue.printStackTrace(); } }
public MappedResponseChangedSourceAddressReflectedFrom() { super(); try { port = 0; address = new Address("0.0.0.0"); } catch (UtilityException ue) { ue.getMessage(); ue.printStackTrace(); } }
try { Candidate local = new Candidate(new Address(iaddress.getAddress()), componentId); candidates.add(local); DiscoveryInfo di = test.test(); if (di.getPublicIP() != null) { Candidate cand = new Candidate(new Address(di.getPublicIP().getAddress()), CandidateType.ServerReflexive, componentId, local); cand.setComponentId(componentId); candidates.add(cand);
try { Candidate local = new Candidate(new Address(iaddress.getAddress()), componentId); candidates.add(local); DiscoveryInfo di = test.test(); if (di.getPublicIP() != null) { Candidate cand = new Candidate(new Address(di.getPublicIP().getAddress()), CandidateType.ServerReflexive, componentId, local); cand.setComponentId(componentId); candidates.add(cand);
ma.setAddress(new Address(receive.getAddress().getAddress())); ma.setPort(receive.getPort()); sendMH.addMessageAttribute(ma); ca.setAddress(new Address(changedPortIP.getLocalAddress().getAddress())); ca.setPort(changedPortIP.getLocalPort()); sendMH.addMessageAttribute(ca); sa.setAddress(new Address(changedPort.getLocalAddress().getAddress())); sa.setPort(changedPort.getLocalPort()); sendMH.addMessageAttribute(sa); sa.setAddress(new Address(changedIP.getLocalAddress().getAddress())); sa.setPort(changedIP.getLocalPort()); sendMH.addMessageAttribute(sa); sa.setAddress(new Address(receiverSocket.getLocalAddress().getAddress())); sa.setPort(receiverSocket.getLocalPort()); sendMH.addMessageAttribute(sa); sa.setAddress(new Address(changedPortIP.getLocalAddress().getAddress())); sa.setPort(changedPortIP.getLocalPort()); sendMH.addMessageAttribute(sa);
ma.setAddress(new Address(receive.getAddress().getAddress())); ma.setPort(receive.getPort()); sendMH.addMessageAttribute(ma); ca.setAddress(new Address(changedPortIP.getLocalAddress().getAddress())); ca.setPort(changedPortIP.getLocalPort()); sendMH.addMessageAttribute(ca); sa.setAddress(new Address(changedPort.getLocalAddress().getAddress())); sa.setPort(changedPort.getLocalPort()); sendMH.addMessageAttribute(sa); sa.setAddress(new Address(changedIP.getLocalAddress().getAddress())); sa.setPort(changedIP.getLocalPort()); sendMH.addMessageAttribute(sa); sa.setAddress(new Address(receiverSocket.getLocalAddress().getAddress())); sa.setPort(receiverSocket.getLocalPort()); sendMH.addMessageAttribute(sa); sa.setAddress(new Address(changedPortIP.getLocalAddress().getAddress())); sa.setPort(changedPortIP.getLocalPort()); sendMH.addMessageAttribute(sa);
protected static MappedResponseChangedSourceAddressReflectedFrom parse(MappedResponseChangedSourceAddressReflectedFrom ma, byte[] data) throws MessageAttributeParsingException { try { if (data.length < 8) { throw new MessageAttributeParsingException("Data array too short"); } int family = Utility.oneByteToInteger(data[1]); if (family != 0x01) throw new MessageAttributeParsingException("Family " + family + " is not supported"); byte[] portArray = new byte[2]; System.arraycopy(data, 2, portArray, 0, 2); ma.setPort(Utility.twoBytesToInteger(portArray)); int firstOctet = Utility.oneByteToInteger(data[4]); int secondOctet = Utility.oneByteToInteger(data[5]); int thirdOctet = Utility.oneByteToInteger(data[6]); int fourthOctet = Utility.oneByteToInteger(data[7]); ma.setAddress(new Address(firstOctet, secondOctet, thirdOctet, fourthOctet)); return ma; } catch (UtilityException ue) { throw new MessageAttributeParsingException("Parsing error"); } catch (MessageAttributeException mae) { throw new MessageAttributeParsingException("Port parsing error"); } }
protected static MappedResponseChangedSourceAddressReflectedFrom parse(MappedResponseChangedSourceAddressReflectedFrom ma, byte[] data) throws MessageAttributeParsingException { try { if (data.length < 8) { throw new MessageAttributeParsingException("Data array too short"); } int family = Utility.oneByteToInteger(data[1]); if (family != 0x01) throw new MessageAttributeParsingException("Family " + family + " is not supported"); byte[] portArray = new byte[2]; System.arraycopy(data, 2, portArray, 0, 2); ma.setPort(Utility.twoBytesToInteger(portArray)); int firstOctet = Utility.oneByteToInteger(data[4]); int secondOctet = Utility.oneByteToInteger(data[5]); int thirdOctet = Utility.oneByteToInteger(data[6]); int fourthOctet = Utility.oneByteToInteger(data[7]); ma.setAddress(new Address(firstOctet, secondOctet, thirdOctet, fourthOctet)); return ma; } catch (UtilityException ue) { throw new MessageAttributeParsingException("Parsing error"); } catch (MessageAttributeException mae) { throw new MessageAttributeParsingException("Port parsing error"); } }