/// <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); } }
/// <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); }
/// <summary> /// This method invokes the BindTransmitter method asynchronously /// </summary> /// <param name="pdu">bind_transmitter PDU to send</param> /// <param name="callback">Asynch callback</param> /// <returns>IAsyncResult interface for monitoring</returns> public IAsyncResult BeginBindTransmitter(bind_transmitter pdu, AsyncCallback callback) { AsynchCall acr = new AsynchCall(callback, this); return(acr.BeginInvoke(new BindTransmitterDelegate(BindTransmitter), new object[] { pdu })); }
/// <summary> /// This processes the bind_transmitter PDU /// </summary> /// <param name="pdu">Protocol Data Unit being processed</param> public virtual void Process(bind_transmitter pdu) { throw new InvalidSmppStateException("Session is not in the proper state for a bind operation."); }
/// <summary> /// This returns a specific error for the bind_transmitter event; we are already bound! /// </summary> /// <param name="pdu">Protocol Data Unit</param> public override void Process(bind_transmitter pdu) { session_.SendPdu(new bind_transmitter_resp(pdu.SequenceNumber, StatusCodes.ESME_RALYBND)); }