David Garcia Quintas | 8c3d994 | 2016-03-08 00:07:14 -0800 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright 2016, 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 | |
David Garcia Quintas | ffd207f | 2016-08-01 16:20:52 -0700 | [diff] [blame] | 34 | #ifndef GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H |
| 35 | #define GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H |
| 36 | |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 37 | // This file should be compiled as part of grpc++. |
| 38 | |
David Garcia Quintas | 8c3d994 | 2016-03-08 00:07:14 -0800 | [diff] [blame] | 39 | #include <grpc++/impl/codegen/core_codegen_interface.h> |
David Garcia Quintas | 8c3d994 | 2016-03-08 00:07:14 -0800 | [diff] [blame] | 40 | #include <grpc/byte_buffer.h> |
Craig Tiller | f40df23 | 2016-03-25 13:38:14 -0700 | [diff] [blame] | 41 | #include <grpc/impl/codegen/grpc_types.h> |
David Garcia Quintas | 8c3d994 | 2016-03-08 00:07:14 -0800 | [diff] [blame] | 42 | |
| 43 | namespace grpc { |
| 44 | |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 45 | /// Implementation of the core codegen interface. |
David Garcia Quintas | 8c3d994 | 2016-03-08 00:07:14 -0800 | [diff] [blame] | 46 | class CoreCodegen : public CoreCodegenInterface { |
| 47 | private: |
vjpai | 97da647 | 2016-06-13 09:56:26 -0700 | [diff] [blame] | 48 | grpc_completion_queue* grpc_completion_queue_create(void* reserved) |
| 49 | GRPC_OVERRIDE; |
Vijay Pai | ce350a5 | 2016-06-09 17:22:35 -0700 | [diff] [blame] | 50 | void grpc_completion_queue_destroy(grpc_completion_queue* cq) GRPC_OVERRIDE; |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 51 | grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag, |
| 52 | gpr_timespec deadline, |
Vijay Pai | ce350a5 | 2016-06-09 17:22:35 -0700 | [diff] [blame] | 53 | void* reserved) GRPC_OVERRIDE; |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 54 | |
Vijay Pai | ce350a5 | 2016-06-09 17:22:35 -0700 | [diff] [blame] | 55 | void* gpr_malloc(size_t size) GRPC_OVERRIDE; |
| 56 | void gpr_free(void* p) GRPC_OVERRIDE; |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 57 | |
Vijay Pai | ce350a5 | 2016-06-09 17:22:35 -0700 | [diff] [blame] | 58 | void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) GRPC_OVERRIDE; |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 59 | |
David Garcia Quintas | 6721d4f | 2016-06-30 17:17:23 -0700 | [diff] [blame] | 60 | int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, |
| 61 | grpc_byte_buffer* buffer) GRPC_OVERRIDE; |
vjpai | 97da647 | 2016-06-13 09:56:26 -0700 | [diff] [blame] | 62 | void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader* reader) |
| 63 | GRPC_OVERRIDE; |
David Garcia Quintas | 1b2db63 | 2016-04-27 15:06:54 -0700 | [diff] [blame] | 64 | int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader, |
Vijay Pai | ce350a5 | 2016-06-09 17:22:35 -0700 | [diff] [blame] | 65 | gpr_slice* slice) GRPC_OVERRIDE; |
David Garcia Quintas | 1b2db63 | 2016-04-27 15:06:54 -0700 | [diff] [blame] | 66 | |
| 67 | grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice, |
Vijay Pai | ce350a5 | 2016-06-09 17:22:35 -0700 | [diff] [blame] | 68 | size_t nslices) GRPC_OVERRIDE; |
David Garcia Quintas | 1b2db63 | 2016-04-27 15:06:54 -0700 | [diff] [blame] | 69 | |
Vijay Pai | ce350a5 | 2016-06-09 17:22:35 -0700 | [diff] [blame] | 70 | gpr_slice gpr_slice_malloc(size_t length) GRPC_OVERRIDE; |
| 71 | void gpr_slice_unref(gpr_slice slice) GRPC_OVERRIDE; |
| 72 | gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) GRPC_OVERRIDE; |
vjpai | 97da647 | 2016-06-13 09:56:26 -0700 | [diff] [blame] | 73 | void gpr_slice_buffer_add(gpr_slice_buffer* sb, |
Vijay Pai | 20bf126 | 2016-06-15 22:21:48 -0700 | [diff] [blame] | 74 | gpr_slice slice) GRPC_OVERRIDE; |
Vijay Pai | ce350a5 | 2016-06-09 17:22:35 -0700 | [diff] [blame] | 75 | void gpr_slice_buffer_pop(gpr_slice_buffer* sb) GRPC_OVERRIDE; |
David Garcia Quintas | 1b2db63 | 2016-04-27 15:06:54 -0700 | [diff] [blame] | 76 | |
Vijay Pai | ce350a5 | 2016-06-09 17:22:35 -0700 | [diff] [blame] | 77 | void grpc_metadata_array_init(grpc_metadata_array* array) GRPC_OVERRIDE; |
| 78 | void grpc_metadata_array_destroy(grpc_metadata_array* array) GRPC_OVERRIDE; |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 79 | |
Vijay Pai | ce350a5 | 2016-06-09 17:22:35 -0700 | [diff] [blame] | 80 | gpr_timespec gpr_inf_future(gpr_clock_type type) GRPC_OVERRIDE; |
David Garcia Quintas | 60ee8dd | 2016-03-08 17:21:42 -0800 | [diff] [blame] | 81 | |
Vijay Pai | ce350a5 | 2016-06-09 17:22:35 -0700 | [diff] [blame] | 82 | virtual const Status& ok() GRPC_OVERRIDE; |
| 83 | virtual const Status& cancelled() GRPC_OVERRIDE; |
David Garcia Quintas | 1b2db63 | 2016-04-27 15:06:54 -0700 | [diff] [blame] | 84 | |
Vijay Pai | ce350a5 | 2016-06-09 17:22:35 -0700 | [diff] [blame] | 85 | void assert_fail(const char* failed_assertion) GRPC_OVERRIDE; |
David Garcia Quintas | 8c3d994 | 2016-03-08 00:07:14 -0800 | [diff] [blame] | 86 | }; |
| 87 | |
| 88 | } // namespace grpc |
David Garcia Quintas | ffd207f | 2016-08-01 16:20:52 -0700 | [diff] [blame] | 89 | |
| 90 | #endif // GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H |