aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/bad_client/bad_client.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/bad_client/bad_client.h')
-rw-r--r--test/core/bad_client/bad_client.h36
1 files changed, 23 insertions, 13 deletions
diff --git a/test/core/bad_client/bad_client.h b/test/core/bad_client/bad_client.h
index 54bf0229c5..bf73a78886 100644
--- a/test/core/bad_client/bad_client.h
+++ b/test/core/bad_client/bad_client.h
@@ -35,10 +35,11 @@ typedef void (*grpc_bad_client_server_side_validator)(grpc_server* server,
/* Returns false if we need to read more data. */
typedef bool (*grpc_bad_client_client_stream_validator)(
- grpc_slice_buffer* incoming);
+ grpc_slice_buffer* incoming, void* arg);
struct grpc_bad_client_arg {
grpc_bad_client_client_stream_validator client_validator;
+ void* client_validator_arg;
const char* client_payload;
size_t client_payload_length;
};
@@ -47,11 +48,12 @@ struct grpc_bad_client_arg {
#define GRPC_BAD_CLIENT_LARGE_REQUEST 2
/* Test runner.
-
- Create a server, and for each arg in args send client_payload. For each
- payload, run client_validator to make sure that the response is as expected.
- Also execute server_validator in a separate thread to assert that the bytes
- are handled as expected. */
+ *
+ * Create a server, and for each arg in \a args send client_payload. For each
+ * payload, run client_validator to make sure that the response is as expected.
+ * Also execute \a server_validator in a separate thread to assert that the
+ * bytes are handled as expected.
+ */
void grpc_run_bad_client_test(
grpc_bad_client_server_side_validator server_validator,
grpc_bad_client_arg args[], int num_args, uint32_t flags);
@@ -59,20 +61,28 @@ void grpc_run_bad_client_test(
#define COMBINE1(X, Y) X##Y
#define COMBINE(X, Y) COMBINE1(X, Y)
-#define GRPC_RUN_BAD_CLIENT_TEST(server_validator, client_validator, payload, \
- flags) \
- grpc_bad_client_arg COMBINE(bca, __LINE__) = {client_validator, payload, \
- sizeof(payload) - 1}; \
+#define GRPC_RUN_BAD_CLIENT_TEST(server_validator, client_validator, payload, \
+ flags) \
+ grpc_bad_client_arg COMBINE(bca, __LINE__) = {client_validator, nullptr, \
+ payload, sizeof(payload) - 1}; \
grpc_run_bad_client_test(server_validator, &COMBINE(bca, __LINE__), 1, flags)
-/* Client side validator for connection preface from server */
-bool client_connection_preface_validator(grpc_slice_buffer* incoming);
+/* Helper validator functions */
+/* Client side validator for connection preface from server. \a arg is unused */
+bool client_connection_preface_validator(grpc_slice_buffer* incoming,
+ void* arg);
+
+/* Client side validator for checking if reset stream is present at the end
+ * of the buffer. \a arg is unused.
+ */
+bool rst_stream_client_validator(grpc_slice_buffer* incoming, void* arg);
+/* Helper grpc_bad_client_arg arguments for direct use */
/* Sends a connection preface from the client with an empty settings frame */
extern grpc_bad_client_arg connection_preface_arg;
/* Server side verifier function that performs a
- * single grpc_server_request_call */
+ * single grpc_server_request_call */
void server_verifier_request_call(grpc_server* server,
grpc_completion_queue* cq,
void* registered_method);