コード例 #1
0
        /// <summary>
        /// writes this profile to the cdrStream
        /// </summary>
        /// <param name="cdrStream"></param>
        /// <remarks>
        public override void WriteToStream(CdrOutputStream cdrStream)
        {
            // write the profile id of this profile
            cdrStream.WriteULong((uint)ProfileId);
            uint length = (uint)m_data.Length;

            cdrStream.WriteULong(length);
            cdrStream.WriteOpaque(m_data);
        }
コード例 #2
0
        /// <summary>
        /// writes this profile to the cdrStream
        /// </summary>
        /// <param name="cdrStream"></param>
        /// <remarks>
        public override void WriteToStream(CdrOutputStream cdrStream)
        {
            // write the profile id of this profile
            cdrStream.WriteULong((uint)ProfileId);
            CdrEncapsulationOutputStream encapStream = GetProfileContentStream();

            // write the whole encapsulation to the stream
            cdrStream.WriteEncapsulation(encapStream);
        }
コード例 #3
0
ファイル: Services.cs プロジェクト: arttsai/IIOP-dot-Net
 internal void WriteSvcContextList(CdrOutputStream outputStream)
 {
     outputStream.WriteULong((uint)m_contexts.Count);
     foreach (DictionaryEntry entry in m_contexts)
     {
         ServiceContext context = (ServiceContext)entry.Value;
         context.Write(outputStream);
     }
 }
コード例 #4
0
 /// <summary>
 /// write this IOR to a CDR-Stream in non-stringified form
 /// </summary>
 internal void WriteToStream(CdrOutputStream cdrStream)
 {
     cdrStream.WriteString(m_typId);
     cdrStream.WriteULong((uint)m_profiles.Length); // nr of profiles
     for (int i = 0; i < m_profiles.Length; i++)
     {
         m_profiles[i].WriteToStream(cdrStream);
     }
 }
コード例 #5
0
            internal FragmentedMsgDesc(CdrInputStreamImpl firstFragment, int nrOfBytesFromCurrentPos,
                                       GiopHeader header, uint reqId)
            {
                m_target = new MemoryStream();
                m_header = header;
                CdrOutputStream outputStream =
                    header.WriteToStream(m_target, (uint)nrOfBytesFromCurrentPos); // place-holder header

                outputStream.WriteULong(reqId);                                    // add req-id, because already read
                AddFragment(firstFragment, nrOfBytesFromCurrentPos);
            }
コード例 #6
0
ファイル: GIOPHeader.cs プロジェクト: divyang4481/IIOPNet
 /// <summary>
 /// writes this message header to a stream
 /// </summary>
 /// <param name="stream">the stream to write to</param>
 /// <param name="msgLength">the length of the msg content</param>
 internal void WriteToStream(CdrOutputStream stream, uint msgLength)
 {
     Debug.WriteLine("\nGIOP-message header starting: ");
     // write magic
     for (int i = 0; i < m_giop_magic.Length; i++)
     {
         Debug.Write(m_giop_magic[i] + " ");
         stream.WriteOctet(m_giop_magic[i]);
     }
     // write GIOP_Version
     Debug.Write(m_version.Major + " ");
     stream.WriteOctet(m_version.Major);
     Debug.Write(m_version.Minor + " ");
     stream.WriteOctet(m_version.Minor);
     // writing GIOP_flags
     Debug.Write(m_flags + " ");
     stream.WriteOctet(m_flags);
     Debug.Write((byte)m_type + " ");
     stream.WriteOctet((byte)m_type); // the message type
     Debug.Write("\nMessage-length: " + msgLength + "\n");
     stream.WriteULong(msgLength);
 }
コード例 #7
0
ファイル: Services.cs プロジェクト: arttsai/IIOP-dot-Net
 /// <summary>
 /// serialise the service context
 /// </summary>
 internal void Write(CdrOutputStream outputStream)
 {
     outputStream.WriteULong((uint)context_id);
     outputStream.WriteULong((uint)context_data.Length);
     outputStream.WriteOpaque(context_data);
 }
コード例 #8
0
 private void WriteTargetKey(CdrOutputStream cdrStream, byte[] objectKey) {
     Debug.WriteLine("writing object key with length: " + objectKey.Length);
     cdrStream.WriteULong((uint)objectKey.Length); // object-key length
     cdrStream.WriteOpaque(objectKey);
 }
