/// <summary>
        /// Encode a PDU to a binary stream. Then send the stream.
        /// </summary>
        /// <param name="pdu">A specified type of a PDU. This argument cannot be null.
        /// If it is null, ArgumentNullException will be thrown.</param>
        /// <exception cref="System.ArgumentNullException">Thrown when the input parameter is null.</exception>
        public void SendPdu(KerberosPdu pdu)
        {
            if (pdu == null)
            {
                throw new ArgumentNullException("pdu");
            }

            if (UseProxy)
            {
                Debug.Assert(ProxyClient != null, "Proxy Client should be set when using proxy.");

                //temporarily change the tranpsort type to TCP, since all proxy messages are TCP format.
                var oriTransportType = Context.TransportType;
                Context.TransportType = TransportType.TCP;
                KDCProxyMessage message = ProxyClient.MakeProxyMessage(pdu);
                //send proxy message
                ProxyClient.SendProxyRequest(message);
                //restore the original transport type
                Context.TransportType = oriTransportType;
            }
            else
            {
                this.Connect();
                kdcTransport.SendPacket(pdu);
            }
        }
Example #2
0
 /// <summary>
 /// Method provided to socket, which can use it to send packet
 /// </summary>
 /// <param name="remoteEP">Remote endpoint</param>
 /// <param name="packet"></param>
 private void packetsender(IPEndPoint remoteEP, StackPacket packet)
 {
     if (running)
     {
         udpTransport.SendPacket(localEndPoint, remoteEP, packet);
     }
 }
Example #3
0
 /// <summary>
 /// Method provided to socket, which can use it to send packet
 /// </summary>
 /// <param name="remoteEP">Remote endpoint</param>
 /// <param name="packet"></param>
 private void PacketSender(IPEndPoint remoteEP, StackPacket packet)
 {
     if (started)
     {
         udpTransport.SendPacket(localEndPoint, remoteEP, packet);
     }
 }
        /// <summary>
        /// Encode a PDU to a binary stream. Then send the stream.
        /// The pdu could be got by calling method Create***Request or Create***Token.
        /// </summary>
        /// <param name="pdu">A specified type of a PDU. This argument cannot be null.
        /// If it is null, ArgumentNullException will be thrown.</param>
        /// <exception cref="System.ArgumentNullException">Thrown when the input parameter is null.</exception>
        public void SendPdu(KilePdu pdu)
        {
            if (pdu == null)
            {
                throw new ArgumentNullException("pdu");
            }

            context.UpdateContext(pdu);
            kdcTransport.SendPacket(pdu);
        }
        /// <summary>
        /// Encode a PDU to a binary stream. Then send the stream.
        /// </summary>
        /// <param name="pdu">A specified type of a PDU. This argument cannot be null.</param>
        /// <param name="kileConnection">Maintain a connection with a target client</param>
        /// <exception cref="System.ArgumentNullException">Thrown when the input parameter is null.</exception>
        public void SendPdu(KilePdu pdu, KileConnection kileConnection)
        {
            if (kileConnection == null)
            {
                throw new ArgumentNullException("kileConnection");
            }
            if (pdu == null)
            {
                throw new ArgumentNullException("pdu");
            }

            KileServerContext serverContext = GetServerContextByKileConnection(kileConnection);

            transport.SendPacket(kileConnection.TargetEndPoint, pdu);
            serverContext.UpdateContext(pdu);
        }
Example #6
0
 /// <summary>
 /// Sends a packet.
 /// </summary>
 /// <param name="context">The context that contains related info about client.</param>
 /// <param name="packet">The packet to be sent.</param>
 public void SendPacket(AdtsLdapContext context, AdtsLdapPacket packet)
 {
     transportStack.SendPacket(context.RemoteAddress, packet);
 }
 /// <summary>
 /// Method provided to socket, which can use it to send packet
 /// </summary>
 /// <param name="remoteEP">Remote endpoint</param>
 /// <param name="packet"></param>
 private void PacketSender(IPEndPoint remoteEP, StackPacket packet)
 {
     udpTransport.SendPacket(remoteEP, packet);
 }