grpc
src
core
tsi
alts
zero_copy_frame_protector
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
28
#include <
grpc/support/port_platform.h
>
29
30
#include "
src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h
"
31
#include "
src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h
"
32
33
/* V-table for alts_grpc_record_protocol implementations. */
34
struct
alts_grpc_record_protocol_vtable
{
35
tsi_result
(*
protect
)(
alts_grpc_record_protocol
*
self
,
36
grpc_slice_buffer
* unprotected_slices,
37
grpc_slice_buffer
* protected_slices);
38
tsi_result
(*
unprotect
)(
alts_grpc_record_protocol
*
self
,
39
grpc_slice_buffer
* protected_slices,
40
grpc_slice_buffer
* unprotected_slices);
41
void (*
destruct
)(
alts_grpc_record_protocol
*
self
);
42
};
43
/* Main struct for alts_grpc_record_protocol implementation, shared by both
44
* integrity-only record protocol and privacy-integrity record protocol.
45
* Integrity-only record protocol has additional data elements.
46
* Privacy-integrity record protocol uses this struct directly. */
47
struct
alts_grpc_record_protocol
{
48
const
alts_grpc_record_protocol_vtable
*
vtable
;
49
alts_iovec_record_protocol
*
iovec_rp
;
50
grpc_slice_buffer
header_sb
;
51
unsigned
char
*
header_buf
;
52
size_t
header_length
;
53
size_t
tag_length
;
54
iovec_t
*
iovec_buf
;
55
size_t
iovec_buf_length
;
56
};
57
63
void
alts_grpc_record_protocol_convert_slice_buffer_to_iovec
(
64
alts_grpc_record_protocol
* rp,
const
grpc_slice_buffer
* sb);
65
71
void
alts_grpc_record_protocol_copy_slice_buffer
(
const
grpc_slice_buffer
* src,
72
unsigned
char
*
dst
);
73
81
iovec_t
alts_grpc_record_protocol_get_header_iovec
(
82
alts_grpc_record_protocol
* rp);
83
92
tsi_result
alts_grpc_record_protocol_init
(
alts_grpc_record_protocol
* rp,
93
gsec_aead_crypter
* crypter,
94
size_t
overflow_size,
bool
is_client,
95
bool
is_integrity_only,
96
bool
is_protect);
97
98
#endif
/* GRPC_CORE_TSI_ALTS_ZERO_COPY_FRAME_PROTECTOR_ALTS_GRPC_RECORD_PROTOCOL_COMMON_H \
99
*/
alts_grpc_record_protocol::iovec_buf_length
size_t iovec_buf_length
Definition:
alts_grpc_record_protocol_common.h:55
dst
static const char dst[]
Definition:
test-fs-copyfile.c:37
alts_iovec_record_protocol
Definition:
alts_iovec_record_protocol.cc:31
alts_grpc_record_protocol
Definition:
alts_grpc_record_protocol_common.h:47
alts_grpc_record_protocol_vtable
Definition:
alts_grpc_record_protocol_common.h:34
alts_grpc_record_protocol::vtable
const alts_grpc_record_protocol_vtable * vtable
Definition:
alts_grpc_record_protocol_common.h:48
alts_grpc_record_protocol_vtable::unprotect
tsi_result(* unprotect)(alts_grpc_record_protocol *self, grpc_slice_buffer *protected_slices, grpc_slice_buffer *unprotected_slices)
Definition:
alts_grpc_record_protocol_common.h:38
alts_iovec_record_protocol.h
alts_grpc_record_protocol::iovec_buf
iovec_t * iovec_buf
Definition:
alts_grpc_record_protocol_common.h:54
tsi_result
tsi_result
Definition:
transport_security_interface.h:31
alts_grpc_record_protocol_vtable::destruct
void(* destruct)(alts_grpc_record_protocol *self)
Definition:
alts_grpc_record_protocol_common.h:41
alts_grpc_record_protocol::header_sb
grpc_slice_buffer header_sb
Definition:
alts_grpc_record_protocol_common.h:50
alts_grpc_record_protocol::tag_length
size_t tag_length
Definition:
alts_grpc_record_protocol_common.h:53
alts_grpc_record_protocol_convert_slice_buffer_to_iovec
void alts_grpc_record_protocol_convert_slice_buffer_to_iovec(alts_grpc_record_protocol *rp, const grpc_slice_buffer *sb)
Definition:
alts_grpc_record_protocol_common.cc:50
alts_grpc_record_protocol::header_buf
unsigned char * header_buf
Definition:
alts_grpc_record_protocol_common.h:51
alts_grpc_record_protocol_copy_slice_buffer
void alts_grpc_record_protocol_copy_slice_buffer(const grpc_slice_buffer *src, unsigned char *dst)
Definition:
alts_grpc_record_protocol_common.cc:60
iovec
Definition:
gsec.h:33
alts_grpc_record_protocol_init
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)
Definition:
alts_grpc_record_protocol_common.cc:88
alts_grpc_record_protocol_vtable::protect
tsi_result(* protect)(alts_grpc_record_protocol *self, grpc_slice_buffer *unprotected_slices, grpc_slice_buffer *protected_slices)
Definition:
alts_grpc_record_protocol_common.h:35
alts_grpc_record_protocol::header_length
size_t header_length
Definition:
alts_grpc_record_protocol_common.h:52
alts_grpc_record_protocol.h
alts_grpc_record_protocol_get_header_iovec
iovec_t alts_grpc_record_protocol_get_header_iovec(alts_grpc_record_protocol *rp)
Definition:
alts_grpc_record_protocol_common.cc:70
alts_grpc_record_protocol::iovec_rp
alts_iovec_record_protocol * iovec_rp
Definition:
alts_grpc_record_protocol_common.h:49
gsec_aead_crypter
Definition:
gsec.h:178
grpc_slice_buffer
Definition:
include/grpc/impl/codegen/slice.h:83
port_platform.h
grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:40