Пример #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);
            }
        }
Пример #2
0
 /// <summary>
 /// This returns a specific error for the bind_receiver event; we are already bound!
 /// </summary>
 /// <param name="pdu">Protocol Data Unit</param>
 public override void Process(bind_receiver pdu)
 {
     session_.SendPdu(new bind_receiver_resp(pdu.SequenceNumber, StatusCodes.ESME_RALYBND));
 }