Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber.extensions.gtalk
Class GTalkPacketFactory

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.jabber.extensions.gtalk.GTalkPacketFactory

public class GTalkPacketFactory
extends Object

A utility class containing methods for creating SessionIQ instances for various situations.

Author:
Sebastien Vincent

Constructor Summary
GTalkPacketFactory()
           
 
Method Summary
static SessionIQ createBusy(String from, String to, String sid)
          Creates a SessionIQ terminate packet carrying a Reason.BUSY payload.
static SessionIQ createBye(String from, String to, String sid)
          Creates a SessionIQ session-terminate packet that is meant to terminate an on-going, well established session (similar to a SIP BYE request).
static SessionIQ createCancel(String from, String to, String sid)
          Creates a SessionIQ terminate packet that is meant to terminate a not yet established session.
static GTalkCandidatePacketExtension createCandidate(org.ice4j.ice.Candidate candidate, String name)
          Creates a GTalkCandidatePacketExtension and initializes it so that it would describe the state of candidate
static List<GTalkCandidatePacketExtension> createCandidates(String name, org.ice4j.ice.IceMediaStream stream)
          Converts the ICE media stream and its local candidates into a list of Google Talk candidates.
static SessionIQ createReject(String from, String to, String sid)
          Creates a SessionIQ reject packet.
static SessionIQ createSessionAccept(String from, String to, String sid, RtpDescriptionPacketExtension description)
          Creates a SessionIQ accept packet with the specified from, to, sid, and content.
static SessionIQ createSessionCandidates(String from, String to, String sid, GTalkCandidatePacketExtension candidate)
          Creates a new SessionIQ with the candidates type.
static SessionIQ createSessionInitiate(String from, String to, String sid, RtpDescriptionPacketExtension description)
          Creates a new SessionIQ with the initiate type.
static SessionIQ createSessionTerminate(String from, String to, String sid, Reason reason, String reasonText)
          Creates a SessionIQ terminate packet with the specified src, dst, sid, and reason.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GTalkPacketFactory

public GTalkPacketFactory()
Method Detail

createReject

public static SessionIQ createReject(String from,
                                     String to,
                                     String sid)
Creates a SessionIQ reject packet.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Google Talk session that this message will be rejecting.
Returns:
a SessionIQ reject packet.

createBusy

public static SessionIQ createBusy(String from,
                                   String to,
                                   String sid)
Creates a SessionIQ terminate packet carrying a Reason.BUSY payload.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Google Talk session that this message will be terminating.
Returns:
a SessionIQ terminate packet.

createBye

public static SessionIQ createBye(String from,
                                  String to,
                                  String sid)
Creates a SessionIQ session-terminate packet that is meant to terminate an on-going, well established session (similar to a SIP BYE request).

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Google Talk session that this message will be terminating.
Returns:
a SessionIQ terminate packet .

createCancel

public static SessionIQ createCancel(String from,
                                     String to,
                                     String sid)
Creates a SessionIQ terminate packet that is meant to terminate a not yet established session.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Google Talk session that this message will be terminating.
Returns:
a SessionIQ terminate packet .

createSessionTerminate

public static SessionIQ createSessionTerminate(String from,
                                               String to,
                                               String sid,
                                               Reason reason,
                                               String reasonText)
Creates a SessionIQ terminate packet with the specified src, dst, sid, and reason.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Google Talk session that this message will be terminating.
reason - the reason for the termination
reasonText - a human readable reason for the termination or null for none.
Returns:
the newly constructed SessionIQ terminate packet. .

createSessionAccept

public static SessionIQ createSessionAccept(String from,
                                            String to,
                                            String sid,
                                            RtpDescriptionPacketExtension description)
Creates a SessionIQ accept packet with the specified from, to, sid, and content. Given our role in a conversation, we would assume that the from value should also be used for the value of the Google Talk responder.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Google Talk session that this message will be terminating.
description - description containing payload types list descriptions.
Returns:
the newly constructed SessionIQ accept packet. .

createSessionInitiate

public static SessionIQ createSessionInitiate(String from,
                                              String to,
                                              String sid,
                                              RtpDescriptionPacketExtension description)
Creates a new SessionIQ with the initiate type.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Google Talk session that this message will be terminating.
description - description containing payload types list.
Returns:
the newly constructed SessionIQ terminate packet.

createSessionCandidates

public static SessionIQ createSessionCandidates(String from,
                                                String to,
                                                String sid,
                                                GTalkCandidatePacketExtension candidate)
Creates a new SessionIQ with the candidates type.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Google Talk session.
candidate - a GTalkCandidatePacketExtension.
Returns:
the newly constructed SessionIQ terminate packet.

createCandidates

public static List<GTalkCandidatePacketExtension> createCandidates(String name,
                                                                   org.ice4j.ice.IceMediaStream stream)
Converts the ICE media stream and its local candidates into a list of Google Talk candidates.

Parameters:
name - of the stream
stream - the IceMediaStream that we'd like to describe in XML.
Returns:
the list of Google Talk candidates

createCandidate

public static GTalkCandidatePacketExtension createCandidate(org.ice4j.ice.Candidate candidate,
                                                            String name)
Creates a GTalkCandidatePacketExtension and initializes it so that it would describe the state of candidate

Parameters:
candidate - the ICE4J Candidate that we'd like to convert into an Google Talk packet extension.
name - name of the candidate extension
Returns:
a new GTalkCandidatePacketExtension corresponding to the state of the candidate candidate.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.