コード例 #9
0
 /// <summary>
 /// writes this message header to a stream
 /// </summary>
 /// <param name="stream">the stream to write to</param>
 /// <param name="msgLength">the length of the msg content</param>
 internal void WriteToStream(CdrOutputStream stream, uint msgLength) {
     Debug.WriteLine("\nGIOP-message header starting: ");
     // write magic
     for (int i = 0; i < m_giop_magic.Length; i++) {
         Debug.Write(m_giop_magic[i] + " ");    
         stream.WriteOctet(m_giop_magic[i]);    
     }
     // write GIOP_Version
     Debug.Write(m_version.Major + " ");
     stream.WriteOctet(m_version.Major);
     Debug.Write(m_version.Minor + " ");
     stream.WriteOctet(m_version.Minor);
     // writing GIOP_flags
     Debug.Write(m_flags + " ");
     stream.WriteOctet(m_flags);
     Debug.Write((byte)m_type + " ");
     stream.WriteOctet((byte)m_type); // the message type
     Debug.Write("\nMessage-length: " + msgLength + "\n");
     stream.WriteULong(msgLength);
 }
コード例 #10
0
ファイル: Services.cs プロジェクト: JnS-Software-LLC/iiop-net
 internal void WriteSvcContextList(CdrOutputStream outputStream) {
     outputStream.WriteULong((uint)m_contexts.Count);
     foreach (DictionaryEntry entry in m_contexts) {
         ServiceContext context = (ServiceContext)entry.Value;
         context.Write(outputStream);
     }
 }
コード例 #11
0
 internal void WriteTaggedComponentList(CdrOutputStream outputStream) {
     outputStream.WriteULong((uint)m_components.Length);
     for (int i = 0; i < m_components.Length; i++) {                
         m_components[i].Write(outputStream);
     }
 }
コード例 #12
0
 /// <summary>
 /// serialises a locate reply message.
 /// </summary>
 /// <param name="forwardAddr">
 /// specifies the IOR of the object to forward the call to. This parameter must be != null,
 /// if LocateStatus is OBJECT_FORWARD.
 ///  </param>
 public void SerialiseLocateReply(CdrOutputStream targetStream, GiopVersion version, uint forRequestId, 
                                  LocateReplyMessage msg) {
     targetStream.WriteULong(forRequestId);
     switch (msg.Status) {
         case LocateStatus.OBJECT_HERE:
             targetStream.WriteULong((uint)msg.Status);
             break;
         default:
             Debug.WriteLine("Locate reply status not supported");
             throw new NotSupportedException("not supported");
     }
 }
コード例 #13
0
ファイル: IOR.cs プロジェクト: JnS-Software-LLC/iiop-net
 /// <summary>
 /// writes this profile to the cdrStream
 /// </summary>
 /// <param name="cdrStream"></param>
 /// <remarks>
 public override void WriteToStream(CdrOutputStream cdrStream)
 {
     // write the profile id of this profile
     cdrStream.WriteULong((uint)ProfileId);
     uint length = (uint)m_data.Length;
     cdrStream.WriteULong(length);
     cdrStream.WriteOpaque(m_data);
 }
コード例 #14
0
ファイル: IOR.cs プロジェクト: JnS-Software-LLC/iiop-net
 /// <summary>
 /// write a null IOR instance to a CDR-Stream in non-stringified form
 /// </summary>
 internal static void WriteNullToStream(CdrOutputStream cdrStream)
 {
     cdrStream.WriteString(string.Empty);
     cdrStream.WriteULong(0);
 }
コード例 #15
0
 /// <summary>
 /// serialise the service context
 /// </summary>
 internal void Write(CdrOutputStream outputStream)
 {
     outputStream.WriteULong((uint)tag);
     outputStream.WriteULong((uint)component_data.Length);
     outputStream.WriteOpaque(component_data);
 }
コード例 #16
0
ファイル: Services.cs プロジェクト: JnS-Software-LLC/iiop-net
 /// <summary>
 /// serialise the service context
 /// </summary>
 internal void Write(CdrOutputStream outputStream) {
     outputStream.WriteULong((uint)context_id);
     outputStream.WriteULong((uint)context_data.Length);
     outputStream.WriteOpaque(context_data);
 }
