FileDocCategorySizeDatePackage
SourceDescription.javaAPI DocJMF 2.1.1e6698Mon May 12 12:20:40 BST 2003javax.media.rtp.rtcp

SourceDescription

public class SourceDescription extends Object implements Serializable
Class to encapsulate a source description item used in RTCP SDES reports.

Fields Summary
public static final int
SOURCE_DESC_CNAME
public static final int
SOURCE_DESC_NAME
public static final int
SOURCE_DESC_EMAIL
public static final int
SOURCE_DESC_PHONE
public static final int
SOURCE_DESC_LOC
public static final int
SOURCE_DESC_TOOL
public static final int
SOURCE_DESC_NOTE
public static final int
SOURCE_DESC_PRIV
private static JMFSecurity
jmfSecurity
private static boolean
securityPrivelege
private static Method[]
m
private static Class[]
cl
private static Object[]
args
private int
m_type
private String
m_description
private int
m_frequency
private boolean
m_encrypted
Constructors Summary
public SourceDescription(int type, String description, int frequency, boolean encrypted)
Constructor.

the type of source description this is description the actual source description string frequency the frequency at which RTCP sends this source description encrypted set to true if this SDES item is to be encrypted. Please see individual variable description for current implementation status


     
	try {
	    jmfSecurity = JMFSecurityManager.getJMFSecurity();
	    securityPrivelege = true;
	} catch (SecurityException e) {
	}
    
	m_type = type;
	m_description = description;
	m_frequency = frequency;
	m_encrypted = encrypted;
    
Methods Summary
public static java.lang.StringgenerateCNAME()
This function can be used to generate a CNAME using the scheme described in RFC1889. This function is provided in order to facilitate CNAME generation prior to actual stream creation.

return
The generated CNAME.

	String hostname = null;
	InetAddress host;
	String cname = "";

	if ( jmfSecurity != null) {
	    String permission = null;
	    try {
		if (jmfSecurity.getName().startsWith("jmf-security")) {
		    permission = "connect";
		    jmfSecurity.requestPermission(m, cl, args, JMFSecurity.CONNECT);
		    m[0].invoke(cl[0], args[0]);
		} else if (jmfSecurity.getName().startsWith("internet")) {
		    PolicyEngine.checkPermission(PermissionID.NETIO);
		    PolicyEngine.assertPermission(PermissionID.NETIO);
		}
	    } catch (Throwable e) {
		if (JMFSecurityManager.DEBUG) {
		    System.err.println("Unable to get " + permission +
				       " privilege  " + e);
		}
		jmfSecurity.permissionFailureNotification(JMFSecurity.CONNECT);
		// securityPrivelege = false;
	    }
	}

	try {
	    if ( (jmfSecurity != null) && (jmfSecurity.getName().startsWith("jdk12"))) {
		Constructor cons = jdk12InetAddressAction.cons;

		host = (InetAddress) jdk12.doPrivM.invoke(
                                           jdk12.ac,
 					  new Object[] {
 					  cons.newInstance(
 					   new Object[] {
					       null, //  static method
					       "getLocalHost",
					       null, // No parameters
                                           })});

		hostname = (String) jdk12.doPrivM.invoke(
                                           jdk12.ac,
 					  new Object[] {
 					  cons.newInstance(
 					   new Object[] {
					       host,
					       "getHostName",
					       null, // No parameters
                                           })});


	    } else {
		host = InetAddress.getLocalHost();
		hostname = host.getHostName();
	    }
	} catch (Throwable e) {
	    System.err.println("InitSession : UnknownHostExcpetion " +
			       e.getMessage());
	}

	cname = getProperty("user.name");
	
	if (cname == null) {
	    return hostname;
	} else {
	    return cname + "@" + hostname;
	}
    
public java.lang.StringgetDescription()
Get the actual source description string.

	return m_description;
    
public booleangetEncrypted()
Should this source description be encrypted?. Currently, we do not support any encryption schemes

	return m_encrypted;
    
public intgetFrequency()
Get the frequency at which RTCP sends this source description.

Currently, this frequency parameter will be ignored by the implementation and SDES items are sent according to the following algorithm... The CNAME is sent every RTCP reporting interval. All other SDES items are sent once every 3 RTCP report intervals.

	return m_frequency;
    
private static java.lang.StringgetProperty(java.lang.String prop)


	String value = null;
	if ( jmfSecurity != null) {
	    try {
		if (jmfSecurity.getName().startsWith("jmf-security")) {
		    jmfSecurity.requestPermission(m, cl, args, JMFSecurity.READ_PROPERTY);
		    m[0].invoke(cl[0], args[0]);
		} else if (jmfSecurity.getName().startsWith("internet")) {
		    PolicyEngine.checkPermission(PermissionID.PROPERTY);
		    PolicyEngine.assertPermission(PermissionID.PROPERTY);
		}
	    } catch (Throwable e) {
		if (JMFSecurityManager.DEBUG) {
		    System.err.println("Unable to get read property " +
				       " privilege  " + e);
		}
		jmfSecurity.permissionFailureNotification(JMFSecurity.READ_PROPERTY);
		// securityPrivelege = false;
	    }
	}

	try {
	    if ( (jmfSecurity != null) && (jmfSecurity.getName().startsWith("jdk12"))) {
		Constructor cons = jdk12PropertyAction.cons;
		value = (String) jdk12.doPrivM.invoke(
				     jdk12.ac,
				     new Object[] {
 					  cons.newInstance(
 					   new Object[] {
                                               prop
                                           })});
	    } else {
		value = System.getProperty(prop);
	    }
	} catch (Throwable e) {
	}
	
	return value;
    
public intgetType()
Get the type of source description this is.

   // encrypt it?
    
    // Methods
                  
      
     
	return m_type;
    
public voidsetDescription(java.lang.String desc)

	m_description = desc;