|
|
|
@ -37,8 +37,8 @@ |
|
|
|
|
|
|
|
|
|
#define GRPC_STATUS_TO_HTTP2_ERROR(a, b) \ |
|
|
|
|
GPR_ASSERT(grpc_chttp2_grpc_status_to_http2_error(a) == (b)) |
|
|
|
|
#define HTTP2_ERROR_TO_GRPC_STATUS(a, b) \ |
|
|
|
|
GPR_ASSERT(grpc_chttp2_http2_error_to_grpc_status(a) == (b)) |
|
|
|
|
#define HTTP2_ERROR_TO_GRPC_STATUS(a, deadline, b) \ |
|
|
|
|
GPR_ASSERT(grpc_chttp2_http2_error_to_grpc_status(a, deadline) == (b)) |
|
|
|
|
#define GRPC_STATUS_TO_HTTP2_STATUS(a, b) \ |
|
|
|
|
GPR_ASSERT(grpc_chttp2_grpc_status_to_http2_status(a) == (b)) |
|
|
|
|
#define HTTP2_STATUS_TO_GRPC_STATUS(a, b) \ |
|
|
|
@ -54,8 +54,7 @@ int main(int argc, char **argv) { |
|
|
|
|
GRPC_STATUS_TO_HTTP2_ERROR(GRPC_STATUS_UNKNOWN, GRPC_CHTTP2_INTERNAL_ERROR); |
|
|
|
|
GRPC_STATUS_TO_HTTP2_ERROR(GRPC_STATUS_INVALID_ARGUMENT, |
|
|
|
|
GRPC_CHTTP2_INTERNAL_ERROR); |
|
|
|
|
GRPC_STATUS_TO_HTTP2_ERROR(GRPC_STATUS_DEADLINE_EXCEEDED, |
|
|
|
|
GRPC_CHTTP2_INTERNAL_ERROR); |
|
|
|
|
GRPC_STATUS_TO_HTTP2_ERROR(GRPC_STATUS_DEADLINE_EXCEEDED, GRPC_CHTTP2_CANCEL); |
|
|
|
|
GRPC_STATUS_TO_HTTP2_ERROR(GRPC_STATUS_NOT_FOUND, GRPC_CHTTP2_INTERNAL_ERROR); |
|
|
|
|
GRPC_STATUS_TO_HTTP2_ERROR(GRPC_STATUS_ALREADY_EXISTS, |
|
|
|
|
GRPC_CHTTP2_INTERNAL_ERROR); |
|
|
|
@ -95,25 +94,60 @@ int main(int argc, char **argv) { |
|
|
|
|
GRPC_STATUS_TO_HTTP2_STATUS(GRPC_STATUS_UNAVAILABLE, 200); |
|
|
|
|
GRPC_STATUS_TO_HTTP2_STATUS(GRPC_STATUS_DATA_LOSS, 200); |
|
|
|
|
|
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_NO_ERROR, GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_PROTOCOL_ERROR, GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_INTERNAL_ERROR, GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_FLOW_CONTROL_ERROR, |
|
|
|
|
const gpr_timespec before_deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_NO_ERROR, before_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_PROTOCOL_ERROR, before_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_INTERNAL_ERROR, before_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_FLOW_CONTROL_ERROR, before_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_SETTINGS_TIMEOUT, before_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_SETTINGS_TIMEOUT, |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_STREAM_CLOSED, before_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_STREAM_CLOSED, GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_FRAME_SIZE_ERROR, |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_FRAME_SIZE_ERROR, before_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_REFUSED_STREAM, |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_REFUSED_STREAM, before_deadline, |
|
|
|
|
GRPC_STATUS_UNAVAILABLE); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_CANCEL, GRPC_STATUS_CANCELLED); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_COMPRESSION_ERROR, |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_CANCEL, before_deadline, |
|
|
|
|
GRPC_STATUS_CANCELLED); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_COMPRESSION_ERROR, before_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_CONNECT_ERROR, before_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_ENHANCE_YOUR_CALM, before_deadline, |
|
|
|
|
GRPC_STATUS_RESOURCE_EXHAUSTED); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_INADEQUATE_SECURITY, before_deadline, |
|
|
|
|
GRPC_STATUS_PERMISSION_DENIED); |
|
|
|
|
|
|
|
|
|
const gpr_timespec after_deadline = gpr_inf_past(GPR_CLOCK_MONOTONIC); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_NO_ERROR, after_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_PROTOCOL_ERROR, after_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_INTERNAL_ERROR, after_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_FLOW_CONTROL_ERROR, after_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_SETTINGS_TIMEOUT, after_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_STREAM_CLOSED, after_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_FRAME_SIZE_ERROR, after_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_REFUSED_STREAM, after_deadline, |
|
|
|
|
GRPC_STATUS_UNAVAILABLE); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_CANCEL, after_deadline, |
|
|
|
|
GRPC_STATUS_DEADLINE_EXCEEDED); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_COMPRESSION_ERROR, after_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_CONNECT_ERROR, after_deadline, |
|
|
|
|
GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_CONNECT_ERROR, GRPC_STATUS_INTERNAL); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_ENHANCE_YOUR_CALM, |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_ENHANCE_YOUR_CALM, after_deadline, |
|
|
|
|
GRPC_STATUS_RESOURCE_EXHAUSTED); |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_INADEQUATE_SECURITY, |
|
|
|
|
HTTP2_ERROR_TO_GRPC_STATUS(GRPC_CHTTP2_INADEQUATE_SECURITY, after_deadline, |
|
|
|
|
GRPC_STATUS_PERMISSION_DENIED); |
|
|
|
|
|
|
|
|
|
HTTP2_STATUS_TO_GRPC_STATUS(200, GRPC_STATUS_OK); |
|
|
|
|