コード例 #17
0
 /// <summary>
 /// write a null IOR instance to a CDR-Stream in non-stringified form
 /// </summary>
 internal static void WriteNullToStream(CdrOutputStream cdrStream)
 {
     cdrStream.WriteString(string.Empty);
     cdrStream.WriteULong(0);
 }
コード例 #18
0
ファイル: IOR.cs プロジェクト: JnS-Software-LLC/iiop-net
 /// <summary>
 /// write this IOR to a CDR-Stream in non-stringified form
 /// </summary>
 internal void WriteToStream(CdrOutputStream cdrStream)
 {
     cdrStream.WriteString(m_typId);
     cdrStream.WriteULong((uint)m_profiles.Length); // nr of profiles
     for (int i = 0; i < m_profiles.Length; i++)
     {
         m_profiles[i].WriteToStream(cdrStream);
     }
 }
コード例 #19
0
 /// <summary>
 /// serialises the message body for a GIOP request
 /// </summary>
 /// <param name="clientRequest">the giop request Msg</param>
 /// <param name="targetStream"></param>
 /// <param name="version">the Giop version to use</param>
 /// <param name="conDesc">the connection used for this request</param>
 internal void SerialiseRequest(GiopClientRequest clientRequest,
                                CdrOutputStream targetStream, 
                                IIorProfile targetProfile, GiopConnectionDesc conDesc) {
     Trace.WriteLine(String.Format("serializing request for method {0}; uri {1}; id {2}", 
                                   clientRequest.MethodToCall, clientRequest.CalledUri, 
                                   clientRequest.RequestId));
     try {
         clientRequest.SetRequestPICurrentFromThreadScopeCurrent(); // copy from thread scope picurrent before processing request
         
         ArgumentsSerializer ser =
             m_argSerFactory.Create(clientRequest.MethodToCall.DeclaringType);
         // determine the request method to send
         string idlRequestName = ser.GetRequestNameFor(clientRequest.MethodToCall);
         clientRequest.RequestMethodName = idlRequestName;
         
         clientRequest.InterceptSendRequest();
         GiopVersion version = targetProfile.Version;
         ServiceContextList cntxColl = clientRequest.RequestServiceContext;
         // set code-set for the stream
         PerformCodeSetEstablishmentClient(targetProfile, conDesc, cntxColl);
         SetCodeSet(targetStream, conDesc);
         
         if (version.IsBeforeGiop1_2()) { // for GIOP 1.0 / 1.1
             SerialiseContext(targetStream, cntxColl); // service context
         }
         
         targetStream.WriteULong(clientRequest.RequestId);
         byte responseFlags = 0;
         if (version.IsBeforeGiop1_2()) { // GIOP 1.0 / 1.1
             responseFlags = 1;
         } else {
             // reply-expected, no DII-call --> must be 0x03, no reply --> must be 0x00
             responseFlags = 3;
         }
         if (clientRequest.IsOneWayCall) {
             responseFlags = 0;
         } // check if one-way
         // write response-flags
         targetStream.WriteOctet(responseFlags);
         
         targetStream.WritePadding(3); // reserved bytes
         WriteTarget(targetStream, targetProfile.ObjectKey, version); // write the target-info
         targetStream.WriteString(clientRequest.RequestMethodName); // write the method name
         
         if (version.IsBeforeGiop1_2()) { // GIOP 1.0 / 1.1
             targetStream.WriteULong(0); // no principal
         } else { // GIOP 1.2
             SerialiseContext(targetStream, cntxColl); // service context
         }
         SerialiseRequestBody(targetStream, clientRequest, version, ser);
     } catch (Exception ex) {
         Debug.WriteLine("exception while serialising request: " + ex);
         Exception newException = clientRequest.InterceptReceiveException(ex); // interception point may change exception
         if (newException == ex) {
             throw;
         } else {
             throw newException; // exception has been changed by interception point
         }
     }
 }
