本文整理汇总了Java中net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.CandidateType类的典型用法代码示例。如果您正苦于以下问题:Java CandidateType类的具体用法?Java CandidateType怎么用?Java CandidateType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CandidateType类属于net.java.sip.communicator.impl.protocol.jabber.extensions.jingle包,在下文中一共展示了CandidateType类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createLocalCandidatePacketExts
点赞 2
import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.CandidateType; //导入依赖的package包/类
/**
* Create list of <tt>CandidatePacketExtension</tt> with specified <tt>MediaType</tt>.
*
* @param mediaType
* @return List of <tt>CandidatePacketExtension</tt>
*/
private List<CandidatePacketExtension>
createLocalCandidatePacketExts(MediaType mediaType)
{
List<CandidatePacketExtension> candidatePEs =
new ArrayList<CandidatePacketExtension>();
int id = 1;
for (LocalCandidate candidate : getLocalCandidates(mediaType))
{
CandidatePacketExtension packetExt =
new CandidatePacketExtension();
packetExt.setComponent(candidate.getParentComponent()
.getComponentID());
packetExt.setFoundation(candidate.getFoundation());
packetExt.setGeneration(iceAgent.getGeneration());
packetExt.setID(String.valueOf(id++));
packetExt.setNetwork(0); // Why it is 0?
packetExt.setIP(candidate.getTransportAddress().getHostAddress());
packetExt.setPort(candidate.getTransportAddress().getPort());
packetExt.setPriority(candidate.getPriority());
packetExt.setProtocol(candidate.getTransport().toString());
packetExt.setType(CandidateType.valueOf(candidate.getType()
.toString()));
candidatePEs.add(packetExt);
}
return candidatePEs;
}
开发者ID:jitsi,
项目名称:jirecon,
代码行数:35,
代码来源:IceUdpTransportManager.java
示例2: createCandidate
点赞 2
import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.CandidateType; //导入依赖的package包/类
/**
* Creates a {@link CandidatePacketExtension} and initializes it so that it
* would describe the state of <tt>candidate</tt>
*
* @param candidate the ICE4J {@link Candidate} that we'd like to convert
* into an XMPP packet extension.
*
* @return a new {@link CandidatePacketExtension} corresponding to the state
* of the <tt>candidate</tt> candidate.
*/
private CandidatePacketExtension createCandidate(Candidate<?> candidate)
{
CandidatePacketExtension packet = new CandidatePacketExtension();
packet.setFoundation(candidate.getFoundation());
Component component = candidate.getParentComponent();
packet.setComponent(component.getComponentID());
packet.setProtocol(candidate.getTransport().toString());
packet.setPriority(candidate.getPriority());
packet.setGeneration(
component.getParentStream().getParentAgent().getGeneration());
TransportAddress transportAddress = candidate.getTransportAddress();
packet.setID(getNextID());
packet.setIP(transportAddress.getHostAddress());
packet.setPort(transportAddress.getPort());
packet.setType(CandidateType.valueOf(candidate.getType().toString()));
TransportAddress relAddr = candidate.getRelatedAddress();
if(relAddr != null)
{
packet.setRelAddr(relAddr.getHostAddress());
packet.setRelPort(relAddr.getPort());
}
/*
* FIXME The XML schema of XEP-0176: Jingle ICE-UDP Transport Method
* specifies the network attribute as required.
*/
packet.setNetwork(0);
return packet;
}
开发者ID:jitsi,
项目名称:jitsi,
代码行数:48,
代码来源:IceUdpTransportManager.java
示例3: addRemoteCandidates
点赞 2
import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.CandidateType; //导入依赖的package包/类
/**
* Add all remote candidates from the values of <tt>transportPEs</tt> to the
* corresponding IceMediaStream.
*
* @param transportPEs The <tt>IceUdpTransportPacketExtension</tt> to be
* parsed.
*/
public void addRemoteCandidates(
Map<MediaType, IceUdpTransportPacketExtension> transportPEs)
{
logger.debug("harvestRemoteCandidates");
for (java.util.Map.Entry<MediaType, IceUdpTransportPacketExtension> e : transportPEs
.entrySet())
{
final MediaType mediaType = e.getKey();
final IceUdpTransportPacketExtension transportPE = e.getValue();
final IceMediaStream stream = getIceMediaStream(mediaType);
final String ufrag = transportPE.getUfrag();
if (null != ufrag)
stream.setRemoteUfrag(ufrag);
final String password = transportPE.getPassword();
if (null != password)
stream.setRemotePassword(password);
List<CandidatePacketExtension> candidates = transportPE.getCandidateList();
/*
* Sort the remote candidates (host < reflexive < relayed) in order
* to create first the host, then the reflexive, the relayed
* candidates and thus be able to set the relative-candidate
* matching the rel-addr/rel-port attribute.
*/
Collections.sort(candidates);
for (CandidatePacketExtension candidate : candidates)
{
if (candidate.getGeneration() != iceAgent.getGeneration())
continue;
final Component component =
stream.getComponent(candidate.getComponent());
final String relAddr = candidate.getRelAddr();
final int relPort = candidate.getRelPort();
TransportAddress relatedAddress = null;
if ((relAddr != null) && (relPort > 0))
{
relatedAddress =
new TransportAddress(relAddr, relPort,
Transport.parse(candidate.getProtocol()));
}
final RemoteCandidate relatedCandidate =
component.findRemoteCandidate(relatedAddress);
final TransportAddress mainAddress =
new TransportAddress(candidate.getIP(),
candidate.getPort(), Transport.parse(candidate
.getProtocol()));
final RemoteCandidate remoteCandidate =
new RemoteCandidate(mainAddress, component,
org.ice4j.ice.CandidateType.parse(candidate.getType()
.toString()), candidate.getFoundation(),
candidate.getPriority(), relatedCandidate);
component.addRemoteCandidate(remoteCandidate);
}
}
}
开发者ID:jitsi,
项目名称:jirecon,
代码行数:73,
代码来源:IceUdpTransportManager.java
示例4: convertType
点赞 2
import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.CandidateType; //导入依赖的package包/类
private CandidateType convertType(org.ice4j.ice.CandidateType type) {
String ts = type.toString();
return CandidateType.valueOf(ts);
}
开发者ID:bejayoharen,
项目名称:java-bells,
代码行数:5,
代码来源:IceAgent.java
示例5: createCandidate
点赞 2
import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.CandidateType; //导入依赖的package包/类
/**
* Creates a {@link GTalkCandidatePacketExtension} and initializes it so
* that it would describe the state of <tt>candidate</tt>
*
* @param candidate the ICE4J {@link Candidate} that we'd like to convert
* into an Google Talk packet extension.
* @param name name of the candidate extension
*
* @return a new {@link GTalkCandidatePacketExtension} corresponding to the
* state of the <tt>candidate</tt> candidate.
*/
public static GTalkCandidatePacketExtension createCandidate(
Candidate<?> candidate, String name)
{
GTalkCandidatePacketExtension packet =
new GTalkCandidatePacketExtension();
Component component = candidate.getParentComponent();
packet.setName(name);
packet.setGeneration(
component.getParentStream().getParentAgent().getGeneration());
TransportAddress transportAddress = candidate.getTransportAddress();
// different username/password for each candidate ?
packet.setUsername(((LocalCandidate)candidate).getUfrag());
if(candidate instanceof GoogleRelayedCandidate)
{
packet.setPassword(
((GoogleRelayedCandidate)
candidate).getPassword());
}
else
{
packet.setPassword("");
}
packet.setAddress(transportAddress.getHostAddress());
packet.setPort(transportAddress.getPort());
if(transportAddress.getPort() != 443)
{
packet.setProtocol(candidate.getTransport().toString());
}
else
{
packet.setProtocol("ssltcp");
}
packet.setNetwork(0);
packet.setFoundation(0);
packet.setComponent(component.getComponentID());
CandidateType candType = CandidateType.valueOf(
candidate.getType().toString());
if(candType == CandidateType.srflx)
{
candType = CandidateType.stun;
}
else if(candType == CandidateType.host)
{
candType = CandidateType.local;
}
packet.setType(candType);
double priority = candidate.getPriority();
packet.setPreference((priority / 1000));
return packet;
}
开发者ID:zhaozw,
项目名称:android-1,
代码行数:70,
代码来源:GTalkPacketFactory.java
示例6: createCandidate
点赞 2
import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.CandidateType; //导入依赖的package包/类
/**
* Creates a {@link CandidatePacketExtension} and initializes it so that it
* would describe the state of <tt>candidate</tt>
*
* @param candidate the ICE4J {@link Candidate} that we'd like to convert
* into an XMPP packet extension.
*
* @return a new {@link CandidatePacketExtension} corresponding to the state
* of the <tt>candidate</tt> candidate.
*/
private CandidatePacketExtension createCandidate(Candidate<?> candidate)
{
CandidatePacketExtension packet = new CandidatePacketExtension();
//TODO: XMPP expects int values as foundations. Luckily that's exactly
//what ice4j is using under the hood at this time. still, we'd need to
//make sure that doesn't change ... possibly by setting a property there
packet.setFoundation(Integer.parseInt( candidate.getFoundation()));
Component component = candidate.getParentComponent();
packet.setComponent(component.getComponentID());
packet.setProtocol(candidate.getTransport().toString());
packet.setPriority(candidate.getPriority());
packet.setGeneration(
component.getParentStream().getParentAgent().getGeneration());
TransportAddress transportAddress = candidate.getTransportAddress();
packet.setID(getNextID());
packet.setIP(transportAddress.getHostAddress());
packet.setPort(transportAddress.getPort());
packet.setType(CandidateType.valueOf(candidate.getType().toString()));
TransportAddress relAddr = candidate.getRelatedAddress();
if(relAddr != null)
{
packet.setRelAddr(relAddr.getHostAddress());
packet.setRelPort(relAddr.getPort());
}
/*
* FIXME The XML schema of XEP-0176: Jingle ICE-UDP Transport Method
* specifies the network attribute as required.
*/
packet.setNetwork(0);
return packet;
}
开发者ID:zhaozw,
项目名称:android-1,
代码行数:51,
代码来源:IceUdpTransportManager.java
示例7: addRemoteCandidates
点赞 2
import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.CandidateType; //导入依赖的package包/类
private int addRemoteCandidates(
List<CandidatePacketExtension> candidates,
boolean iceAgentStateIsRunning)
{
// Sort the remote candidates (host < reflexive < relayed) in order to
// create first the host, then the reflexive, the relayed candidates and
// thus be able to set the relative-candidate matching the
// rel-addr/rel-port attribute.
Collections.sort(candidates);
int generation = iceAgent.getGeneration();
int remoteCandidateCount = 0;
for (CandidatePacketExtension candidate : candidates)
{
// Is the remote candidate from the current generation of the
// iceAgent?
if (candidate.getGeneration() != generation)
continue;
if (rtcpmux && Component.RTCP == candidate.getComponent())
{
logger.warn(
"Received an RTCP candidate, but we're using rtcp-mux."
+ " Ignoring.");
continue;
}
Component component
= iceStream.getComponent(candidate.getComponent());
String relAddr;
int relPort;
TransportAddress relatedAddress = null;
if ((relAddr = candidate.getRelAddr()) != null
&& (relPort = candidate.getRelPort()) != -1)
{
relatedAddress
= new TransportAddress(
relAddr,
relPort,
Transport.parse(candidate.getProtocol()));
}
RemoteCandidate relatedCandidate
= component.findRemoteCandidate(relatedAddress);
RemoteCandidate remoteCandidate
= new RemoteCandidate(
new TransportAddress(
candidate.getIP(),
candidate.getPort(),
Transport.parse(candidate.getProtocol())),
component,
org.ice4j.ice.CandidateType.parse(
candidate.getType().toString()),
candidate.getFoundation(),
candidate.getPriority(),
relatedCandidate);
// XXX IceUdpTransportManager harvests host candidates only and the
// ICE Components utilize the UDP protocol/transport only at the
// time of this writing. The ice4j library will, of course, check
// the theoretical reachability between the local and the remote
// candidates. However, we would like (1) to not mess with a
// possibly running iceAgent and (2) to return a consistent return
// value.
if (!canReach(component, remoteCandidate))
continue;
if (iceAgentStateIsRunning)
component.addUpdateRemoteCandidates(remoteCandidate);
else
component.addRemoteCandidate(remoteCandidate);
remoteCandidateCount++;
}
return remoteCandidateCount;
}
开发者ID:jitsi,
项目名称:jitsi-videobridge,
代码行数:79,
代码来源:IceUdpTransportManager.java
示例8: describe
点赞 2
import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.CandidateType; //导入依赖的package包/类
/**
* Adds a new <tt>CandidatePacketExtension</tt> to <tt>pe</tt>, sets the
* values of its properties to the values of the respective properties of
* <tt>candidate</tt>.
*
* @param candidate the <tt>LocalCandidate</tt> from which to take the values
* of the properties to set.
* @param pe the <tt>IceUdpTransportPacketExtension</tt> to which to add a
* new <tt>CandidatePacketExtension</tt>.
*/
private void describe(
LocalCandidate candidate,
IceUdpTransportPacketExtension pe)
{
CandidatePacketExtension candidatePE = new CandidatePacketExtension();
org.ice4j.ice.Component component = candidate.getParentComponent();
candidatePE.setComponent(component.getComponentID());
candidatePE.setFoundation(candidate.getFoundation());
candidatePE.setGeneration(
component.getParentStream().getParentAgent().getGeneration());
candidatePE.setID(generateCandidateID(candidate));
candidatePE.setNetwork(0);
candidatePE.setPriority(candidate.getPriority());
// Advertise 'tcp' candidates for which SSL is enabled as 'ssltcp'
// (although internally their transport protocol remains "tcp")
Transport transport = candidate.getTransport();
if (transport == Transport.TCP && candidate.isSSL())
{
transport = Transport.SSLTCP;
}
candidatePE.setProtocol(transport.toString());
if (transport == Transport.TCP || transport == Transport.SSLTCP)
{
candidatePE.setTcpType(candidate.getTcpType());
}
candidatePE.setType(
CandidateType.valueOf(candidate.getType().toString()));
TransportAddress transportAddress = candidate.getTransportAddress();
candidatePE.setIP(transportAddress.getHostAddress());
candidatePE.setPort(transportAddress.getPort());
TransportAddress relatedAddress = candidate.getRelatedAddress();
if (relatedAddress != null)
{
candidatePE.setRelAddr(relatedAddress.getHostAddress());
candidatePE.setRelPort(relatedAddress.getPort());
}
pe.addChildExtension(candidatePE);
}
开发者ID:jitsi,
项目名称:jitsi-videobridge,
代码行数:58,
代码来源:IceUdpTransportManager.java