Пример #1
0
 private void ProcessRPCRequest(RPCPDU rpcRequest)
 {
     if (rpcRequest is BindPDU)
     {
         BindAckPDU bindAckPDU = RemoteServiceHelper.GetRPCBindResponse((BindPDU)rpcRequest, m_service);
         m_maxTransmitFragmentSize = bindAckPDU.MaxTransmitFragmentSize;
         Append(bindAckPDU.GetBytes());
     }
     else if (m_maxTransmitFragmentSize.HasValue && rpcRequest is RequestPDU) // if BindPDU was not received, we treat as protocol error
     {
         List <RPCPDU> responsePDUs = RemoteServiceHelper.GetRPCResponse((RequestPDU)rpcRequest, m_service, m_maxTransmitFragmentSize.Value);
         foreach (RPCPDU responsePDU in responsePDUs)
         {
             Append(responsePDU.GetBytes());
         }
     }
     else
     {
         FaultPDU faultPDU = new FaultPDU();
         faultPDU.Flags = PacketFlags.FirstFragment | PacketFlags.LastFragment;
         faultPDU.DataRepresentation = new DataRepresentationFormat(CharacterFormat.ASCII, ByteOrder.LittleEndian, FloatingPointRepresentation.IEEE);
         faultPDU.CallID             = 0;
         faultPDU.AllocationHint     = RPCPDU.CommonFieldsLength + FaultPDU.FaultFieldsLength;
         faultPDU.Status             = FaultStatus.ProtocolError;
         Append(faultPDU.GetBytes());
     }
 }
Пример #2
0
 private void ProcessRPCRequest(RPCPDU rpcRequest)
 {
     if (rpcRequest is BindPDU)
     {
         BindAckPDU bindAckPDU = RemoteServiceHelper.GetRPCBindResponse((BindPDU)rpcRequest, m_service);
         m_maxTransmitFragmentSize = bindAckPDU.MaxTransmitFragmentSize;
         Append(bindAckPDU.GetBytes());
     }
     else if (rpcRequest is RequestPDU)
     {
         // if BindPDU was not received, we ignore any subsequent RPC packets
         if (m_maxTransmitFragmentSize.HasValue)
         {
             List <ResponsePDU> responsePDUs = RemoteServiceHelper.GetRPCResponse((RequestPDU)rpcRequest, m_service, m_maxTransmitFragmentSize.Value);
             foreach (ResponsePDU responsePDU in responsePDUs)
             {
                 Append(responsePDU.GetBytes());
             }
         }
     }
     else
     {
         throw new NotImplementedException("Unsupported RPC Packet Type");
     }
 }