コード例 #20
0
ファイル: IOR.cs プロジェクト: JnS-Software-LLC/iiop-net
 /// <summary>
 /// writes this profile to the cdrStream
 /// </summary>
 /// <param name="cdrStream"></param>
 /// <remarks>
 public override void WriteToStream(CdrOutputStream cdrStream)
 {
     // write the profile id of this profile
     cdrStream.WriteULong((uint)ProfileId);
     CdrEncapsulationOutputStream encapStream = GetProfileContentStream();
     // write the whole encapsulation to the stream
     cdrStream.WriteEncapsulation(encapStream);
 }
コード例 #21
0
 /// <summary>serialize the GIOP message body of a repsonse message</summary>
 /// <param name="requestId">the requestId of the request, this response belongs to</param>
 internal void SerialiseReply(GiopServerRequest request, CdrOutputStream targetStream, 
                            GiopVersion version,
                            GiopConnectionDesc conDesc) {
     Trace.WriteLine("serializing response for method: " + request.GetRequestedMethodNameInternal());
     try {
         bool isExceptionReply = request.IsExceptionReply;
         Exception exceptionToSend = null;
         try {
             request.SetRequestPICurrentFromThreadScopeCurrent(); // copy from thread scope picurrent after processing request by servant
             // reply interception point
             if (!request.IsExceptionReply) {
                 request.InterceptSendReply();
             } else {
                 exceptionToSend = request.InterceptSendException(request.IdlException);
             }
         } catch (Exception ex) {
             // update the reply with the exception from interception layer
             isExceptionReply = true;
             if (SerialiseAsSystemException(ex)) {
                 exceptionToSend = ex;
             } else {
                 exceptionToSend = new UNKNOWN(300, CompletionStatus.Completed_MayBe);
             }
         }
         ServiceContextList cntxColl = request.ResponseServiceContext;
         SetCodeSet(targetStream, conDesc);
         
         if (version.IsBeforeGiop1_2()) { // for GIOP 1.0 / 1.1
             SerialiseContext(targetStream, cntxColl); // serialize the context
         }
         
         targetStream.WriteULong(request.RequestId);
         
         if (!isExceptionReply) {
             Trace.WriteLine("sending normal response to client");
             targetStream.WriteULong(0); // reply status ok
             
             if (!version.IsBeforeGiop1_2()) { // for GIOP 1.2 and later, service context is here
                 SerialiseContext(targetStream, cntxColl); // serialize the context
             }
             // serialize a response to a successful request
             SerialiseResponseOk(targetStream, request, version);
             Trace.WriteLine("reply body serialised");
         } else {
             Trace.WriteLine("excpetion to send to client: " + exceptionToSend.GetType());
             
             if (SerialiseAsSystemException(exceptionToSend)) {
                 targetStream.WriteULong(2); // system exception
             } else if (SerialiseAsUserException(exceptionToSend)) {
                 targetStream.WriteULong(1); // user exception
             } else {
                 // should not occur
                 targetStream.WriteULong(2);
                 exceptionToSend = new INTERNAL(204, CompletionStatus.Completed_Yes);
             }
             
             if (!version.IsBeforeGiop1_2()) { // for GIOP 1.2 and later, service context is here
                 SerialiseContext(targetStream, cntxColl); // serialize the context
             }
             AlignBodyIfNeeded(targetStream, version);
             if (SerialiseAsSystemException(exceptionToSend)) {
                 SerialiseSystemException(targetStream, exceptionToSend);
             } else {
                 SerialiseUserException(targetStream, (AbstractUserException)exceptionToSend);
             }
             Trace.WriteLine("exception reply serialised");
         }
     } finally {
         request.ClearThreadScopePICurrent(); // no longer needed, clear afterwards to prevent access to stale data during next requests
     }
 }
コード例 #22
0
ファイル: TypeCode.cs プロジェクト: JnS-Software-LLC/iiop-net
 internal override void WriteToStream(CdrOutputStream cdrStream,
                                      SerializerFactory serFactory)
 {
     base.WriteToStream(cdrStream, serFactory);
     cdrStream.WriteULong((uint)m_length);
 }
コード例 #23
0
 /// <summary>
 /// serialise the service context
 /// </summary>
 internal void Write(CdrOutputStream outputStream) {
     outputStream.WriteULong((uint)tag);
     outputStream.WriteULong((uint)component_data.Length);
     outputStream.WriteOpaque(component_data);
 }