/// <summary> /// TODO: Documentation SendIndication /// </summary> /// <param name="xorPeerAddress"></param> /// <param name="data"></param> /// <param name="allocation"></param> public void SendIndication(XorMappedAddress xorPeerAddress, byte[] data, TurnAllocation allocation) { StunMessage msg = new StunMessage(StunMethodType.Send, StunMethodClass.Indication, StunUtilities.NewTransactionId); msg.Turn.XorPeerAddress = xorPeerAddress; msg.Turn.Data = new StunAttribute(StunAttributeType.Data, data); msg.Stun.Username = new UTF8Attribute(StunAttributeType.Username, allocation.Username); msg.Stun.Realm = new UTF8Attribute(StunAttributeType.Realm, allocation.Realm); msg.Stun.Nonce = new UTF8Attribute(StunAttributeType.Nonce, allocation.Nonce); msg.AddMessageIntegrity(allocation.Password, true); this.StunClient.BeginSendMessage(msg, null); }
/// <summary> /// TODO: Documentation BindChannel /// </summary> /// <param name="channelNumber"></param> /// <param name="xorPeerAddress"></param> /// <param name="allocation"></param> public void BindChannel(byte[] channelNumber, XorMappedAddress xorPeerAddress, TurnAllocation allocation) { StunMessage msg = new StunMessage(StunMethodType.ChannelBind, StunMethodClass.Request, StunUtilities.NewTransactionId); msg.Turn.ChannelNumber = new StunAttribute(StunAttributeType.ChannelNumber, channelNumber); msg.Turn.XorPeerAddress = xorPeerAddress; msg.Stun.Username = new UTF8Attribute(StunAttributeType.Username, allocation.Username); msg.Stun.Realm = new UTF8Attribute(StunAttributeType.Realm, allocation.Realm); msg.Stun.Nonce = new UTF8Attribute(StunAttributeType.Nonce, allocation.Nonce); msg.AddMessageIntegrity(allocation.Password, true); this.StunClient.BeginSendMessage(msg, allocation); }