Esempio n. 1
0
 static internal void ProtoRpcEndCs(
     RcfProtoServer self,
     RcfProtoSession session,
     IMessage response)
 {
     // Serialize response and send back to client.
     byte[] responseBuffer = response.ToByteArray();
     session._SetResponseBuffer(responseBuffer, responseBuffer.Length);
     session._Commit();
 }
Esempio n. 2
0
 public override void ProtoRpcBegin(
     _SwigCallbackArgs args,
     RcfProtoServer self,
     RcfProtoSession session,
     string serviceName,
     int methodId)
 {
     try
     {
         RcfProtoServerImpl.ProtoRpcBegin(mSelf, session, serviceName, methodId);
     }
     catch (System.Exception e)
     {
         args.mErrorString = e.Message;
     }
 }
Esempio n. 3
0
        // Entry point from C++.
        static internal void ProtoRpcBegin(
            RcfProtoServer self,
            RcfProtoSession session,
            string serviceName,
            int methodId)
        {
            int requestBufferLen = session._GetRequestBufferLength();

            byte[] requestBuffer = new byte[requestBufferLen];
            session._GetRequestBuffer(requestBuffer, requestBuffer.Length);

            // Look up the service and method.
            Google.ProtocolBuffers.IService service = null;
            if (self.mPbServices.ContainsKey(serviceName))
            {
                service = self.mPbServices[serviceName];
            }

            if (service == null)
            {
                string errorMsg = "The requested service does not exist on this server. Service name: " + serviceName;
                throw new Exception(errorMsg);
            }

            ServiceDescriptor serviceDesc = service.DescriptorForType;
            MethodDescriptor  methodDesc  = serviceDesc.Methods[methodId];

            // Build the request object.
            IMessage   requestPrototype = service.GetRequestPrototype(methodDesc);
            IBuilder   builder          = requestPrototype.WeakCreateBuilderForType();
            ByteString byteString       = ByteString.CopyFrom(requestBuffer);

            builder.WeakMergeFrom(byteString);
            IMessage request = builder.WeakBuild();

            // Call the PB service
            // "=>" not supported in .NET 2.0.
            //Action<IMessage> done = (IMessage msg) => ProtoRpcEndCs(session, msg);
            Action <IMessage> done = delegate(IMessage msg) { ProtoRpcEndCs(self, session, msg); };

            RcfProtoController controller = new RcfProtoController(session);

            service.CallMethod(methodDesc, controller, request, done);
        }
Esempio n. 4
0
 public virtual void ProtoRpcBegin(_SwigCallbackArgs args, RcfProtoServer server, RcfProtoSession context, string serviceName, int methodId)
 {
     if (SwigDerivedClassHasMethod("ProtoRpcBegin", swigMethodTypes1))
     {
         RCFProtoPINVOKE._SwigCallback_ProtoRpcBeginSwigExplicit_SwigCallback(swigCPtr, _SwigCallbackArgs.getCPtr(args), RcfProtoServer.getCPtr(server), RcfProtoSession.getCPtr(context), serviceName, methodId);
     }
     else
     {
         RCFProtoPINVOKE._SwigCallback_ProtoRpcBegin(swigCPtr, _SwigCallbackArgs.getCPtr(args), RcfProtoServer.getCPtr(server), RcfProtoSession.getCPtr(context), serviceName, methodId);
     }
     if (RCFProtoPINVOKE.SWIGPendingException.Pending)
     {
         throw RCFProtoPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 5
0
 public RcfProtoController(RcfProtoSession session)
 {
     mSession = session;
 }
Esempio n. 6
0
 internal static HandleRef getCPtr(RcfProtoSession obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }