GRPC Core  9.0.0
alts_grpc_record_protocol_common.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2018 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  */
18 
19 #ifndef GRPC_CORE_TSI_ALTS_ZERO_COPY_FRAME_PROTECTOR_ALTS_GRPC_RECORD_PROTOCOL_COMMON_H
20 #define GRPC_CORE_TSI_ALTS_ZERO_COPY_FRAME_PROTECTOR_ALTS_GRPC_RECORD_PROTOCOL_COMMON_H
21 
29 
32 
33 /* V-table for alts_grpc_record_protocol implementations. */
34 typedef struct {
36  grpc_slice_buffer* unprotected_slices,
37  grpc_slice_buffer* protected_slices);
39  grpc_slice_buffer* protected_slices,
40  grpc_slice_buffer* unprotected_slices);
41  void (*destruct)(alts_grpc_record_protocol* self);
43 
44 /* Main struct for alts_grpc_record_protocol implementation, shared by both
45  * integrity-only record protocol and privacy-integrity record protocol.
46  * Integrity-only record protocol has additional data elements.
47  * Privacy-integrity record protocol uses this struct directly. */
52  unsigned char* header_buf;
53  size_t header_length;
54  size_t tag_length;
57 };
58 
66 
73  unsigned char* dst);
74 
84 
94  gsec_aead_crypter* crypter,
95  size_t overflow_size, bool is_client,
96  bool is_integrity_only,
97  bool is_protect);
98 
99 #endif /* GRPC_CORE_TSI_ALTS_ZERO_COPY_FRAME_PROTECTOR_ALTS_GRPC_RECORD_PROTOCOL_COMMON_H \
100  */
void alts_grpc_record_protocol_copy_slice_buffer(const grpc_slice_buffer *src, unsigned char *dst)
Copies bytes from slice buffer to destination buffer.
Definition: alts_grpc_record_protocol_common.cc:60
void alts_grpc_record_protocol_convert_slice_buffer_to_iovec(alts_grpc_record_protocol *rp, const grpc_slice_buffer *sb)
Converts the slices of input sb into iovec_t's and puts the result into rp->iovec_buf.
Definition: alts_grpc_record_protocol_common.cc:50
tsi_result alts_grpc_record_protocol_init(alts_grpc_record_protocol *rp, gsec_aead_crypter *crypter, size_t overflow_size, bool is_client, bool is_integrity_only, bool is_protect)
Initializes an alts_grpc_record_protocol object, given a gsec_aead_crypter instance,...
Definition: alts_grpc_record_protocol_common.cc:88
iovec_t alts_grpc_record_protocol_get_header_iovec(alts_grpc_record_protocol *rp)
This method returns an iovec object pointing to the frame header stored in rp->header_sb.
Definition: alts_grpc_record_protocol_common.cc:70
this file contains alts_grpc_record_protocol internals and internal-only helper functions.
Definition: alts_grpc_record_protocol_common.h:34
Definition: alts_grpc_record_protocol_common.h:48
size_t header_length
Definition: alts_grpc_record_protocol_common.h:53
unsigned char * header_buf
Definition: alts_grpc_record_protocol_common.h:52
grpc_slice_buffer header_sb
Definition: alts_grpc_record_protocol_common.h:51
size_t iovec_buf_length
Definition: alts_grpc_record_protocol_common.h:56
iovec_t * iovec_buf
Definition: alts_grpc_record_protocol_common.h:55
alts_iovec_record_protocol * iovec_rp
Definition: alts_grpc_record_protocol_common.h:50
size_t tag_length
Definition: alts_grpc_record_protocol_common.h:54
const alts_grpc_record_protocol_vtable * vtable
Definition: alts_grpc_record_protocol_common.h:49
Definition: alts_iovec_record_protocol.cc:31
Represents an expandable array of slices, to be interpreted as a single item.
Definition: slice.h:78
Definition: gsec.h:173
Definition: gsec.h:30
tsi_result
Definition: transport_security_interface.h:31