OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * |
| 3 * Copyright 2015, Google Inc. |
| 4 * All rights reserved. |
| 5 * |
| 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions are |
| 8 * met: |
| 9 * |
| 10 * * Redistributions of source code must retain the above copyright |
| 11 * notice, this list of conditions and the following disclaimer. |
| 12 * * Redistributions in binary form must reproduce the above |
| 13 * copyright notice, this list of conditions and the following disclaimer |
| 14 * in the documentation and/or other materials provided with the |
| 15 * distribution. |
| 16 * * Neither the name of Google Inc. nor the names of its |
| 17 * contributors may be used to endorse or promote products derived from |
| 18 * this software without specific prior written permission. |
| 19 * |
| 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 * |
| 32 */ |
| 33 |
| 34 #ifndef GRPC_INTERNAL_CORE_SURFACE_CALL_H |
| 35 #define GRPC_INTERNAL_CORE_SURFACE_CALL_H |
| 36 |
| 37 #include "src/core/channel/channel_stack.h" |
| 38 #include "src/core/channel/context.h" |
| 39 #include "src/core/surface/api_trace.h" |
| 40 #include "src/core/surface/surface_trace.h" |
| 41 #include <grpc/grpc.h> |
| 42 |
| 43 #ifdef __cplusplus |
| 44 extern "C" { |
| 45 #endif |
| 46 |
| 47 typedef void (*grpc_ioreq_completion_func)(grpc_exec_ctx *exec_ctx, |
| 48 grpc_call *call, int success, |
| 49 void *user_data); |
| 50 |
| 51 grpc_call *grpc_call_create(grpc_channel *channel, grpc_call *parent_call, |
| 52 uint32_t propagation_mask, |
| 53 grpc_completion_queue *cq, |
| 54 const void *server_transport_data, |
| 55 grpc_mdelem **add_initial_metadata, |
| 56 size_t add_initial_metadata_count, |
| 57 gpr_timespec send_deadline); |
| 58 |
| 59 void grpc_call_set_completion_queue(grpc_exec_ctx *exec_ctx, grpc_call *call, |
| 60 grpc_completion_queue *cq); |
| 61 |
| 62 #ifdef GRPC_STREAM_REFCOUNT_DEBUG |
| 63 void grpc_call_internal_ref(grpc_call *call, const char *reason); |
| 64 void grpc_call_internal_unref(grpc_exec_ctx *exec_ctx, grpc_call *call, |
| 65 const char *reason); |
| 66 #define GRPC_CALL_INTERNAL_REF(call, reason) \ |
| 67 grpc_call_internal_ref(call, reason) |
| 68 #define GRPC_CALL_INTERNAL_UNREF(exec_ctx, call, reason) \ |
| 69 grpc_call_internal_unref(exec_ctx, call, reason) |
| 70 #else |
| 71 void grpc_call_internal_ref(grpc_call *call); |
| 72 void grpc_call_internal_unref(grpc_exec_ctx *exec_ctx, grpc_call *call); |
| 73 #define GRPC_CALL_INTERNAL_REF(call, reason) grpc_call_internal_ref(call) |
| 74 #define GRPC_CALL_INTERNAL_UNREF(exec_ctx, call, reason) \ |
| 75 grpc_call_internal_unref(exec_ctx, call) |
| 76 #endif |
| 77 |
| 78 grpc_call_stack *grpc_call_get_call_stack(grpc_call *call); |
| 79 |
| 80 grpc_call_error grpc_call_start_batch_and_execute(grpc_exec_ctx *exec_ctx, |
| 81 grpc_call *call, |
| 82 const grpc_op *ops, |
| 83 size_t nops, |
| 84 grpc_closure *closure); |
| 85 |
| 86 /* Given the top call_element, get the call object. */ |
| 87 grpc_call *grpc_call_from_top_element(grpc_call_element *surface_element); |
| 88 |
| 89 void grpc_call_log_batch(char *file, int line, gpr_log_severity severity, |
| 90 grpc_call *call, const grpc_op *ops, size_t nops, |
| 91 void *tag); |
| 92 |
| 93 /* Set a context pointer. |
| 94 No thread safety guarantees are made wrt this value. */ |
| 95 void grpc_call_context_set(grpc_call *call, grpc_context_index elem, |
| 96 void *value, void (*destroy)(void *value)); |
| 97 /* Get a context pointer. */ |
| 98 void *grpc_call_context_get(grpc_call *call, grpc_context_index elem); |
| 99 |
| 100 #define GRPC_CALL_LOG_BATCH(sev, call, ops, nops, tag) \ |
| 101 if (grpc_api_trace) grpc_call_log_batch(sev, call, ops, nops, tag) |
| 102 |
| 103 uint8_t grpc_call_is_client(grpc_call *call); |
| 104 |
| 105 #ifdef __cplusplus |
| 106 } |
| 107 #endif |
| 108 |
| 109 #endif /* GRPC_INTERNAL_CORE_SURFACE_CALL_H */ |
OLD | NEW |