FileDocCategorySizeDatePackage
SessionAddress.javaAPI DocJMF 2.1.1e5883Mon May 12 12:20:40 BST 2003javax.media.rtp

SessionAddress

public class SessionAddress extends Object implements Serializable
Class to encapsulate a pair of internet address and a pair of ports for use in RTPSM methods.

Fields Summary
private InetAddress
m_dataAddress
private InetAddress
m_controlAddress
private int
m_dataPort
private int
m_controlPort
private int
ttl
public static final int
ANY_PORT
Constructors Summary
public SessionAddress(InetAddress dataAddress, int dataPort)
Constructor to create an SessionAddress given the data internet address and data port.

param
dataAddress The data address.

param
dataPort The data port. If this value is passed as the constant ANY_PORT, the object will not represent a specific data port.

    
                                                                
     
	  
			                  						      
	m_dataAddress = dataAddress;
	m_controlAddress = dataAddress;
	m_dataPort = dataPort;
	m_controlPort = dataPort + 1;
    
public SessionAddress(InetAddress dataAddress, int dataPort, int timeToLive)
Constructor to create an SessionAddress given the data internet address and data port.

param
dataAddress The data address.

param
dataPort The data port. If this value is passed as the constant ANY_PORT, the object will not represent a specific data port.

param
timeToLive The time-to-live parameter for multicast sessions

        						     
	m_dataAddress = dataAddress;
	m_controlAddress = dataAddress;
	m_dataPort = dataPort;
	m_controlPort = dataPort + 1;
	
	ttl= timeToLive;
    
public SessionAddress(InetAddress dataAddress, int dataPort, InetAddress controlAddress, int controlPort)
Constructor to create an SessionAddress given both internet address and ports.

param
dataAddress The data address.

param
dataPort The data port. If this value is passed as the constant ANY_PORT, the object will not represent a specific data port.

param
controlAddress The control address.

param
controlPort The control port. If this value is passed as the constant ANY_PORT, the object will not represent a specific control port.

	m_dataAddress = dataAddress;
	m_controlAddress = controlAddress;
	m_dataPort = dataPort;
	m_controlPort = controlPort;
    
public SessionAddress()
Constructor to create an "empty" RTPSesionAddress. Equivalent to calling SessionAddress(null, ANY_PORT, null, ANY_PORT).

	this(null, ANY_PORT, null, ANY_PORT);
    
Methods Summary
public booleanequals(java.lang.Object obj)

	if (obj instanceof SessionAddress){
	    SessionAddress otheraddr = (SessionAddress)obj;
	    InetAddress otherdest = otheraddr.getDataAddress();
	    InetAddress othercontl = otheraddr.getControlAddress();
	    int dport = otheraddr.getDataPort();
	    int cport = otheraddr.getControlPort();
	    if ( (otherdest.equals(m_dataAddress)) &&
		 (othercontl.equals(m_controlAddress)) &&
		 (dport == m_dataPort) &&
		 (cport == m_controlPort))
		return true;
	}
	return false;
    
public java.net.InetAddressgetControlAddress()
Access method to get the control address of this SessionAddress.

	return m_controlAddress;
    
public java.lang.StringgetControlHostAddress()
Returns the IP address string of the control address host.

        return m_controlAddress.getHostAddress();
    
public intgetControlPort()
Access method to get the control port of this SessionAddress.

	return m_controlPort;
    
public java.net.InetAddressgetDataAddress()
Access method to get the data address of this SessionAddress.

	return m_dataAddress;
    
public java.lang.StringgetDataHostAddress()
Returns the IP address string of the data address host.

        return m_dataAddress.getHostAddress();
    
public intgetDataPort()
Access method to get the data port of this SessionAddress.

	return m_dataPort;
    
public intgetTimeToLive()
Returns the time-to-live value for mutlicast sessions.

        return ttl;
    
public inthashCode()

	return 1;
    
public voidsetControlHostAddress(java.net.InetAddress controlAddress)
Access method to set the control address of this SessionAddress.

	m_controlAddress= controlAddress;
    
public voidsetControlPort(int controlPort)
Access method to set the control port of this SessionAddress.

	m_controlPort= controlPort;
    
public voidsetDataHostAddress(java.net.InetAddress dataAddress)
Access method to set the data address of this SessionAddress.

	m_dataAddress= dataAddress;
    
public voidsetDataPort(int dataPort)
Access method to set the data port of this SessionAddress.

	m_dataPort= dataPort;
    
public java.lang.StringtoString()

	String s= "DataAddress: ";
	
	if( m_dataAddress != null)
	    s+= m_dataAddress.toString();
	else s+= "null";
	
	s+= "\nControlAddress: ";
	
	if( m_controlAddress != null)
	    s+= m_controlAddress.toString();
	else s+= "null";
	
	s+= ("\nDataPort: " + m_dataPort + "\nControlPort: " + m_controlPort);
	
	return s;