blob: 2586b94504801ac467d597bf44d64fb7f8ae6656 [file] [log] [blame]
David Garcia Quintas8c3d9942016-03-08 00:07:14 -08001/*
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 Quintasffd207f2016-08-01 16:20:52 -070034#ifndef GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H
35#define GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H
36
David Garcia Quintas60ee8dd2016-03-08 17:21:42 -080037// This file should be compiled as part of grpc++.
38
David Garcia Quintas8c3d9942016-03-08 00:07:14 -080039#include <grpc++/impl/codegen/core_codegen_interface.h>
David Garcia Quintas8c3d9942016-03-08 00:07:14 -080040#include <grpc/byte_buffer.h>
Craig Tillerf40df232016-03-25 13:38:14 -070041#include <grpc/impl/codegen/grpc_types.h>
David Garcia Quintas8c3d9942016-03-08 00:07:14 -080042
43namespace grpc {
44
David Garcia Quintas60ee8dd2016-03-08 17:21:42 -080045/// Implementation of the core codegen interface.
David Garcia Quintas8c3d9942016-03-08 00:07:14 -080046class CoreCodegen : public CoreCodegenInterface {
47 private:
vjpai97da6472016-06-13 09:56:26 -070048 grpc_completion_queue* grpc_completion_queue_create(void* reserved)
49 GRPC_OVERRIDE;
Vijay Paice350a52016-06-09 17:22:35 -070050 void grpc_completion_queue_destroy(grpc_completion_queue* cq) GRPC_OVERRIDE;
David Garcia Quintas60ee8dd2016-03-08 17:21:42 -080051 grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag,
52 gpr_timespec deadline,
Vijay Paice350a52016-06-09 17:22:35 -070053 void* reserved) GRPC_OVERRIDE;
David Garcia Quintas60ee8dd2016-03-08 17:21:42 -080054
Vijay Paice350a52016-06-09 17:22:35 -070055 void* gpr_malloc(size_t size) GRPC_OVERRIDE;
56 void gpr_free(void* p) GRPC_OVERRIDE;
David Garcia Quintas60ee8dd2016-03-08 17:21:42 -080057
Vijay Paice350a52016-06-09 17:22:35 -070058 void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) GRPC_OVERRIDE;
David Garcia Quintas60ee8dd2016-03-08 17:21:42 -080059
David Garcia Quintas6721d4f2016-06-30 17:17:23 -070060 int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
61 grpc_byte_buffer* buffer) GRPC_OVERRIDE;
vjpai97da6472016-06-13 09:56:26 -070062 void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader* reader)
63 GRPC_OVERRIDE;
David Garcia Quintas1b2db632016-04-27 15:06:54 -070064 int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader,
Vijay Paice350a52016-06-09 17:22:35 -070065 gpr_slice* slice) GRPC_OVERRIDE;
David Garcia Quintas1b2db632016-04-27 15:06:54 -070066
67 grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice,
Vijay Paice350a52016-06-09 17:22:35 -070068 size_t nslices) GRPC_OVERRIDE;
David Garcia Quintas1b2db632016-04-27 15:06:54 -070069
Vijay Paice350a52016-06-09 17:22:35 -070070 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;
vjpai97da6472016-06-13 09:56:26 -070073 void gpr_slice_buffer_add(gpr_slice_buffer* sb,
Vijay Pai20bf1262016-06-15 22:21:48 -070074 gpr_slice slice) GRPC_OVERRIDE;
Vijay Paice350a52016-06-09 17:22:35 -070075 void gpr_slice_buffer_pop(gpr_slice_buffer* sb) GRPC_OVERRIDE;
David Garcia Quintas1b2db632016-04-27 15:06:54 -070076
Vijay Paice350a52016-06-09 17:22:35 -070077 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 Quintas60ee8dd2016-03-08 17:21:42 -080079
Vijay Paice350a52016-06-09 17:22:35 -070080 gpr_timespec gpr_inf_future(gpr_clock_type type) GRPC_OVERRIDE;
David Garcia Quintas60ee8dd2016-03-08 17:21:42 -080081
Vijay Paice350a52016-06-09 17:22:35 -070082 virtual const Status& ok() GRPC_OVERRIDE;
83 virtual const Status& cancelled() GRPC_OVERRIDE;
David Garcia Quintas1b2db632016-04-27 15:06:54 -070084
Vijay Paice350a52016-06-09 17:22:35 -070085 void assert_fail(const char* failed_assertion) GRPC_OVERRIDE;
David Garcia Quintas8c3d9942016-03-08 00:07:14 -080086};
87
88} // namespace grpc
David Garcia Quintasffd207f2016-08-01 16:20:52 -070089
90#endif // GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_H