Home | History | Annotate | Download | only in Internal
      1 #region Copyright notice and license
      2 
      3 // Copyright 2015 gRPC authors.
      4 //
      5 // Licensed under the Apache License, Version 2.0 (the "License");
      6 // you may not use this file except in compliance with the License.
      7 // You may obtain a copy of the License at
      8 //
      9 //     http://www.apache.org/licenses/LICENSE-2.0
     10 //
     11 // Unless required by applicable law or agreed to in writing, software
     12 // distributed under the License is distributed on an "AS IS" BASIS,
     13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 // See the License for the specific language governing permissions and
     15 // limitations under the License.
     16 
     17 #endregion
     18 
     19 using System;
     20 using System.Runtime.InteropServices;
     21 
     22 namespace Grpc.Core.Internal
     23 {
     24     /// <summary>
     25     /// grpc_event from grpc/grpc.h
     26     /// </summary>
     27     [StructLayout(LayoutKind.Sequential)]
     28     internal struct CompletionQueueEvent
     29     {
     30         static readonly NativeMethods Native = NativeMethods.Get();
     31 
     32         public CompletionType type;
     33         public int success;
     34         public IntPtr tag;
     35 
     36         internal static int NativeSize
     37         {
     38             get
     39             {
     40                 return Native.grpcsharp_sizeof_grpc_event();
     41             }
     42         }
     43 
     44         /// <summary>
     45         /// grpc_completion_type from grpc/grpc.h
     46         /// </summary>
     47         internal enum CompletionType
     48         {
     49             /* Shutting down */
     50             Shutdown, 
     51 
     52             /* No event before timeout */
     53             Timeout,  
     54 
     55             /* operation completion */
     56             OpComplete
     57         }
     58     }
     59 }
     60