public static AReleaseRQ Parse(UnparsedPdu raw) { if (raw.Length() != 4) { throw new PduException("Illegal A-RELEASE-RP " + raw, new AAbort(AAbort.SERVICE_PROVIDER, AAbort.INVALID_PDU_PARAMETER_VALUE)); } return s_instance; }
internal override IPdu Parse(UnparsedPdu raw) { try { switch (raw.GetType()) { case 1: m_fsm.FireReceived(m_fsm.rq = AAssociateRQ.Parse(raw)); m_fsm.ChangeState(m_fsm.STA3); return m_fsm.rq; case 2: case 3: case 4: case 5: case 6: throw new PduException("Unexpected " + raw, new AAbort(AAbort.SERVICE_PROVIDER, AAbort.UNEXPECTED_PDU)); case 7: m_fsm.FireReceived(m_fsm.aa = AAbort.Parse(raw)); m_fsm.ChangeState(m_fsm.STA1); return m_fsm.aa; default: throw new PduException("Unrecognized " + raw, new AAbort(AAbort.SERVICE_PROVIDER, AAbort.UNRECOGNIZED_PDU)); } } catch (PduException ule) { try { Write(ule.AAbort); } catch (Exception) {} throw ule; } }
/// <summary> /// Read from network socket /// </summary> /// <param name="timeout"></param> /// <param name="buf"></param> /// <returns></returns> public IPdu Read(int timeout, byte[] buf) { try { UnparsedPdu raw = null; s.ReceiveTimeout = timeout; try { raw = new UnparsedPdu(stream, buf); } catch (IOException e) { ChangeState(STA1); throw e; } return raw != null ? state.Parse(raw) : null; } catch (IOException ioe) { if (assocListener != null) { assocListener.Error(assoc, ioe); } throw ioe; } }
internal override IPdu Parse(UnparsedPdu raw) { try { switch (raw.GetType()) { case 1: case 2: case 3: throw new PduException("Unexpected " + raw, new AAbort(AAbort.SERVICE_PROVIDER, AAbort.UNEXPECTED_PDU)); case 4: return m_fsm.FireReceived(PDataTF.Parse(raw)); case 5: IPdu pdu = m_fsm.FireReceived(AReleaseRQ.Parse(raw)); m_fsm.ChangeState(m_fsm.requestor ? m_fsm.STA9 : m_fsm.STA10); return pdu; case 6: m_fsm.FireReceived(pdu = AReleaseRP.Parse(raw)); m_fsm.ChangeState(m_fsm.STA1); return pdu; case 7: m_fsm.FireReceived(m_fsm.aa = AAbort.Parse(raw)); m_fsm.ChangeState(m_fsm.STA1); return m_fsm.aa; default: throw new PduException("Unrecognized " + raw, new AAbort(AAbort.SERVICE_PROVIDER, AAbort.UNRECOGNIZED_PDU)); } } catch (PduException ule) { try { Write(ule.AAbort); } catch (Exception) {} throw ule; } }
public virtual IPdu ReadFrom(Stream ins, byte[] buf) { var raw = new UnparsedPdu(ins, buf); switch (raw.GetType()) { case 1: return AAssociateRQ.Parse(raw); case 2: return AAssociateAC.Parse(raw); case 3: return AAssociateRJ.Parse(raw); case 4: return PDataTF.Parse(raw); case 5: return AReleaseRQ.Parse(raw); case 6: return AReleaseRP.Parse(raw); case 7: return AAbort.Parse(raw); default: throw new PduException("Unrecognized " + raw, new AAbort(AAbort.SERVICE_PROVIDER, AAbort.UNRECOGNIZED_PDU)); } }
internal static AAbort Parse(UnparsedPdu raw) { if (raw.Length() != 4) { throw new PduException("Illegal A-ABORT " + raw, new AAbort(SERVICE_PROVIDER, INVALID_PDU_PARAMETER_VALUE)); } return new AAbort(raw.Buffer()); }