コード例 #1
0
        /// <summary>
        /// This method processes the bind_transmitter PDU and performs the bind to the session.
        /// </summary>
        /// <param name="pdu">Protocol Data Unit being processed</param>
        public override void Process(bind_transmitter pdu)
        {
            // Build our response PDU
            bind_transmitter_resp pduOut = new bind_transmitter_resp(pdu.SequenceNumber, session_.LocalSystemID);

            // Assign the peer id and version
            session_.PeerSystemID = pdu.SystemID;
            session_.SmppVersion  = pdu.InterfaceVersion;

            // Fire the bind event to the session owner
            SmppEventArgs ea = new SmppEventArgs(session_, pdu, pduOut);

            if (session_.FireEvent(EventType.Bind, ea))
            {
                // If the session owner indicated it's ok to bind, then perform the binding.
                if (pduOut.Status == StatusCodes.ESME_ROK)
                {
                    session_.CurrentState = new SmscBoundTXSessionState(session_);
                }
                else
                {
                    session_.PeerSystemID = "";
                    session_.SmppVersion  = 0;
                }
                session_.SendPdu(pduOut);
            }
        }
コード例 #2
0
 /// <summary>
 /// This method processes the bind_transmitter PDU and performs the bind to the session.
 /// </summary>
 /// <param name="pdu">Protocol Data Unit being processed</param>
 public override void Process(bind_transmitter_resp pdu)
 {
     if (pdu.Status == StatusCodes.ESME_ROK)
     {
         this.session.CurrentState = new EsmeBoundTXSessionState(this.session);
         this.session.FireEvent(EventTypes.Bound, new SmppEventArgs(this.session, pdu.OriginalRequest, pdu));
     }
 }
コード例 #3
0
ファイル: EsmeSession.cs プロジェクト: xtoblizi/smpp.net
        /// <summary>
        /// This method sends a bind_transmitter packet synchronously over to the peer.
        /// </summary>
        /// <param name="pdu">bind_transmitter packet</param>
        /// <returns>bind_transmitter_resp</returns>
        public bind_transmitter_resp BindTransmitter(bind_transmitter pdu)
        {
            bind_transmitter_resp response = null;
            PduSyncronizer        sync     = AddWaitingPdu(pdu);

            if (sync != null)
            {
                if (SendPdu(pdu))
                {
                    if (sync.WaitForResponse())
                    {
                        response = sync.PduResponse as bind_transmitter_resp;
                        if (response != null)
                        {
                            if (response.Status == StatusCodes.ESME_ROK)
                            {
                                base.CurrentState = new EsmeBoundTXSessionState(this);
                            }
                        }
                        else
                        {
                            response = new bind_transmitter_resp(pdu.SequenceNumber, sync.PduResponse.Status);
                        }
                    }
                    else
                    {
                        response = new bind_transmitter_resp(pdu.SequenceNumber, StatusCodes.ESME_RINVEXPIRY);
                    }
                }
                else
                {
                    response = new bind_transmitter_resp(pdu.SequenceNumber, StatusCodes.ESME_RBINDFAIL);
                }
                FindAndRemoveWaitingPdu(pdu.SequenceNumber);
            }
            else
            {
                response = new bind_transmitter_resp(pdu.SequenceNumber, StatusCodes.ESME_RMSGQFUL);
            }

            return(response);
        }
コード例 #4
0
 /// <summary>
 /// This processes the bind_transmitter PDU
 /// </summary>
 /// <param name="pdu">Protocol Data Unit being processed</param>
 public virtual void Process(bind_transmitter_resp pdu)
 {
     throw new InvalidSmppStateException("Session is not in the proper state for a bind operation.");
 }