Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
src
core
lib
security
credentials
alts
check_gcp_environment.cc
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
#include <
grpc/support/port_platform.h
>
20
21
#include "
src/core/lib/security/credentials/alts/check_gcp_environment.h
"
22
23
#include <ctype.h>
24
#include <stdio.h>
25
#include <
string.h
>
26
27
#include <
grpc/support/alloc.h
>
28
#include <
grpc/support/log.h
>
29
30
const
size_t
kBiosDataBufferSize
= 256;
31
32
static
char
*
trim
(
const
char
* src) {
33
if
(src ==
nullptr
|| *src ==
'\0'
) {
34
return
nullptr
;
35
}
36
char
* des =
nullptr
;
37
size_t
start
= 0,
end
= strlen(src) - 1;
38
/* find the last character that is not a whitespace. */
39
while
(
end
!= 0 && isspace(src[
end
])) {
40
end
--;
41
}
42
/* find the first character that is not a whitespace. */
43
while
(
start
< strlen(src) && isspace(src[
start
])) {
44
start
++;
45
}
46
if
(
start
<=
end
) {
47
des =
static_cast<
char
*
>
(
48
gpr_zalloc
(
sizeof
(
char
) * (
end
-
start
+ 2
/* '\0' */
)));
49
memcpy
(des, src +
start
,
end
-
start
+ 1);
50
}
51
return
des;
52
}
53
54
namespace
grpc_core
{
55
namespace
internal
{
56
57
char
*
read_bios_file
(
const
char
* bios_file) {
58
FILE
* fp = fopen(bios_file,
"r"
);
59
if
(!fp) {
60
gpr_log
(
GPR_INFO
,
"BIOS data file does not exist or cannot be opened."
);
61
return
nullptr
;
62
}
63
char
buf
[
kBiosDataBufferSize
+ 1];
64
size_t
ret
= fread(
buf
,
sizeof
(
char
),
kBiosDataBufferSize
, fp);
65
buf
[
ret
] =
'\0'
;
66
char
* trimmed_buf =
trim
(
buf
);
67
fclose
(fp);
68
return
trimmed_buf;
69
}
70
71
}
// namespace internal
72
}
// namespace grpc_core
GPR_INFO
#define GPR_INFO
Definition:
include/grpc/impl/codegen/log.h:56
log.h
grpc_core
Definition:
call_metric_recorder.h:31
trim
static char * trim(const char *src)
Definition:
check_gcp_environment.cc:32
string.h
buf
voidpf void * buf
Definition:
bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
check_gcp_environment.h
gpr_zalloc
GPRAPI void * gpr_zalloc(size_t size)
Definition:
alloc.cc:40
memcpy
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
start
static uint64_t start
Definition:
benchmark-pound.c:74
kBiosDataBufferSize
const size_t kBiosDataBufferSize
Definition:
check_gcp_environment.cc:30
end
char * end
Definition:
abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1008
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
benchmark.FILE
FILE
Definition:
benchmark.py:21
grpc_core::internal::read_bios_file
char * read_bios_file(const char *bios_file)
Definition:
check_gcp_environment.cc:57
grpc::fclose
fclose(creds_file)
ret
UniquePtr< SSL_SESSION > ret
Definition:
ssl_x509.cc:1029
alloc.h
internal
Definition:
benchmark/test/output_test_helper.cc:20
port_platform.h
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:44