if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
with_libgrpcpp_cppflags="-I$withval/include"
with_libgrpcpp_ldflags="-L$withval/lib"
+ with_libgrpcpp_bin="$withval/bin"
with_libgrpcpp="yes"
fi
if test "x$withval" = "xno"; then
# }}}
AC_ARG_VAR([GRPC_CPP_PLUGIN], [path to the grpc_cpp_plugin binary])
-AC_PATH_PROG([GRPC_CPP_PLUGIN], [grpc_cpp_plugin])
+if test "x$with_libgrpcpp_bin" = "x"; then
+ AC_PATH_PROG([GRPC_CPP_PLUGIN], [grpc_cpp_plugin])
+else
+ AC_PATH_PROG([GRPC_CPP_PLUGIN], [grpc_cpp_plugin], [], "$with_libgrpcpp_bin:$PATH")
+fi
AM_CONDITIONAL([HAVE_GRPC_CPP], [test "x$GRPC_CPP_PLUGIN" != "x"])
# --with-libiptc {{{
plugin_gps="yes"
fi
-if test "x$with_libgrpcpp" = "xyes" && test "x$with_libprotobuf" = "xyes" && test "x$have_protoc3" = "xyes" && test "x$GRPC_CPP_PLUGIN" != "x"; then
- plugin_grpc="yes"
+plugin_grpc="yes"
+if test "x$GRPC_CPP_PLUGIN" = "x"; then
+ plugin_grpc="no (grpc_cpp_plugin not found)"
+fi
+if test "x$have_protoc3" != "xyes"; then
+ plugin_grpc="no (protoc3 not found)"
+fi
+if test "x$with_libprotobuf" != "xyes"; then
+ plugin_grpc="no (libprotobuf not found)"
+fi
+if test "x$with_libgrpcpp" != "xyes"; then
+ plugin_grpc="no (libgrpc++ not found)"
fi
if test "x$have_getifaddrs" = "xyes"; then
using google::protobuf::util::TimeUtil;
-typedef google::protobuf::Map<grpc::string, collectd::types::MetadataValue> grpcMetadata;
+typedef google::protobuf::Map<grpc::string, collectd::types::MetadataValue>
+ grpcMetadata;
/*
* private types
switch (md_type) {
case MD_TYPE_STRING:
char *md_string;
- if (meta_data_get_string(meta, key, &md_string) != 0 || md_string == nullptr) {
+ if (meta_data_get_string(meta, key, &md_string) != 0 ||
+ md_string == nullptr) {
strarray_free(meta_data_keys, meta_data_keys_len);
return grpc::Status(grpc::StatusCode::INTERNAL,
- grpc::string("missing metadata"));
+ grpc::string("missing metadata"));
}
md_value.set_string_value(md_string);
free(md_string);
if (meta_data_get_signed_int(meta, key, &int64_value) != 0) {
strarray_free(meta_data_keys, meta_data_keys_len);
return grpc::Status(grpc::StatusCode::INTERNAL,
- grpc::string("missing metadata"));
+ grpc::string("missing metadata"));
}
md_value.set_int64_value(int64_value);
break;
if (meta_data_get_unsigned_int(meta, key, &uint64_value) != 0) {
strarray_free(meta_data_keys, meta_data_keys_len);
return grpc::Status(grpc::StatusCode::INTERNAL,
- grpc::string("missing metadata"));
+ grpc::string("missing metadata"));
}
md_value.set_uint64_value(uint64_value);
break;
if (meta_data_get_double(meta, key, &double_value) != 0) {
strarray_free(meta_data_keys, meta_data_keys_len);
return grpc::Status(grpc::StatusCode::INTERNAL,
- grpc::string("missing metadata"));
+ grpc::string("missing metadata"));
}
md_value.set_double_value(double_value);
break;
if (meta_data_get_boolean(meta, key, &bool_value) != 0) {
strarray_free(meta_data_keys, meta_data_keys_len);
return grpc::Status(grpc::StatusCode::INTERNAL,
- grpc::string("missing metadata"));
+ grpc::string("missing metadata"));
}
md_value.set_bool_value(bool_value);
break;
return grpc::Status(grpc::StatusCode::RESOURCE_EXHAUSTED,
grpc::string("failed to metadata list"));
}
- for (auto kv: rpc_metadata) {
+ for (auto kv : rpc_metadata) {
auto k = kv.first.c_str();
auto v = kv.second;
break;
default:
meta_data_destroy(*md_out);
- return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT,
- grpc::string("Metadata of unknown type"));
+ return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT,
+ grpc::string("Metadata of unknown type"));
}
}
return grpc::Status::OK;
break;
}
if (uc_iterator_get_meta(iter, &vl.meta) < 0) {
- status = grpc::Status(grpc::StatusCode::INTERNAL,
- grpc::string("failed to retrieve value metadata"));
+ status =
+ grpc::Status(grpc::StatusCode::INTERNAL,
+ grpc::string("failed to retrieve value metadata"));
}
value_lists->push(vl);
listener.port = grpc::string(ci->values[1].value.string);
listener.ssl = nullptr;
- auto ssl_opts = new (grpc::SslServerCredentialsOptions);
+ auto ssl_opts = new grpc::SslServerCredentialsOptions(
+ GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY);
grpc::SslServerCredentialsOptions::PemKeyCertPair pkcp = {};
bool use_ssl = false;
return -1;
}
pkcp.cert_chain = read_file(cert);
+ } else if (!strcasecmp("VerifyPeer", child->key)) {
+ _Bool verify = 0;
+ if (cf_util_get_boolean(child, &verify)) {
+ return -1;
+ }
+ ssl_opts->client_certificate_request =
+ verify ? GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
+ : GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE;
} else {
WARNING("grpc: Option `%s` not allowed in <%s> block.", child->key,
ci->key);