/** * Get the sentby string. * */ public String getSentBy() { if ( this.sentBy == null && this.sentByHostPort != null) { this.sentBy = this.sentByHostPort.toString(); } return this.sentBy; }
/** * Initializes this MessageProcessor. Needed for extensions * that use classloading * * @param ipAddress2 * @param transactionStack * @param port2 */ public final void initialize( InetAddress ipAddress, int port, SIPTransactionStack transactionStack ) { this.sipStack = transactionStack; this.savedIpAddress = ipAddress.getHostAddress(); this.ipAddress = ipAddress; this.port = port; this.sentByHostPort = new HostPort(); this.sentByHostPort.setHost(new Host(ipAddress.getHostAddress())); this.sentByHostPort.setPort(port); }
public String getSentByField() { if(sentBy != null) return sentBy.encode(); return null; } /*
@Override public MessageChannel createMessageChannel(HostPort targetHostPort) throws IOException { return this.createMessageChannel( targetHostPort.getInetAddress(), targetHostPort.getPort() ); }
final HostPort hostPort = uri.getHostPort(); int port; if (hostPort.hasPort()) { port = hostPort.getPort(); } else { if (listeningPoint.getTransport().equalsIgnoreCase( port = 5060; String host = hostPort.getHost().encode(); if ((host.equals(listeningPoint.getIPAddress()) || host .equalsIgnoreCase(listeningPoint.getSentBy()))
/** * Generate a key given host and port. */ public static String getKey(HostPort hostPort, String transport) { // http://java.net/jira/browse/JSIP-413 Concurrency issue within MessageChannel.java when using IPv6 addresses String ipAddress = hostPort.getHost().getIpAddress(); if (ipAddress == null) { ipAddress = hostPort.getHost().getHostname(); } return (transport + ":" + ipAddress.replaceAll("[\\[\\]]", "") + ":" + hostPort.getPort()) .toLowerCase(); }
/** * @param ipAddress the ipAddress to set */ protected void setIpAddress(InetAddress ipAddress) { this.sentByHostPort.setHost( new Host(ipAddress.getHostAddress())); this.ipAddress = ipAddress; }
/** * Get the host name. * @return Host (null if not set) */ public Host getHost() { if (hostPort == null) return null; else return hostPort.getHost(); }
public Object clone() { Authority retval = (Authority) super.clone(); if (this.hostPort != null) retval.hostPort = (HostPort) this.hostPort.clone(); if (this.userInfo != null) retval.userInfo = (UserInfo) this.userInfo.clone(); return retval; }
/** retruns true if the two Objects are equals , false otherwise. * @param other Object to test. * @return boolean */ @Override public boolean equals(Object other) { if (other == null) return false; if (other.getClass() != getClass()) { return false; } Authority otherAuth = (Authority) other; if (!this.hostPort.equals(otherAuth.hostPort)) { return false; } if (this.userInfo != null && otherAuth.userInfo != null) { if (!this.userInfo.equals(otherAuth.userInfo)) { return false; } } return true; }
/** * Set the port part of this ViaHeader to the newly supplied <code>port</code> * parameter. * * @param port - the Integer.valueOf value of the port of this ViaHeader */ public void setPort(int port) throws InvalidArgumentException { if ( port!=-1 && (port<1 || port>65535)) { throw new InvalidArgumentException( "Port value out of range -1, [1..65535]" ); } if (sentBy == null) sentBy = new HostPort(); sentBy.setPort(port); }
/** * Create and return new TCPMessageChannel for the given host/port. */ public MessageChannel createMessageChannel(HostPort targetHostPort) throws UnknownHostException { return new UDPMessageChannel(targetHostPort.getInetAddress(), targetHostPort.getPort(), sipStack, this); }
/** * Returns the host part of this ViaHeader. * * @return the string value of the host */ public String getHost() { if (sentBy == null) return null; else { Host host = sentBy.getHost(); if (host == null) return null; else return host.getHostname(); } }
public Object clone() { Via retval = (Via) super.clone(); if (this.sentProtocol != null) retval.sentProtocol = (Protocol) this.sentProtocol.clone(); if (this.sentBy != null) retval.sentBy = (HostPort) this.sentBy.clone(); if ( this.getRPort() != -1) retval.setParameter(RPORT,this.getRPort()); return retval; }