mirror of https://github.com/grpc/grpc.git
parent
ac5cca327a
commit
bd2157b026
6 changed files with 165 additions and 2 deletions
@ -0,0 +1,91 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2020 gRPC authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
* |
||||
*/ |
||||
|
||||
#include <grpc/impl/codegen/port_platform.h> |
||||
|
||||
#include "src/core/ext/transport/cronet/transport/cronet_status.h" |
||||
|
||||
const char* cronet_status_as_string(cronet_status_code status) { |
||||
switch (status) { |
||||
case CRONET_STATUS_SUCCESS: |
||||
return "CRONET_STATUS_SUCCESS."; |
||||
case CRONET_STATUS_ILLEGAL_ARGUMENT: |
||||
return "CRONET_STATUS_ILLEGAL_ARGUMENT."; |
||||
case CRONET_STATUS_ILLEGAL_ARGUMENT_STORAGE_PATH_MUST_EXIST: |
||||
return "CRONET_STATUS_ILLEGAL_ARGUMENT_STORAGE_PATH_MUST_EXIST."; |
||||
case CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_PIN: |
||||
return "CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_PIN."; |
||||
case CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HOSTNAME: |
||||
return "CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HOSTNAME."; |
||||
case CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HTTP_METHOD: |
||||
return "CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HTTP_METHOD."; |
||||
case CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HTTP_HEADER: |
||||
return "CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HTTP_HEADER."; |
||||
case CRONET_STATUS_ILLEGAL_STATE: |
||||
return "CRONET_STATUS_ILLEGAL_STATE."; |
||||
case CRONET_STATUS_ILLEGAL_STATE_STORAGE_PATH_IN_USE: |
||||
return "CRONET_STATUS_ILLEGAL_STATE_STORAGE_PATH_IN_USE."; |
||||
case CRONET_STATUS_ILLEGAL_STATE_CANNOT_SHUTDOWN_ENGINE_FROM_NETWORK_THREAD: |
||||
return "CRONET_STATUS_ILLEGAL_STATE_CANNOT_SHUTDOWN_ENGINE_FROM_NETWORK_" |
||||
"THREAD."; |
||||
case CRONET_STATUS_ILLEGAL_STATE_ENGINE_ALREADY_STARTED: |
||||
return "CRONET_STATUS_ILLEGAL_STATE_ENGINE_ALREADY_STARTED."; |
||||
case CRONET_STATUS_ILLEGAL_STATE_REQUEST_ALREADY_STARTED: |
||||
return "CRONET_STATUS_ILLEGAL_STATE_REQUEST_ALREADY_STARTED."; |
||||
case CRONET_STATUS_ILLEGAL_STATE_REQUEST_NOT_INITIALIZED: |
||||
return "CRONET_STATUS_ILLEGAL_STATE_REQUEST_NOT_INITIALIZED."; |
||||
case CRONET_STATUS_ILLEGAL_STATE_REQUEST_ALREADY_INITIALIZED: |
||||
return "CRONET_STATUS_ILLEGAL_STATE_REQUEST_ALREADY_INITIALIZED."; |
||||
case CRONET_STATUS_ILLEGAL_STATE_REQUEST_NOT_STARTED: |
||||
return "CRONET_STATUS_ILLEGAL_STATE_REQUEST_NOT_STARTED."; |
||||
case CRONET_STATUS_ILLEGAL_STATE_UNEXPECTED_REDIRECT: |
||||
return "CRONET_STATUS_ILLEGAL_STATE_UNEXPECTED_REDIRECT."; |
||||
case CRONET_STATUS_ILLEGAL_STATE_UNEXPECTED_READ: |
||||
return "CRONET_STATUS_ILLEGAL_STATE_UNEXPECTED_READ."; |
||||
case CRONET_STATUS_ILLEGAL_STATE_READ_FAILED: |
||||
return "CRONET_STATUS_ILLEGAL_STATE_READ_FAILED."; |
||||
case CRONET_STATUS_NULL_POINTER: |
||||
return "CRONET_STATUS_NULL_POINTER."; |
||||
case CRONET_STATUS_NULL_POINTER_HOSTNAME: |
||||
return "CRONET_STATUS_NULL_POINTER_HOSTNAME."; |
||||
case CRONET_STATUS_NULL_POINTER_SHA256_PINS: |
||||
return "CRONET_STATUS_NULL_POINTER_SHA256_PINS."; |
||||
case CRONET_STATUS_NULL_POINTER_EXPIRATION_DATE: |
||||
return "CRONET_STATUS_NULL_POINTER_EXPIRATION_DATE."; |
||||
case CRONET_STATUS_NULL_POINTER_ENGINE: |
||||
return "CRONET_STATUS_NULL_POINTER_ENGINE."; |
||||
case CRONET_STATUS_NULL_POINTER_URL: |
||||
return "CRONET_STATUS_NULL_POINTER_URL."; |
||||
case CRONET_STATUS_NULL_POINTER_CALLBACK: |
||||
return "CRONET_STATUS_NULL_POINTER_CALLBACK."; |
||||
case CRONET_STATUS_NULL_POINTER_EXECUTOR: |
||||
return "CRONET_STATUS_NULL_POINTER_EXECUTOR."; |
||||
case CRONET_STATUS_NULL_POINTER_METHOD: |
||||
return "CRONET_STATUS_NULL_POINTER_METHOD."; |
||||
case CRONET_STATUS_NULL_POINTER_HEADER_NAME: |
||||
return "CRONET_STATUS_NULL_POINTER_HEADER_NAME."; |
||||
case CRONET_STATUS_NULL_POINTER_HEADER_VALUE: |
||||
return "CRONET_STATUS_NULL_POINTER_HEADER_VALUE"; |
||||
case CRONET_STATUS_NULL_POINTER_PARAMS: |
||||
return "CRONET_STATUS_NULL_POINTER_PARAMS."; |
||||
case CRONET_STATUS_NULL_POINTER_REQUEST_FINISHED_INFO_LISTENER_EXECUTOR: |
||||
return "CRONET_STATUS_NULL_POINTER_REQUEST_FINISHED_INFO_LISTENER_" |
||||
"EXECUTOR."; |
||||
} |
||||
return "UNAVAILABLE."; |
||||
} |
@ -0,0 +1,59 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2020 gRPC authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef GRPC_CORE_EXT_TRANSPORT_CRONET_TRANSPORT_CRONET_STATUS_H |
||||
#define GRPC_CORE_EXT_TRANSPORT_CRONET_TRANSPORT_CRONET_STATUS_H |
||||
|
||||
/* HTTP/2 error codes are mapped to the following cronet net error codes */ |
||||
enum cronet_status_code { |
||||
CRONET_STATUS_SUCCESS = 0, |
||||
CRONET_STATUS_ILLEGAL_ARGUMENT = -100, |
||||
CRONET_STATUS_ILLEGAL_ARGUMENT_STORAGE_PATH_MUST_EXIST = -101, |
||||
CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_PIN = -102, |
||||
CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HOSTNAME = -103, |
||||
CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HTTP_METHOD = -104, |
||||
CRONET_STATUS_ILLEGAL_ARGUMENT_INVALID_HTTP_HEADER = -105, |
||||
CRONET_STATUS_ILLEGAL_STATE = -200, |
||||
CRONET_STATUS_ILLEGAL_STATE_STORAGE_PATH_IN_USE = -201, |
||||
CRONET_STATUS_ILLEGAL_STATE_CANNOT_SHUTDOWN_ENGINE_FROM_NETWORK_THREAD = -202, |
||||
CRONET_STATUS_ILLEGAL_STATE_ENGINE_ALREADY_STARTED = -203, |
||||
CRONET_STATUS_ILLEGAL_STATE_REQUEST_ALREADY_STARTED = -204, |
||||
CRONET_STATUS_ILLEGAL_STATE_REQUEST_NOT_INITIALIZED = -205, |
||||
CRONET_STATUS_ILLEGAL_STATE_REQUEST_ALREADY_INITIALIZED = -206, |
||||
CRONET_STATUS_ILLEGAL_STATE_REQUEST_NOT_STARTED = -207, |
||||
CRONET_STATUS_ILLEGAL_STATE_UNEXPECTED_REDIRECT = -208, |
||||
CRONET_STATUS_ILLEGAL_STATE_UNEXPECTED_READ = -209, |
||||
CRONET_STATUS_ILLEGAL_STATE_READ_FAILED = -210, |
||||
CRONET_STATUS_NULL_POINTER = -300, |
||||
CRONET_STATUS_NULL_POINTER_HOSTNAME = -301, |
||||
CRONET_STATUS_NULL_POINTER_SHA256_PINS = -302, |
||||
CRONET_STATUS_NULL_POINTER_EXPIRATION_DATE = -303, |
||||
CRONET_STATUS_NULL_POINTER_ENGINE = -304, |
||||
CRONET_STATUS_NULL_POINTER_URL = -305, |
||||
CRONET_STATUS_NULL_POINTER_CALLBACK = -306, |
||||
CRONET_STATUS_NULL_POINTER_EXECUTOR = -307, |
||||
CRONET_STATUS_NULL_POINTER_METHOD = -308, |
||||
CRONET_STATUS_NULL_POINTER_HEADER_NAME = -309, |
||||
CRONET_STATUS_NULL_POINTER_HEADER_VALUE = -310, |
||||
CRONET_STATUS_NULL_POINTER_PARAMS = -311, |
||||
CRONET_STATUS_NULL_POINTER_REQUEST_FINISHED_INFO_LISTENER_EXECUTOR = -312, |
||||
}; |
||||
|
||||
const char* cronet_status_as_string(cronet_status_code status); |
||||
|
||||
#endif /* GRPC_CORE_EXT_TRANSPORT_CRONET_TRANSPORT_CRONET_STATUS_H */ |
Loading…
Reference in new issue