public class Session
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
addService(java.lang.String service,
PortForwardingProtocol protocol,
java.lang.String host,
java.lang.String port)
Add a new portforwarding service to session.
|
Stream |
addStream(StreamType type,
int options,
StreamHandler handler)
Add a new stream to session.
|
void |
close()
Close a session to friend.
|
protected void |
finalize() |
java.lang.String |
getPeer()
Get remote peer id.
|
void |
removeService(java.lang.String service)
Remove a portforwarding server to session.
|
void |
removeStream(Stream stream)
Remove a stream from session.
|
void |
replyRequest(int status,
java.lang.String reason)
Reply the session request from friend.
|
void |
request(SessionRequestCompleteHandler handler)
Send session request to the friend.
|
void |
start(java.lang.String sdp)
Begin to start a session.
|
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic void close()
public java.lang.String getPeer()
public void request(SessionRequestCompleteHandler handler) throws CarrierException
handler - A handler to the SessionRequestCompleteHandler to receive the
session responsejava.lang.IllegalArgumentException - CarrierExceptionCarrierExceptionpublic void replyRequest(int status,
java.lang.String reason)
throws CarrierException
status - The status code of the response. 0 is success, otherwise is errorreason - The error message if status is error, or null if successjava.lang.IllegalArgumentException - CarrierExceptionCarrierExceptionpublic void start(java.lang.String sdp)
throws CarrierException
sdp - The remote user's SDP. Reference: https://tools.ietf.org/html/rfc4566java.lang.IllegalArgumentException - CarrierExceptionCarrierExceptionpublic Stream addStream(StreamType type, int options, StreamHandler handler) throws CarrierException
type - The stream type defined in StreamTypeoptions - The stream mode options. options are constructed by a
bitwise-inclusive OR of flagshandler - The Application defined inerface to StreamHandlerjava.lang.IllegalArgumentException - CarrierExceptionCarrierExceptionpublic void removeStream(Stream stream) throws CarrierException
stream - The Stream to be removedjava.lang.IllegalArgumentException - CarrierExceptionCarrierExceptionpublic void addService(java.lang.String service,
PortForwardingProtocol protocol,
java.lang.String host,
java.lang.String port)
throws CarrierException
service - The new service name, should be unique in session scopeprotocol - The protocol of the servicehost - The host name or ip of the serviceport - The port of the servicejava.lang.IllegalArgumentException - CarrierExceptionCarrierExceptionpublic void removeService(java.lang.String service)
service - The service name.