コード例 #1
0
        public override P2PHeader CreateAck()
        {
            P2Pv2Header ack = new P2Pv2Header();

            if ((OperationCode & (byte)MSNPSharp.OperationCode.RAK) > 0)
            {
                ack.AckIdentifier = Identifier + MessageSize;
                ack.OperationCode = (byte)MSNPSharp.OperationCode.None;

                if (MessageSize > 0)
                {
                    if (!IsAcknowledgement)
                    {
                        if ((OperationCode & (byte)MSNPSharp.OperationCode.SYN) != 0)
                        {
                            ack.OperationCode |= (byte)MSNPSharp.OperationCode.RAK;

                            if (HeaderTLVs.ContainsKey(0x01))
                            {
                                ack.HeaderTLVs.Add(0x01, HeaderTLVs[0x01]);  //If this is an ACK, we MUST copy the peer info TLV.
                                ack.OperationCode |= (byte)MSNPSharp.OperationCode.SYN;
                            }
                        }
                    }
                }
            }
            else
            {
                throw new MSNPSharpException("This P2Pv2 message do not need to be acknowledged.");
            }

            return(ack);
        }
コード例 #2
0
        public override P2PHeader CreateNak()
        {
            P2Pv2Header nak = new P2Pv2Header();

            nak.NakIdentifier = Identifier + MessageSize;

            return(nak);
        }
コード例 #3
0
ファイル: P2PHeader.cs プロジェクト: quynh68/msnp-sharp
        public override P2PHeader CreateNak()
        {
            P2Pv2Header nak = new P2Pv2Header();

            nak.NakIdentifier = Identifier + MessageSize;

            return nak;
        }
コード例 #4
0
ファイル: P2PHeader.cs プロジェクト: quynh68/msnp-sharp
        public override P2PHeader CreateAck()
        {
            P2Pv2Header ack = new P2Pv2Header();
            if ((OperationCode & (byte)MSNPSharp.OperationCode.RAK) > 0)
            {
                ack.AckIdentifier = Identifier + MessageSize;
                ack.OperationCode = (byte)MSNPSharp.OperationCode.None;

                if (MessageSize > 0)
                {
                    if (!IsAcknowledgement)
                    {
                        if ((OperationCode & (byte)MSNPSharp.OperationCode.SYN) != 0)
                        {
                            ack.OperationCode |= (byte)MSNPSharp.OperationCode.RAK;

                            if (HeaderTLVs.ContainsKey(0x01))
                            {
                                ack.HeaderTLVs.Add(0x01, HeaderTLVs[0x01]);  //If this is an ACK, we MUST copy the peer info TLV.
                                ack.OperationCode |= (byte)MSNPSharp.OperationCode.SYN;
                            }
                        }
                    }
                }
            }
            else
            {
                throw new MSNPSharpException("This P2Pv2 message do not need to be acknowledged.");
            }

            return ack;
        }