Exemple #1
0
        /// <summary>
        /// This method processes the bind_receiver PDU and performs the bind to the session.
        /// </summary>
        /// <param name="pdu">Protocol Data Unit being processed</param>
        public override void Process(bind_receiver pdu)
        {
            // Build our response PDU
            bind_receiver_resp pduOut = new bind_receiver_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 SmscBoundRXSessionState(session_);
                }
                else
                {
                    session_.PeerSystemID = "";
                    session_.SmppVersion  = 0;
                }
                session_.SendPdu(pduOut);
            }
        }
        /// <summary>
        /// This processes the unbind event; we always allow this event.
        /// </summary>
        /// <param name="pdu">Protocol Data Unit</param>
        public override void Process(unbind pdu)
        {
            unbind_resp pduOut = new unbind_resp(pdu.SequenceNumber);

            session_.FireEvent(EventType.UnBind, new SmppEventArgs(session_, pdu, pduOut));
            session_.PeerSystemID = "";
            session_.SmppVersion  = 0;
            session_.CurrentState = new SmscOpenSessionState(session_);
            session_.SendPdu(pduOut);
            session_.Close();
        }