Remove unnamed typedef structs in src/core

pull/23082/head
Yash Tibrewal 5 years ago
parent f316a02823
commit d9319aaa80
  1. 4
      src/core/ext/filters/http/http_filters_plugin.cc
  2. 8
      src/core/ext/transport/chttp2/server/chttp2_server.cc
  3. 10
      src/core/ext/transport/chttp2/transport/bin_encoder.cc
  4. 4
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  5. 5
      src/core/ext/transport/chttp2/transport/frame_goaway.h
  6. 5
      src/core/ext/transport/chttp2/transport/frame_ping.h
  7. 5
      src/core/ext/transport/chttp2/transport/frame_rst_stream.h
  8. 5
      src/core/ext/transport/chttp2/transport/frame_settings.h
  9. 5
      src/core/ext/transport/chttp2/transport/frame_window_update.h
  10. 5
      src/core/ext/transport/chttp2/transport/hpack_encoder.cc
  11. 5
      src/core/ext/transport/chttp2/transport/hpack_encoder.h
  12. 5
      src/core/ext/transport/chttp2/transport/hpack_parser.h
  13. 4
      src/core/ext/transport/chttp2/transport/hpack_table.h
  14. 9
      src/core/ext/transport/chttp2/transport/http2_settings.h
  15. 5
      src/core/ext/transport/chttp2/transport/huffsyms.h
  16. 35
      src/core/ext/transport/chttp2/transport/internal.h
  17. 5
      src/core/ext/transport/chttp2/transport/stream_map.h
  18. 20
      src/core/lib/channel/channel_stack.h
  19. 5
      src/core/lib/channel/connected_channel.cc
  20. 5
      src/core/lib/channel/status_util.cc
  21. 5
      src/core/lib/gpr/spinlock.h
  22. 5
      src/core/lib/gpr/string.cc
  23. 5
      src/core/lib/gpr/string.h
  24. 5
      src/core/lib/http/httpcli.cc
  25. 5
      src/core/lib/http/httpcli.h
  26. 5
      src/core/lib/http/httpcli_security_connector.cc
  27. 5
      src/core/lib/http/parser.h
  28. 5
      src/core/lib/iomgr/closure.h
  29. 5
      src/core/lib/iomgr/endpoint_cfstream.cc
  30. 5
      src/core/lib/iomgr/endpoint_pair.h
  31. 15
      src/core/lib/iomgr/error.cc
  32. 5
      src/core/lib/iomgr/ev_epollex_linux.cc
  33. 5
      src/core/lib/iomgr/ev_posix.cc
  34. 10
      src/core/lib/iomgr/resolve_address.h
  35. 5
      src/core/lib/iomgr/resolve_address_posix.cc
  36. 5
      src/core/lib/iomgr/resolve_address_windows.cc
  37. 10
      src/core/lib/iomgr/resource_quota.cc
  38. 5
      src/core/lib/iomgr/socket_factory_posix.h
  39. 5
      src/core/lib/iomgr/socket_mutator.h
  40. 5
      src/core/lib/iomgr/tcp_client_posix.cc
  41. 5
      src/core/lib/iomgr/tcp_client_windows.cc
  42. 5
      src/core/lib/iomgr/tcp_custom.cc
  43. 5
      src/core/lib/iomgr/time_averaged_stats.h
  44. 5
      src/core/lib/iomgr/timer_generic.cc
  45. 5
      src/core/lib/iomgr/timer_heap.h
  46. 5
      src/core/lib/security/credentials/credentials.h
  47. 5
      src/core/lib/security/credentials/google_default/google_default_credentials.cc
  48. 5
      src/core/lib/security/credentials/jwt/json_token.h
  49. 15
      src/core/lib/security/credentials/jwt/jwt_verifier.cc
  50. 5
      src/core/lib/security/credentials/jwt/jwt_verifier.h
  51. 5
      src/core/lib/security/credentials/oauth2/oauth2_credentials.h
  52. 10
      src/core/lib/security/security_connector/ssl/ssl_security_connector.h
  53. 5
      src/core/lib/slice/slice_intern.cc
  54. 5
      src/core/lib/surface/call.cc
  55. 5
      src/core/lib/surface/channel_ping.cc
  56. 20
      src/core/lib/surface/completion_queue.cc
  57. 5
      src/core/lib/transport/metadata_batch.h
  58. 5
      src/core/lib/transport/transport.cc
  59. 5
      src/core/lib/uri/uri_parser.h
  60. 5
      src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h
  61. 25
      src/core/tsi/fake_transport_security.cc
  62. 15
      src/core/tsi/ssl_transport_security.cc
  63. 10
      src/core/tsi/ssl_transport_security.h
  64. 15
      src/core/tsi/transport_security.h
  65. 5
      src/core/tsi/transport_security_grpc.h
  66. 5
      src/core/tsi/transport_security_interface.h

@ -29,10 +29,10 @@
#include "src/core/lib/surface/channel_init.h" #include "src/core/lib/surface/channel_init.h"
#include "src/core/lib/transport/transport_impl.h" #include "src/core/lib/transport/transport_impl.h"
typedef struct { struct optional_filter {
const grpc_channel_filter* filter; const grpc_channel_filter* filter;
const char* control_channel_arg; const char* control_channel_arg;
} optional_filter; };
static optional_filter compress_filter = { static optional_filter compress_filter = {
&grpc_message_compress_filter, GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION}; &grpc_message_compress_filter, GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION};

@ -47,7 +47,7 @@
#include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/server.h" #include "src/core/lib/surface/server.h"
typedef struct { struct server_state {
grpc_server* server; grpc_server* server;
grpc_tcp_server* tcp_server; grpc_tcp_server* tcp_server;
grpc_channel_args* args; grpc_channel_args* args;
@ -58,9 +58,9 @@ typedef struct {
grpc_core::HandshakeManager* pending_handshake_mgrs; grpc_core::HandshakeManager* pending_handshake_mgrs;
grpc_core::RefCountedPtr<grpc_core::channelz::ListenSocketNode> grpc_core::RefCountedPtr<grpc_core::channelz::ListenSocketNode>
channelz_listen_socket; channelz_listen_socket;
} server_state; };
typedef struct { struct server_connection_state {
gpr_refcount refs; gpr_refcount refs;
server_state* svr_state; server_state* svr_state;
grpc_pollset* accepting_pollset; grpc_pollset* accepting_pollset;
@ -73,7 +73,7 @@ typedef struct {
grpc_closure on_timeout; grpc_closure on_timeout;
grpc_closure on_receive_settings; grpc_closure on_receive_settings;
grpc_pollset_set* interested_parties; grpc_pollset_set* interested_parties;
} server_connection_state; };
static void server_connection_state_unref( static void server_connection_state_unref(
server_connection_state* connection_state) { server_connection_state* connection_state) {

@ -28,11 +28,10 @@
static const char alphabet[] = static const char alphabet[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
typedef struct { struct b64_huff_sym {
uint16_t bits; uint16_t bits;
uint8_t length; uint8_t length;
} b64_huff_sym; };
static const b64_huff_sym huff_alphabet[64] = { static const b64_huff_sym huff_alphabet[64] = {
{0x21, 6}, {0x5d, 7}, {0x5e, 7}, {0x5f, 7}, {0x60, 7}, {0x61, 7}, {0x21, 6}, {0x5d, 7}, {0x5e, 7}, {0x5f, 7}, {0x60, 7}, {0x61, 7},
{0x62, 7}, {0x63, 7}, {0x64, 7}, {0x65, 7}, {0x66, 7}, {0x67, 7}, {0x62, 7}, {0x63, 7}, {0x64, 7}, {0x65, 7}, {0x66, 7}, {0x67, 7},
@ -136,12 +135,11 @@ grpc_slice grpc_chttp2_huffman_compress(const grpc_slice& input) {
return output; return output;
} }
typedef struct { struct huff_out {
uint32_t temp; uint32_t temp;
uint32_t temp_length; uint32_t temp_length;
uint8_t* out; uint8_t* out;
} huff_out; };
static void enc_flush_some(huff_out* out) { static void enc_flush_some(huff_out* out) {
while (out->temp_length > 8) { while (out->temp_length > 8) {
out->temp_length -= 8; out->temp_length -= 8;

@ -2401,10 +2401,10 @@ static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_CLOSE_FROM_API); grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_CLOSE_FROM_API);
} }
typedef struct { struct cancel_stream_cb_args {
grpc_error* error; grpc_error* error;
grpc_chttp2_transport* t; grpc_chttp2_transport* t;
} cancel_stream_cb_args; };
static void cancel_stream_cb(void* user_data, uint32_t /*key*/, void* stream) { static void cancel_stream_cb(void* user_data, uint32_t /*key*/, void* stream) {
cancel_stream_cb_args* args = static_cast<cancel_stream_cb_args*>(user_data); cancel_stream_cb_args* args = static_cast<cancel_stream_cb_args*>(user_data);

@ -37,15 +37,14 @@ typedef enum {
GRPC_CHTTP2_GOAWAY_DEBUG GRPC_CHTTP2_GOAWAY_DEBUG
} grpc_chttp2_goaway_parse_state; } grpc_chttp2_goaway_parse_state;
typedef struct { struct grpc_chttp2_goaway_parser {
grpc_chttp2_goaway_parse_state state; grpc_chttp2_goaway_parse_state state;
uint32_t last_stream_id; uint32_t last_stream_id;
uint32_t error_code; uint32_t error_code;
char* debug_data; char* debug_data;
uint32_t debug_length; uint32_t debug_length;
uint32_t debug_pos; uint32_t debug_pos;
} grpc_chttp2_goaway_parser; };
void grpc_chttp2_goaway_parser_init(grpc_chttp2_goaway_parser* p); void grpc_chttp2_goaway_parser_init(grpc_chttp2_goaway_parser* p);
void grpc_chttp2_goaway_parser_destroy(grpc_chttp2_goaway_parser* p); void grpc_chttp2_goaway_parser_destroy(grpc_chttp2_goaway_parser* p);
grpc_error* grpc_chttp2_goaway_parser_begin_frame( grpc_error* grpc_chttp2_goaway_parser_begin_frame(

@ -24,12 +24,11 @@
#include <grpc/slice.h> #include <grpc/slice.h>
#include "src/core/ext/transport/chttp2/transport/frame.h" #include "src/core/ext/transport/chttp2/transport/frame.h"
typedef struct { struct grpc_chttp2_ping_parser {
uint8_t byte; uint8_t byte;
uint8_t is_ack; uint8_t is_ack;
uint64_t opaque_8bytes; uint64_t opaque_8bytes;
} grpc_chttp2_ping_parser; };
grpc_slice grpc_chttp2_ping_create(uint8_t ack, uint64_t opaque_8bytes); grpc_slice grpc_chttp2_ping_create(uint8_t ack, uint64_t opaque_8bytes);
grpc_error* grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser* parser, grpc_error* grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser* parser,

@ -25,11 +25,10 @@
#include "src/core/ext/transport/chttp2/transport/frame.h" #include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/transport/transport.h" #include "src/core/lib/transport/transport.h"
typedef struct { struct grpc_chttp2_rst_stream_parser {
uint8_t byte; uint8_t byte;
uint8_t reason_bytes[4]; uint8_t reason_bytes[4];
} grpc_chttp2_rst_stream_parser; };
grpc_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code, grpc_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code,
grpc_transport_one_way_stats* stats); grpc_transport_one_way_stats* stats);

@ -34,15 +34,14 @@ typedef enum {
GRPC_CHTTP2_SPS_VAL3 GRPC_CHTTP2_SPS_VAL3
} grpc_chttp2_settings_parse_state; } grpc_chttp2_settings_parse_state;
typedef struct { struct grpc_chttp2_settings_parser {
grpc_chttp2_settings_parse_state state; grpc_chttp2_settings_parse_state state;
uint32_t* target_settings; uint32_t* target_settings;
uint8_t is_ack; uint8_t is_ack;
uint16_t id; uint16_t id;
uint32_t value; uint32_t value;
uint32_t incoming_settings[GRPC_CHTTP2_NUM_SETTINGS]; uint32_t incoming_settings[GRPC_CHTTP2_NUM_SETTINGS];
} grpc_chttp2_settings_parser; };
/* Create a settings frame by diffing old & new, and updating old to be new */ /* Create a settings frame by diffing old & new, and updating old to be new */
grpc_slice grpc_chttp2_settings_create(uint32_t* old, const uint32_t* newval, grpc_slice grpc_chttp2_settings_create(uint32_t* old, const uint32_t* newval,
uint32_t force_mask, size_t count); uint32_t force_mask, size_t count);

@ -25,12 +25,11 @@
#include "src/core/ext/transport/chttp2/transport/frame.h" #include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/transport/transport.h" #include "src/core/lib/transport/transport.h"
typedef struct { struct grpc_chttp2_window_update_parser {
uint8_t byte; uint8_t byte;
uint8_t is_connection_update; uint8_t is_connection_update;
uint32_t amount; uint32_t amount;
} grpc_chttp2_window_update_parser; };
grpc_slice grpc_chttp2_window_update_create( grpc_slice grpc_chttp2_window_update_create(
uint32_t id, uint32_t window_delta, grpc_transport_one_way_stats* stats); uint32_t id, uint32_t window_delta, grpc_transport_one_way_stats* stats);

@ -259,7 +259,7 @@ static bool CanAddToHashtable(grpc_chttp2_hpack_compressor* hpack_compressor,
} }
} /* namespace */ } /* namespace */
typedef struct { struct framer_state {
int is_first_frame; int is_first_frame;
/* number of bytes in 'output' when we started the frame - used to calculate /* number of bytes in 'output' when we started the frame - used to calculate
frame length */ frame length */
@ -278,8 +278,7 @@ typedef struct {
size_t max_frame_size; size_t max_frame_size;
bool use_true_binary_metadata; bool use_true_binary_metadata;
bool is_end_of_stream; bool is_end_of_stream;
} framer_state; };
/* fills p (which is expected to be kDataFrameHeaderSize bytes long) /* fills p (which is expected to be kDataFrameHeaderSize bytes long)
* with a data frame header */ * with a data frame header */
static void fill_header(uint8_t* p, uint8_t type, uint32_t id, size_t len, static void fill_header(uint8_t* p, uint8_t type, uint32_t id, size_t len,

@ -90,14 +90,13 @@ void grpc_chttp2_hpack_compressor_set_max_table_size(
void grpc_chttp2_hpack_compressor_set_max_usable_size( void grpc_chttp2_hpack_compressor_set_max_usable_size(
grpc_chttp2_hpack_compressor* c, uint32_t max_table_size); grpc_chttp2_hpack_compressor* c, uint32_t max_table_size);
typedef struct { struct grpc_encode_header_options {
uint32_t stream_id; uint32_t stream_id;
bool is_eof; bool is_eof;
bool use_true_binary_metadata; bool use_true_binary_metadata;
size_t max_frame_size; size_t max_frame_size;
grpc_transport_one_way_stats* stats; grpc_transport_one_way_stats* stats;
} grpc_encode_header_options; };
void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c, void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c,
grpc_mdelem** extra_headers, grpc_mdelem** extra_headers,
size_t extra_headers_size, size_t extra_headers_size,

@ -32,7 +32,7 @@ typedef struct grpc_chttp2_hpack_parser grpc_chttp2_hpack_parser;
typedef grpc_error* (*grpc_chttp2_hpack_parser_state)( typedef grpc_error* (*grpc_chttp2_hpack_parser_state)(
grpc_chttp2_hpack_parser* p, const uint8_t* beg, const uint8_t* end); grpc_chttp2_hpack_parser* p, const uint8_t* beg, const uint8_t* end);
typedef struct { struct grpc_chttp2_hpack_parser_string {
bool copied; bool copied;
struct { struct {
grpc_slice referenced; grpc_slice referenced;
@ -42,8 +42,7 @@ typedef struct {
uint32_t capacity; uint32_t capacity;
} copied; } copied;
} data; } data;
} grpc_chttp2_hpack_parser_string; };
struct grpc_chttp2_hpack_parser { struct grpc_chttp2_hpack_parser {
/* user specified callback for each header output */ /* user specified callback for each header output */
grpc_error* (*on_header)(void* user_data, grpc_mdelem md); grpc_error* (*on_header)(void* user_data, grpc_mdelem md);

@ -138,10 +138,10 @@ inline uintptr_t grpc_chttp2_get_static_hpack_table_index(grpc_mdelem md) {
/* Find a key/value pair in the table... returns the index in the table of the /* Find a key/value pair in the table... returns the index in the table of the
most similar entry, or 0 if the value was not found */ most similar entry, or 0 if the value was not found */
typedef struct { struct grpc_chttp2_hptbl_find_result {
uint32_t index; uint32_t index;
int has_value; int has_value;
} grpc_chttp2_hptbl_find_result; };
grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find( grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find(
const grpc_chttp2_hptbl* tbl, grpc_mdelem md); const grpc_chttp2_hptbl* tbl, grpc_mdelem md);

@ -26,7 +26,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
typedef enum { enum grpc_chttp2_setting_id {
GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE = 0, /* wire id 1 */ GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE = 0, /* wire id 1 */
GRPC_CHTTP2_SETTINGS_ENABLE_PUSH = 1, /* wire id 2 */ GRPC_CHTTP2_SETTINGS_ENABLE_PUSH = 1, /* wire id 2 */
GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS = 2, /* wire id 3 */ GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS = 2, /* wire id 3 */
@ -34,7 +34,7 @@ typedef enum {
GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE = 4, /* wire id 5 */ GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE = 4, /* wire id 5 */
GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE = 5, /* wire id 6 */ GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE = 5, /* wire id 6 */
GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA = 6, /* wire id 65027 */ GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA = 6, /* wire id 65027 */
} grpc_chttp2_setting_id; };
#define GRPC_CHTTP2_NUM_SETTINGS 7 #define GRPC_CHTTP2_NUM_SETTINGS 7
@ -47,15 +47,14 @@ typedef enum {
GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE
} grpc_chttp2_invalid_value_behavior; } grpc_chttp2_invalid_value_behavior;
typedef struct { struct grpc_chttp2_setting_parameters {
const char* name; const char* name;
uint32_t default_value; uint32_t default_value;
uint32_t min_value; uint32_t min_value;
uint32_t max_value; uint32_t max_value;
grpc_chttp2_invalid_value_behavior invalid_value_behavior; grpc_chttp2_invalid_value_behavior invalid_value_behavior;
uint32_t error_value; uint32_t error_value;
} grpc_chttp2_setting_parameters; };
extern const grpc_chttp2_setting_parameters extern const grpc_chttp2_setting_parameters
grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS]; grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS];

@ -23,11 +23,10 @@
#define GRPC_CHTTP2_NUM_HUFFSYMS 257 #define GRPC_CHTTP2_NUM_HUFFSYMS 257
typedef struct { struct grpc_chttp2_huffsym {
unsigned bits; unsigned bits;
unsigned length; unsigned length;
} grpc_chttp2_huffsym; };
extern const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS]; extern const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS];
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H */ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H */

@ -106,30 +106,26 @@ typedef enum {
const char* grpc_chttp2_initiate_write_reason_string( const char* grpc_chttp2_initiate_write_reason_string(
grpc_chttp2_initiate_write_reason reason); grpc_chttp2_initiate_write_reason reason);
typedef struct { struct grpc_chttp2_ping_queue {
grpc_closure_list lists[GRPC_CHTTP2_PCL_COUNT] = {}; grpc_closure_list lists[GRPC_CHTTP2_PCL_COUNT] = {};
uint64_t inflight_id = 0; uint64_t inflight_id = 0;
} grpc_chttp2_ping_queue; };
struct grpc_chttp2_repeated_ping_policy {
typedef struct {
int max_pings_without_data; int max_pings_without_data;
int max_ping_strikes; int max_ping_strikes;
grpc_millis min_sent_ping_interval_without_data; grpc_millis min_sent_ping_interval_without_data;
grpc_millis min_recv_ping_interval_without_data; grpc_millis min_recv_ping_interval_without_data;
} grpc_chttp2_repeated_ping_policy; };
struct grpc_chttp2_repeated_ping_state {
typedef struct {
grpc_millis last_ping_sent_time; grpc_millis last_ping_sent_time;
int pings_before_data_required; int pings_before_data_required;
grpc_timer delayed_ping_timer; grpc_timer delayed_ping_timer;
bool is_delayed_ping_timer_set; bool is_delayed_ping_timer_set;
} grpc_chttp2_repeated_ping_state; };
struct grpc_chttp2_server_ping_recv_state {
typedef struct {
grpc_millis last_ping_recv_time; grpc_millis last_ping_recv_time;
int ping_strikes; int ping_strikes;
} grpc_chttp2_server_ping_recv_state; };
/* deframer state for the overall http2 stream of bytes */ /* deframer state for the overall http2 stream of bytes */
typedef enum { typedef enum {
/* prefix: one entry per http2 connection prefix byte */ /* prefix: one entry per http2 connection prefix byte */
@ -173,16 +169,14 @@ typedef enum {
GRPC_DTS_FRAME GRPC_DTS_FRAME
} grpc_chttp2_deframe_transport_state; } grpc_chttp2_deframe_transport_state;
typedef struct { struct grpc_chttp2_stream_list {
grpc_chttp2_stream* head; grpc_chttp2_stream* head;
grpc_chttp2_stream* tail; grpc_chttp2_stream* tail;
} grpc_chttp2_stream_list; };
struct grpc_chttp2_stream_link {
typedef struct {
grpc_chttp2_stream* next; grpc_chttp2_stream* next;
grpc_chttp2_stream* prev; grpc_chttp2_stream* prev;
} grpc_chttp2_stream_link; };
/* We keep several sets of connection wide parameters */ /* We keep several sets of connection wide parameters */
typedef enum { typedef enum {
/* The settings our peer has asked for (and we have acked) */ /* The settings our peer has asked for (and we have acked) */
@ -678,15 +672,14 @@ struct grpc_chttp2_stream {
void grpc_chttp2_initiate_write(grpc_chttp2_transport* t, void grpc_chttp2_initiate_write(grpc_chttp2_transport* t,
grpc_chttp2_initiate_write_reason reason); grpc_chttp2_initiate_write_reason reason);
typedef struct { struct grpc_chttp2_begin_write_result {
/** are we writing? */ /** are we writing? */
bool writing; bool writing;
/** if writing: was it a complete flush (false) or a partial flush (true) */ /** if writing: was it a complete flush (false) or a partial flush (true) */
bool partial; bool partial;
/** did we queue any completions as part of beginning the write */ /** did we queue any completions as part of beginning the write */
bool early_results_scheduled; bool early_results_scheduled;
} grpc_chttp2_begin_write_result; };
grpc_chttp2_begin_write_result grpc_chttp2_begin_write( grpc_chttp2_begin_write_result grpc_chttp2_begin_write(
grpc_chttp2_transport* t); grpc_chttp2_transport* t);
void grpc_chttp2_end_write(grpc_chttp2_transport* t, grpc_error* error); void grpc_chttp2_end_write(grpc_chttp2_transport* t, grpc_error* error);

@ -29,14 +29,13 @@
Lookups are performed with binary search. Lookups are performed with binary search.
Adds are restricted to strictly higher keys than previously seen (this is Adds are restricted to strictly higher keys than previously seen (this is
guaranteed by http2). */ guaranteed by http2). */
typedef struct { struct grpc_chttp2_stream_map {
uint32_t* keys; uint32_t* keys;
void** values; void** values;
size_t count; size_t count;
size_t free; size_t free;
size_t capacity; size_t capacity;
} grpc_chttp2_stream_map; };
void grpc_chttp2_stream_map_init(grpc_chttp2_stream_map* map, void grpc_chttp2_stream_map_init(grpc_chttp2_stream_map* map,
size_t initial_capacity); size_t initial_capacity);
void grpc_chttp2_stream_map_destroy(grpc_chttp2_stream_map* map); void grpc_chttp2_stream_map_destroy(grpc_chttp2_stream_map* map);

@ -65,16 +65,15 @@ typedef struct grpc_call_element grpc_call_element;
typedef struct grpc_channel_stack grpc_channel_stack; typedef struct grpc_channel_stack grpc_channel_stack;
typedef struct grpc_call_stack grpc_call_stack; typedef struct grpc_call_stack grpc_call_stack;
typedef struct { struct grpc_channel_element_args {
grpc_channel_stack* channel_stack; grpc_channel_stack* channel_stack;
const grpc_channel_args* channel_args; const grpc_channel_args* channel_args;
/** Transport, iff it is known */ /** Transport, iff it is known */
grpc_transport* optional_transport; grpc_transport* optional_transport;
int is_first; int is_first;
int is_last; int is_last;
} grpc_channel_element_args; };
struct grpc_call_element_args {
typedef struct {
grpc_call_stack* call_stack; grpc_call_stack* call_stack;
const void* server_transport_data; const void* server_transport_data;
grpc_call_context_element* context; grpc_call_context_element* context;
@ -83,13 +82,11 @@ typedef struct {
grpc_millis deadline; grpc_millis deadline;
grpc_core::Arena* arena; grpc_core::Arena* arena;
grpc_core::CallCombiner* call_combiner; grpc_core::CallCombiner* call_combiner;
} grpc_call_element_args; };
struct grpc_call_stats {
typedef struct {
grpc_transport_stream_stats transport_stream_stats; grpc_transport_stream_stats transport_stream_stats;
gpr_timespec latency; /* From call creating to enqueing of received status */ gpr_timespec latency; /* From call creating to enqueing of received status */
} grpc_call_stats; };
/** Information about the call upon completion. */ /** Information about the call upon completion. */
struct grpc_call_final_info { struct grpc_call_final_info {
grpc_call_stats stats; grpc_call_stats stats;
@ -107,7 +104,7 @@ struct grpc_call_final_info {
4. a name, which is useful when debugging 4. a name, which is useful when debugging
Members are laid out in approximate frequency of use order. */ Members are laid out in approximate frequency of use order. */
typedef struct { struct grpc_channel_filter {
/* Called to eg. send/receive data on a call. /* Called to eg. send/receive data on a call.
See grpc_call_next_op on how to call the next element in the stack */ See grpc_call_next_op on how to call the next element in the stack */
void (*start_transport_stream_op_batch)(grpc_call_element* elem, void (*start_transport_stream_op_batch)(grpc_call_element* elem,
@ -163,8 +160,7 @@ typedef struct {
/* The name of this filter */ /* The name of this filter */
const char* name; const char* name;
} grpc_channel_filter; };
/* A channel_element tracks its filter and the filter requested memory within /* A channel_element tracks its filter and the filter requested memory within
a channel allocation */ a channel allocation */
struct grpc_channel_element { struct grpc_channel_element {

@ -38,13 +38,12 @@ typedef struct connected_channel_channel_data {
grpc_transport* transport; grpc_transport* transport;
} channel_data; } channel_data;
typedef struct { struct callback_state {
grpc_closure closure; grpc_closure closure;
grpc_closure* original_closure; grpc_closure* original_closure;
grpc_core::CallCombiner* call_combiner; grpc_core::CallCombiner* call_combiner;
const char* reason; const char* reason;
} callback_state; };
typedef struct connected_channel_call_data { typedef struct connected_channel_call_data {
grpc_core::CallCombiner* call_combiner; grpc_core::CallCombiner* call_combiner;
// Closures used for returning results on the call combiner. // Closures used for returning results on the call combiner.

@ -22,11 +22,10 @@
#include "src/core/lib/gpr/useful.h" #include "src/core/lib/gpr/useful.h"
typedef struct { struct status_string_entry {
const char* str; const char* str;
grpc_status_code status; grpc_status_code status;
} status_string_entry; };
static const status_string_entry g_status_string_entries[] = { static const status_string_entry g_status_string_entries[] = {
{"OK", GRPC_STATUS_OK}, {"OK", GRPC_STATUS_OK},
{"CANCELLED", GRPC_STATUS_CANCELLED}, {"CANCELLED", GRPC_STATUS_CANCELLED},

@ -25,10 +25,9 @@
/* Simple spinlock. No backoff strategy, gpr_spinlock_lock is almost always /* Simple spinlock. No backoff strategy, gpr_spinlock_lock is almost always
a concurrency code smell. */ a concurrency code smell. */
typedef struct { struct gpr_spinlock {
gpr_atm atm; gpr_atm atm;
} gpr_spinlock; };
#ifdef __cplusplus #ifdef __cplusplus
#define GPR_SPINLOCK_INITIALIZER (gpr_spinlock{0}) #define GPR_SPINLOCK_INITIALIZER (gpr_spinlock{0})
#else #else

@ -50,12 +50,11 @@ char* gpr_strdup(const char* src) {
return dst; return dst;
} }
typedef struct { struct dump_out {
size_t capacity; size_t capacity;
size_t length; size_t length;
char* data; char* data;
} dump_out; };
char* gpr_format_timespec(gpr_timespec tm) { char* gpr_format_timespec(gpr_timespec tm) {
char time_buffer[35]; char time_buffer[35];
char ns_buffer[11]; // '.' + 9 digits of precision char ns_buffer[11]; // '.' + 9 digits of precision

@ -97,12 +97,11 @@ void gpr_string_split(const char* input, const char* sep, char*** strs,
char* gpr_format_timespec(gpr_timespec); char* gpr_format_timespec(gpr_timespec);
/* A vector of strings... for building up a final string one piece at a time */ /* A vector of strings... for building up a final string one piece at a time */
typedef struct { struct gpr_strvec {
char** strs; char** strs;
size_t count; size_t count;
size_t capacity; size_t capacity;
} gpr_strvec; };
/* Initialize/destroy */ /* Initialize/destroy */
void gpr_strvec_init(gpr_strvec* strs); void gpr_strvec_init(gpr_strvec* strs);
void gpr_strvec_destroy(gpr_strvec* strs); void gpr_strvec_destroy(gpr_strvec* strs);

@ -38,7 +38,7 @@
#include "src/core/lib/iomgr/tcp_client.h" #include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/slice/slice_internal.h"
typedef struct { struct internal_request {
grpc_slice request_text; grpc_slice request_text;
grpc_http_parser parser; grpc_http_parser parser;
grpc_resolved_addresses* addresses; grpc_resolved_addresses* addresses;
@ -60,8 +60,7 @@ typedef struct {
grpc_closure connected; grpc_closure connected;
grpc_error* overall_error; grpc_error* overall_error;
grpc_resource_quota* resource_quota; grpc_resource_quota* resource_quota;
} internal_request; };
static grpc_httpcli_get_override g_get_override = nullptr; static grpc_httpcli_get_override g_get_override = nullptr;
static grpc_httpcli_post_override g_post_override = nullptr; static grpc_httpcli_post_override g_post_override = nullptr;

@ -41,13 +41,12 @@ typedef struct grpc_httpcli_context {
grpc_pollset_set* pollset_set; grpc_pollset_set* pollset_set;
} grpc_httpcli_context; } grpc_httpcli_context;
typedef struct { struct grpc_httpcli_handshaker {
const char* default_port; const char* default_port;
void (*handshake)(void* arg, grpc_endpoint* endpoint, const char* host, void (*handshake)(void* arg, grpc_endpoint* endpoint, const char* host,
grpc_millis deadline, grpc_millis deadline,
void (*on_done)(void* arg, grpc_endpoint* endpoint)); void (*on_done)(void* arg, grpc_endpoint* endpoint));
} grpc_httpcli_handshaker; };
extern const grpc_httpcli_handshaker grpc_httpcli_plaintext; extern const grpc_httpcli_handshaker grpc_httpcli_plaintext;
extern const grpc_httpcli_handshaker grpc_httpcli_ssl; extern const grpc_httpcli_handshaker grpc_httpcli_ssl;

@ -155,12 +155,11 @@ httpcli_ssl_channel_security_connector_create(
/* handshaker */ /* handshaker */
typedef struct { struct on_done_closure {
void (*func)(void* arg, grpc_endpoint* endpoint); void (*func)(void* arg, grpc_endpoint* endpoint);
void* arg; void* arg;
grpc_core::RefCountedPtr<grpc_core::HandshakeManager> handshake_mgr; grpc_core::RefCountedPtr<grpc_core::HandshakeManager> handshake_mgr;
} on_done_closure; };
static void on_handshake_done(void* arg, grpc_error* error) { static void on_handshake_done(void* arg, grpc_error* error) {
auto* args = static_cast<grpc_core::HandshakerArgs*>(arg); auto* args = static_cast<grpc_core::HandshakerArgs*>(arg);
on_done_closure* c = static_cast<on_done_closure*>(args->user_data); on_done_closure* c = static_cast<on_done_closure*>(args->user_data);

@ -79,7 +79,7 @@ typedef struct grpc_http_response {
char* body = nullptr; char* body = nullptr;
} grpc_http_response; } grpc_http_response;
typedef struct { struct grpc_http_parser {
grpc_http_parser_state state; grpc_http_parser_state state;
grpc_http_type type; grpc_http_type type;
@ -94,8 +94,7 @@ typedef struct {
uint8_t cur_line[GRPC_HTTP_PARSER_MAX_HEADER_LENGTH]; uint8_t cur_line[GRPC_HTTP_PARSER_MAX_HEADER_LENGTH];
size_t cur_line_length; size_t cur_line_length;
size_t cur_line_end_length; size_t cur_line_end_length;
} grpc_http_parser; };
void grpc_http_parser_init(grpc_http_parser* parser, grpc_http_type type, void grpc_http_parser_init(grpc_http_parser* parser, grpc_http_type type,
void* request_or_response); void* request_or_response);
void grpc_http_parser_destroy(grpc_http_parser* parser); void grpc_http_parser_destroy(grpc_http_parser* parser);

@ -121,12 +121,11 @@ inline grpc_closure* grpc_closure_init(grpc_closure* closure,
namespace closure_impl { namespace closure_impl {
typedef struct { struct wrapped_closure {
grpc_iomgr_cb_func cb; grpc_iomgr_cb_func cb;
void* cb_arg; void* cb_arg;
grpc_closure wrapper; grpc_closure wrapper;
} wrapped_closure; };
inline void closure_wrapper(void* arg, grpc_error* error) { inline void closure_wrapper(void* arg, grpc_error* error) {
wrapped_closure* wc = static_cast<wrapped_closure*>(arg); wrapped_closure* wc = static_cast<wrapped_closure*>(arg);
grpc_iomgr_cb_func cb = wc->cb; grpc_iomgr_cb_func cb = wc->cb;

@ -39,7 +39,7 @@
extern grpc_core::TraceFlag grpc_tcp_trace; extern grpc_core::TraceFlag grpc_tcp_trace;
typedef struct { struct CFStreamEndpoint {
grpc_endpoint base; grpc_endpoint base;
gpr_refcount refcount; gpr_refcount refcount;
@ -58,8 +58,7 @@ typedef struct {
char* peer_string; char* peer_string;
grpc_resource_user* resource_user; grpc_resource_user* resource_user;
grpc_resource_user_slice_allocator slice_allocator; grpc_resource_user_slice_allocator slice_allocator;
} CFStreamEndpoint; };
static void CFStreamFree(CFStreamEndpoint* ep) { static void CFStreamFree(CFStreamEndpoint* ep) {
grpc_resource_user_unref(ep->resource_user); grpc_resource_user_unref(ep->resource_user);
CFRelease(ep->read_stream); CFRelease(ep->read_stream);

@ -23,11 +23,10 @@
#include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/endpoint.h"
typedef struct { struct grpc_endpoint_pair {
grpc_endpoint* client; grpc_endpoint* client;
grpc_endpoint* server; grpc_endpoint* server;
} grpc_endpoint_pair; };
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char* name, grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char* name,
grpc_channel_args* args); grpc_channel_args* args);

@ -446,12 +446,11 @@ grpc_error* grpc_error_set_int(grpc_error* src, grpc_error_ints which,
return new_err; return new_err;
} }
typedef struct { struct special_error_status_map {
grpc_status_code code; grpc_status_code code;
const char* msg; const char* msg;
size_t len; size_t len;
} special_error_status_map; };
const special_error_status_map error_status_map[] = { const special_error_status_map error_status_map[] = {
{GRPC_STATUS_OK, "", 0}, // GRPC_ERROR_NONE {GRPC_STATUS_OK, "", 0}, // GRPC_ERROR_NONE
{GRPC_STATUS_INVALID_ARGUMENT, "", 0}, // GRPC_ERROR_RESERVED_1 {GRPC_STATUS_INVALID_ARGUMENT, "", 0}, // GRPC_ERROR_RESERVED_1
@ -532,17 +531,15 @@ static const char* no_error_string = "\"No Error\"";
static const char* oom_error_string = "\"Out of memory\""; static const char* oom_error_string = "\"Out of memory\"";
static const char* cancelled_error_string = "\"Cancelled\""; static const char* cancelled_error_string = "\"Cancelled\"";
typedef struct { struct kv_pair {
char* key; char* key;
char* value; char* value;
} kv_pair; };
struct kv_pairs {
typedef struct {
kv_pair* kvs; kv_pair* kvs;
size_t num_kvs; size_t num_kvs;
size_t cap_kvs; size_t cap_kvs;
} kv_pairs; };
static void append_chr(char c, char** s, size_t* sz, size_t* cap) { static void append_chr(char c, char** s, size_t* sz, size_t* cap) {
if (*sz == *cap) { if (*sz == *cap) {
*cap = GPR_MAX(8, 3 * *cap / 2); *cap = GPR_MAX(8, 3 * *cap / 2);

@ -263,11 +263,10 @@ static void fd_global_shutdown(void);
* Pollset Declarations * Pollset Declarations
*/ */
typedef struct { struct pwlink {
grpc_pollset_worker* next; grpc_pollset_worker* next;
grpc_pollset_worker* prev; grpc_pollset_worker* prev;
} pwlink; };
typedef enum { PWLINK_POLLABLE = 0, PWLINK_POLLSET, PWLINK_COUNT } pwlinks; typedef enum { PWLINK_POLLABLE = 0, PWLINK_POLLSET, PWLINK_COUNT } pwlinks;
struct grpc_pollset_worker { struct grpc_pollset_worker {

@ -81,11 +81,10 @@ static const char* g_poll_strategy_name = nullptr;
typedef const grpc_event_engine_vtable* (*event_engine_factory_fn)( typedef const grpc_event_engine_vtable* (*event_engine_factory_fn)(
bool explicit_request); bool explicit_request);
typedef struct { struct event_engine_factory {
const char* name; const char* name;
event_engine_factory_fn factory; event_engine_factory_fn factory;
} event_engine_factory; };
namespace { namespace {
grpc_poll_function_type real_poll_function; grpc_poll_function_type real_poll_function;

@ -41,16 +41,14 @@
#define GRPC_MAX_SOCKADDR_SIZE 128 #define GRPC_MAX_SOCKADDR_SIZE 128
typedef struct { struct grpc_resolved_address {
char addr[GRPC_MAX_SOCKADDR_SIZE]; char addr[GRPC_MAX_SOCKADDR_SIZE];
socklen_t len; socklen_t len;
} grpc_resolved_address; };
struct grpc_resolved_addresses {
typedef struct {
size_t naddrs; size_t naddrs;
grpc_resolved_address* addrs; grpc_resolved_address* addrs;
} grpc_resolved_addresses; };
typedef struct grpc_address_resolver_vtable { typedef struct grpc_address_resolver_vtable {
void (*resolve_address)(const char* addr, const char* default_port, void (*resolve_address)(const char* addr, const char* default_port,
grpc_pollset_set* interested_parties, grpc_pollset_set* interested_parties,

@ -139,15 +139,14 @@ done:
return err; return err;
} }
typedef struct { struct request {
char* name; char* name;
char* default_port; char* default_port;
grpc_closure* on_done; grpc_closure* on_done;
grpc_resolved_addresses** addrs_out; grpc_resolved_addresses** addrs_out;
grpc_closure request_closure; grpc_closure request_closure;
void* arg; void* arg;
} request; };
/* Callback to be passed to grpc Executor to asynch-ify /* Callback to be passed to grpc Executor to asynch-ify
* grpc_blocking_resolve_address */ * grpc_blocking_resolve_address */
static void do_request_thread(void* rp, grpc_error* /*error*/) { static void do_request_thread(void* rp, grpc_error* /*error*/) {

@ -43,14 +43,13 @@
#include "src/core/lib/iomgr/iomgr_internal.h" #include "src/core/lib/iomgr/iomgr_internal.h"
#include "src/core/lib/iomgr/sockaddr_utils.h" #include "src/core/lib/iomgr/sockaddr_utils.h"
typedef struct { struct request {
char* name; char* name;
char* default_port; char* default_port;
grpc_closure request_closure; grpc_closure request_closure;
grpc_closure* on_done; grpc_closure* on_done;
grpc_resolved_addresses** addresses; grpc_resolved_addresses** addresses;
} request; };
static grpc_error* windows_blocking_resolve_address( static grpc_error* windows_blocking_resolve_address(
const char* name, const char* default_port, const char* name, const char* default_port,
grpc_resolved_addresses** addresses) { grpc_resolved_addresses** addresses) {

@ -39,11 +39,10 @@ grpc_core::TraceFlag grpc_resource_quota_trace(false, "resource_quota");
#define MEMORY_USAGE_ESTIMATION_MAX 65536 #define MEMORY_USAGE_ESTIMATION_MAX 65536
/* Internal linked list pointers for a resource user */ /* Internal linked list pointers for a resource user */
typedef struct { struct grpc_resource_user_link {
grpc_resource_user* next; grpc_resource_user* next;
grpc_resource_user* prev; grpc_resource_user* prev;
} grpc_resource_user_link; };
/* Resource users are kept in (potentially) several intrusive linked lists /* Resource users are kept in (potentially) several intrusive linked lists
at once. These are the list names. */ at once. These are the list names. */
typedef enum { typedef enum {
@ -610,12 +609,11 @@ static void ru_allocated_slices(void* arg, grpc_error* error) {
* combiner * combiner
*/ */
typedef struct { struct rq_resize_args {
int64_t size; int64_t size;
grpc_resource_quota* resource_quota; grpc_resource_quota* resource_quota;
grpc_closure closure; grpc_closure closure;
} rq_resize_args; };
static void rq_resize(void* args, grpc_error* /*error*/) { static void rq_resize(void* args, grpc_error* /*error*/) {
rq_resize_args* a = static_cast<rq_resize_args*>(args); rq_resize_args* a = static_cast<rq_resize_args*>(args);
int64_t delta = a->size - a->resource_quota->size; int64_t delta = a->size - a->resource_quota->size;

@ -26,7 +26,7 @@
#include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/resolve_address.h"
/** The virtual table of grpc_socket_factory */ /** The virtual table of grpc_socket_factory */
typedef struct { struct grpc_socket_factory_vtable {
/** Replacement for socket(2) */ /** Replacement for socket(2) */
int (*socket)(grpc_socket_factory* factory, int domain, int type, int (*socket)(grpc_socket_factory* factory, int domain, int type,
int protocol); int protocol);
@ -37,8 +37,7 @@ typedef struct {
int (*compare)(grpc_socket_factory* a, grpc_socket_factory* b); int (*compare)(grpc_socket_factory* a, grpc_socket_factory* b);
/** Destroys the socket factory instance */ /** Destroys the socket factory instance */
void (*destroy)(grpc_socket_factory* factory); void (*destroy)(grpc_socket_factory* factory);
} grpc_socket_factory_vtable; };
/** The Socket Factory interface allows changes on socket options */ /** The Socket Factory interface allows changes on socket options */
struct grpc_socket_factory { struct grpc_socket_factory {
const grpc_socket_factory_vtable* vtable; const grpc_socket_factory_vtable* vtable;

@ -27,15 +27,14 @@
#include <stdbool.h> #include <stdbool.h>
/** The virtual table of grpc_socket_mutator */ /** The virtual table of grpc_socket_mutator */
typedef struct { struct grpc_socket_mutator_vtable {
/** Mutates the socket options of \a fd */ /** Mutates the socket options of \a fd */
bool (*mutate_fd)(int fd, grpc_socket_mutator* mutator); bool (*mutate_fd)(int fd, grpc_socket_mutator* mutator);
/** Compare socket mutator \a a and \a b */ /** Compare socket mutator \a a and \a b */
int (*compare)(grpc_socket_mutator* a, grpc_socket_mutator* b); int (*compare)(grpc_socket_mutator* a, grpc_socket_mutator* b);
/** Destroys the socket mutator instance */ /** Destroys the socket mutator instance */
void (*destroy)(grpc_socket_mutator* mutator); void (*destroy)(grpc_socket_mutator* mutator);
} grpc_socket_mutator_vtable; };
/** The Socket Mutator interface allows changes on socket options */ /** The Socket Mutator interface allows changes on socket options */
struct grpc_socket_mutator { struct grpc_socket_mutator {
const grpc_socket_mutator_vtable* vtable; const grpc_socket_mutator_vtable* vtable;

@ -49,7 +49,7 @@
extern grpc_core::TraceFlag grpc_tcp_trace; extern grpc_core::TraceFlag grpc_tcp_trace;
typedef struct { struct async_connect {
gpr_mu mu; gpr_mu mu;
grpc_fd* fd; grpc_fd* fd;
grpc_timer alarm; grpc_timer alarm;
@ -61,8 +61,7 @@ typedef struct {
grpc_endpoint** ep; grpc_endpoint** ep;
grpc_closure* closure; grpc_closure* closure;
grpc_channel_args* channel_args; grpc_channel_args* channel_args;
} async_connect; };
static grpc_error* prepare_socket(const grpc_resolved_address* addr, int fd, static grpc_error* prepare_socket(const grpc_resolved_address* addr, int fd,
const grpc_channel_args* channel_args) { const grpc_channel_args* channel_args) {
grpc_error* err = GRPC_ERROR_NONE; grpc_error* err = GRPC_ERROR_NONE;

@ -40,7 +40,7 @@
#include "src/core/lib/iomgr/tcp_windows.h" #include "src/core/lib/iomgr/tcp_windows.h"
#include "src/core/lib/iomgr/timer.h" #include "src/core/lib/iomgr/timer.h"
typedef struct { struct async_connect {
grpc_closure* on_done; grpc_closure* on_done;
gpr_mu mu; gpr_mu mu;
grpc_winsocket* socket; grpc_winsocket* socket;
@ -51,8 +51,7 @@ typedef struct {
grpc_closure on_connect; grpc_closure on_connect;
grpc_endpoint** endpoint; grpc_endpoint** endpoint;
grpc_channel_args* channel_args; grpc_channel_args* channel_args;
} async_connect; };
static void async_connect_unlock_and_cleanup(async_connect* ac, static void async_connect_unlock_and_cleanup(async_connect* ac,
grpc_winsocket* socket) { grpc_winsocket* socket) {
int done = (--ac->refs == 0); int done = (--ac->refs == 0);

@ -52,7 +52,7 @@ void grpc_custom_endpoint_init(grpc_socket_vtable* impl) {
grpc_set_tcp_server_impl(&custom_tcp_server_vtable); grpc_set_tcp_server_impl(&custom_tcp_server_vtable);
} }
typedef struct { struct custom_tcp_endpoint {
grpc_endpoint base; grpc_endpoint base;
gpr_refcount refcount; gpr_refcount refcount;
grpc_custom_socket* socket; grpc_custom_socket* socket;
@ -69,8 +69,7 @@ typedef struct {
bool shutting_down; bool shutting_down;
char* peer_string; char* peer_string;
} custom_tcp_endpoint; };
static void tcp_free(grpc_custom_socket* s) { static void tcp_free(grpc_custom_socket* s) {
custom_tcp_endpoint* tcp = (custom_tcp_endpoint*)s->endpoint; custom_tcp_endpoint* tcp = (custom_tcp_endpoint*)s->endpoint;
grpc_resource_user_unref(tcp->resource_user); grpc_resource_user_unref(tcp->resource_user);

@ -24,7 +24,7 @@
weighted mean. It is designed for batch operations where we do many adds weighted mean. It is designed for batch operations where we do many adds
before updating the average. */ before updating the average. */
typedef struct { struct grpc_time_averaged_stats {
/* The initial average value. This is the reported average until the first /* The initial average value. This is the reported average until the first
grpc_time_averaged_stats_update_average call. If a positive regress_weight grpc_time_averaged_stats_update_average call. If a positive regress_weight
is used, we also regress towards this value on each update. */ is used, we also regress towards this value on each update. */
@ -56,8 +56,7 @@ typedef struct {
/* A time-decayed average of the (batch_total_value_ / batch_num_samples_), /* A time-decayed average of the (batch_total_value_ / batch_num_samples_),
computed by decaying the samples_in_avg_ weight in the weighted average. */ computed by decaying the samples_in_avg_ weight in the weighted average. */
double aggregate_weighted_avg; double aggregate_weighted_avg;
} grpc_time_averaged_stats; };
/* See the comments on the members above for an explanation of init_avg, /* See the comments on the members above for an explanation of init_avg,
regress_weight, and persistence_factor. */ regress_weight, and persistence_factor. */
void grpc_time_averaged_stats_init(grpc_time_averaged_stats* stats, void grpc_time_averaged_stats_init(grpc_time_averaged_stats* stats,

@ -56,7 +56,7 @@ grpc_core::TraceFlag grpc_timer_check_trace(false, "timer_check");
* stats maintained in 'stats' and the relevant timers are then moved from the * stats maintained in 'stats' and the relevant timers are then moved from the
* 'list' to 'heap'. * 'list' to 'heap'.
*/ */
typedef struct { struct timer_shard {
gpr_mu mu; gpr_mu mu;
grpc_time_averaged_stats stats; grpc_time_averaged_stats stats;
/* All and only timers with deadlines < this will be in the heap. */ /* All and only timers with deadlines < this will be in the heap. */
@ -70,8 +70,7 @@ typedef struct {
grpc_timer_heap heap; grpc_timer_heap heap;
/* This holds timers whose deadline is >= queue_deadline_cap. */ /* This holds timers whose deadline is >= queue_deadline_cap. */
grpc_timer list; grpc_timer list;
} timer_shard; };
static size_t g_num_shards; static size_t g_num_shards;
/* Array of timer shards. Whenever a timer (grpc_timer *) is added, its address /* Array of timer shards. Whenever a timer (grpc_timer *) is added, its address

@ -23,12 +23,11 @@
#include "src/core/lib/iomgr/timer.h" #include "src/core/lib/iomgr/timer.h"
typedef struct { struct grpc_timer_heap {
grpc_timer** timers; grpc_timer** timers;
uint32_t timer_count; uint32_t timer_count;
uint32_t timer_capacity; uint32_t timer_capacity;
} grpc_timer_heap; };
/* return true if the new timer is the first timer in the heap */ /* return true if the new timer is the first timer in the heap */
bool grpc_timer_heap_add(grpc_timer_heap* heap, grpc_timer* timer); bool grpc_timer_heap_add(grpc_timer_heap* heap, grpc_timer* timer);

@ -148,11 +148,10 @@ grpc_channel_credentials* grpc_channel_credentials_find_in_args(
/* --- grpc_credentials_mdelem_array. --- */ /* --- grpc_credentials_mdelem_array. --- */
typedef struct { struct grpc_credentials_mdelem_array {
grpc_mdelem* md = nullptr; grpc_mdelem* md = nullptr;
size_t size = 0; size_t size = 0;
} grpc_credentials_mdelem_array; };
/// Takes a new ref to \a md. /// Takes a new ref to \a md.
void grpc_credentials_mdelem_array_add(grpc_credentials_mdelem_array* list, void grpc_credentials_mdelem_array_add(grpc_credentials_mdelem_array* list,
grpc_mdelem md); grpc_mdelem md);

@ -68,13 +68,12 @@ static grpc_core::internal::grpc_gce_tenancy_checker g_gce_tenancy_checker =
static void init_default_credentials(void) { gpr_mu_init(&g_state_mu); } static void init_default_credentials(void) { gpr_mu_init(&g_state_mu); }
typedef struct { struct metadata_server_detector {
grpc_polling_entity pollent; grpc_polling_entity pollent;
int is_done; int is_done;
int success; int success;
grpc_http_response response; grpc_http_response response;
} metadata_server_detector; };
grpc_core::RefCountedPtr<grpc_channel_security_connector> grpc_core::RefCountedPtr<grpc_channel_security_connector>
grpc_google_default_channel_credentials::create_security_connector( grpc_google_default_channel_credentials::create_security_connector(
grpc_core::RefCountedPtr<grpc_call_credentials> call_creds, grpc_core::RefCountedPtr<grpc_call_credentials> call_creds,

@ -32,14 +32,13 @@
/* --- auth_json_key parsing. --- */ /* --- auth_json_key parsing. --- */
typedef struct { struct grpc_auth_json_key {
const char* type; const char* type;
char* private_key_id; char* private_key_id;
char* client_id; char* client_id;
char* client_email; char* client_email;
RSA* private_key; RSA* private_key;
} grpc_auth_json_key; };
/* Returns 1 if the object is valid, 0 otherwise. */ /* Returns 1 if the object is valid, 0 otherwise. */
int grpc_auth_json_key_is_valid(const grpc_auth_json_key* json_key); int grpc_auth_json_key_is_valid(const grpc_auth_json_key* json_key);

@ -118,14 +118,13 @@ static gpr_timespec validate_time_field(const Json& json, const char* key) {
/* --- JOSE header. see http://tools.ietf.org/html/rfc7515#section-4 --- */ /* --- JOSE header. see http://tools.ietf.org/html/rfc7515#section-4 --- */
typedef struct { struct jose_header {
const char* alg; const char* alg;
const char* kid; const char* kid;
const char* typ; const char* typ;
/* TODO(jboeuf): Add others as needed (jku, jwk, x5u, x5c and so on...). */ /* TODO(jboeuf): Add others as needed (jku, jwk, x5u, x5c and so on...). */
grpc_core::ManualConstructor<Json> json; grpc_core::ManualConstructor<Json> json;
} jose_header; };
static void jose_header_destroy(jose_header* h) { static void jose_header_destroy(jose_header* h) {
h->json.Destroy(); h->json.Destroy();
gpr_free(h); gpr_free(h);
@ -335,7 +334,7 @@ typedef enum {
HTTP_RESPONSE_COUNT /* must be last */ HTTP_RESPONSE_COUNT /* must be last */
} http_response_index; } http_response_index;
typedef struct { struct verifier_cb_ctx {
grpc_jwt_verifier* verifier; grpc_jwt_verifier* verifier;
grpc_polling_entity pollent; grpc_polling_entity pollent;
jose_header* header; jose_header* header;
@ -346,8 +345,7 @@ typedef struct {
void* user_data; void* user_data;
grpc_jwt_verification_done_cb user_cb; grpc_jwt_verification_done_cb user_cb;
grpc_http_response responses[HTTP_RESPONSE_COUNT]; grpc_http_response responses[HTTP_RESPONSE_COUNT];
} verifier_cb_ctx; };
/* Takes ownership of the header, claims and signature. */ /* Takes ownership of the header, claims and signature. */
static verifier_cb_ctx* verifier_cb_ctx_create( static verifier_cb_ctx* verifier_cb_ctx_create(
grpc_jwt_verifier* verifier, grpc_pollset* pollset, jose_header* header, grpc_jwt_verifier* verifier, grpc_pollset* pollset, jose_header* header,
@ -392,11 +390,10 @@ gpr_timespec grpc_jwt_verifier_clock_skew = {60, 0, GPR_TIMESPAN};
/* Max delay defaults to one minute. */ /* Max delay defaults to one minute. */
grpc_millis grpc_jwt_verifier_max_delay = 60 * GPR_MS_PER_SEC; grpc_millis grpc_jwt_verifier_max_delay = 60 * GPR_MS_PER_SEC;
typedef struct { struct email_key_mapping {
char* email_domain; char* email_domain;
char* key_url_prefix; char* key_url_prefix;
} email_key_mapping; };
struct grpc_jwt_verifier { struct grpc_jwt_verifier {
email_key_mapping* mappings; email_key_mapping* mappings;
size_t num_mappings; /* Should be very few, linear search ok. */ size_t num_mappings; /* Should be very few, linear search ok. */

@ -71,7 +71,7 @@ gpr_timespec grpc_jwt_claims_not_before(const grpc_jwt_claims* claims);
typedef struct grpc_jwt_verifier grpc_jwt_verifier; typedef struct grpc_jwt_verifier grpc_jwt_verifier;
typedef struct { struct grpc_jwt_verifier_email_domain_key_url_mapping {
/* The email domain is the part after the @ sign. */ /* The email domain is the part after the @ sign. */
const char* email_domain; const char* email_domain;
@ -79,8 +79,7 @@ typedef struct {
https://<key_url_prefix>/<issuer_email> https://<key_url_prefix>/<issuer_email>
Therefore the key_url_prefix must NOT contain https://. */ Therefore the key_url_prefix must NOT contain https://. */
const char* key_url_prefix; const char* key_url_prefix;
} grpc_jwt_verifier_email_domain_key_url_mapping; };
/* Globals to control the verifier. Not thread-safe. */ /* Globals to control the verifier. Not thread-safe. */
extern gpr_timespec grpc_jwt_verifier_clock_skew; extern gpr_timespec grpc_jwt_verifier_clock_skew;
extern grpc_millis grpc_jwt_verifier_max_delay; extern grpc_millis grpc_jwt_verifier_max_delay;

@ -34,13 +34,12 @@
"s&subject_token_type=%s" "s&subject_token_type=%s"
// auth_refresh_token parsing. // auth_refresh_token parsing.
typedef struct { struct grpc_auth_refresh_token {
const char* type; const char* type;
char* client_id; char* client_id;
char* client_secret; char* client_secret;
char* refresh_token; char* refresh_token;
} grpc_auth_refresh_token; };
/// Returns 1 if the object is valid, 0 otherwise. /// Returns 1 if the object is valid, 0 otherwise.
int grpc_auth_refresh_token_is_valid( int grpc_auth_refresh_token_is_valid(
const grpc_auth_refresh_token* refresh_token); const grpc_auth_refresh_token* refresh_token);

@ -29,12 +29,11 @@
#include "src/core/tsi/ssl_transport_security.h" #include "src/core/tsi/ssl_transport_security.h"
#include "src/core/tsi/transport_security_interface.h" #include "src/core/tsi/transport_security_interface.h"
typedef struct { struct grpc_ssl_config {
tsi_ssl_pem_key_cert_pair* pem_key_cert_pair; tsi_ssl_pem_key_cert_pair* pem_key_cert_pair;
char* pem_root_certs; char* pem_root_certs;
verify_peer_options verify_options; verify_peer_options verify_options;
} grpc_ssl_config; };
/* Creates an SSL channel_security_connector. /* Creates an SSL channel_security_connector.
- request_metadata_creds is the credentials object which metadata - request_metadata_creds is the credentials object which metadata
will be sent with each request. This parameter can be NULL. will be sent with each request. This parameter can be NULL.
@ -57,14 +56,13 @@ grpc_ssl_channel_security_connector_create(
tsi_ssl_session_cache* ssl_session_cache); tsi_ssl_session_cache* ssl_session_cache);
/* Config for ssl servers. */ /* Config for ssl servers. */
typedef struct { struct grpc_ssl_server_config {
tsi_ssl_pem_key_cert_pair* pem_key_cert_pairs = nullptr; tsi_ssl_pem_key_cert_pair* pem_key_cert_pairs = nullptr;
size_t num_key_cert_pairs = 0; size_t num_key_cert_pairs = 0;
char* pem_root_certs = nullptr; char* pem_root_certs = nullptr;
grpc_ssl_client_certificate_request_type client_certificate_request = grpc_ssl_client_certificate_request_type client_certificate_request =
GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE; GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE;
} grpc_ssl_server_config; };
/* Creates an SSL server_security_connector. /* Creates an SSL server_security_connector.
- config is the SSL config to be used for the SSL channel establishment. - config is the SSL config to be used for the SSL channel establishment.
- sc is a pointer on the connector to be created. - sc is a pointer on the connector to be created.

@ -52,11 +52,10 @@ typedef struct slice_shard {
static slice_shard g_shards[SHARD_COUNT]; static slice_shard g_shards[SHARD_COUNT];
typedef struct { struct static_metadata_hash_ent {
uint32_t hash; uint32_t hash;
uint32_t idx; uint32_t idx;
} static_metadata_hash_ent; };
static static_metadata_hash_ent static static_metadata_hash_ent
static_metadata_hash[4 * GRPC_STATIC_MDSTR_COUNT]; static_metadata_hash[4 * GRPC_STATIC_MDSTR_COUNT];
static uint32_t max_static_metadata_hash_probe; static uint32_t max_static_metadata_hash_probe;

@ -670,12 +670,11 @@ grpc_call_error grpc_call_cancel_with_status(grpc_call* c,
return GRPC_CALL_OK; return GRPC_CALL_OK;
} }
typedef struct { struct cancel_state {
grpc_call* call; grpc_call* call;
grpc_closure start_batch; grpc_closure start_batch;
grpc_closure finish_batch; grpc_closure finish_batch;
} cancel_state; };
// The on_complete callback used when sending a cancel_stream batch down // The on_complete callback used when sending a cancel_stream batch down
// the filter stack. Yields the call combiner when the batch is done. // the filter stack. Yields the call combiner when the batch is done.
static void done_termination(void* arg, grpc_error* /*error*/) { static void done_termination(void* arg, grpc_error* /*error*/) {

@ -28,13 +28,12 @@
#include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/completion_queue.h" #include "src/core/lib/surface/completion_queue.h"
typedef struct { struct ping_result {
grpc_closure closure; grpc_closure closure;
void* tag; void* tag;
grpc_completion_queue* cq; grpc_completion_queue* cq;
grpc_cq_completion completion_storage; grpc_cq_completion completion_storage;
} ping_result; };
static void ping_destroy(void* arg, grpc_cq_completion* /*storage*/) { static void ping_destroy(void* arg, grpc_cq_completion* /*storage*/) {
gpr_free(arg); gpr_free(arg);
} }

@ -56,12 +56,11 @@ namespace {
GPR_TLS_DECL(g_cached_event); GPR_TLS_DECL(g_cached_event);
GPR_TLS_DECL(g_cached_cq); GPR_TLS_DECL(g_cached_cq);
typedef struct { struct plucker {
grpc_pollset_worker** worker; grpc_pollset_worker** worker;
void* tag; void* tag;
} plucker; };
struct cq_poller_vtable {
typedef struct {
bool can_get_pollset; bool can_get_pollset;
bool can_listen; bool can_listen;
size_t (*size)(void); size_t (*size)(void);
@ -72,8 +71,7 @@ typedef struct {
grpc_millis deadline); grpc_millis deadline);
void (*shutdown)(grpc_pollset* pollset, grpc_closure* closure); void (*shutdown)(grpc_pollset* pollset, grpc_closure* closure);
void (*destroy)(grpc_pollset* pollset); void (*destroy)(grpc_pollset* pollset);
} cq_poller_vtable; };
typedef struct non_polling_worker { typedef struct non_polling_worker {
gpr_cv cv; gpr_cv cv;
bool kicked; bool kicked;
@ -81,13 +79,12 @@ typedef struct non_polling_worker {
struct non_polling_worker* prev; struct non_polling_worker* prev;
} non_polling_worker; } non_polling_worker;
typedef struct { struct non_polling_poller {
gpr_mu mu; gpr_mu mu;
bool kicked_without_poller; bool kicked_without_poller;
non_polling_worker* root; non_polling_worker* root;
grpc_closure* shutdown; grpc_closure* shutdown;
} non_polling_poller; };
size_t non_polling_poller_size(void) { return sizeof(non_polling_poller); } size_t non_polling_poller_size(void) { return sizeof(non_polling_poller); }
void non_polling_poller_init(grpc_pollset* pollset, gpr_mu** mu) { void non_polling_poller_init(grpc_pollset* pollset, gpr_mu** mu) {
@ -903,15 +900,14 @@ void grpc_cq_end_op(grpc_completion_queue* cq, void* tag, grpc_error* error,
cq->vtable->end_op(cq, tag, error, done, done_arg, storage, internal); cq->vtable->end_op(cq, tag, error, done, done_arg, storage, internal);
} }
typedef struct { struct cq_is_finished_arg {
gpr_atm last_seen_things_queued_ever; gpr_atm last_seen_things_queued_ever;
grpc_completion_queue* cq; grpc_completion_queue* cq;
grpc_millis deadline; grpc_millis deadline;
grpc_cq_completion* stolen_completion; grpc_cq_completion* stolen_completion;
void* tag; /* for pluck */ void* tag; /* for pluck */
bool first_loop; bool first_loop;
} cq_is_finished_arg; };
class ExecCtxNext : public grpc_core::ExecCtx { class ExecCtxNext : public grpc_core::ExecCtx {
public: public:
ExecCtxNext(void* arg) : ExecCtx(0), check_ready_to_finish_arg_(arg) {} ExecCtxNext(void* arg) : ExecCtx(0), check_ready_to_finish_arg_(arg) {}

@ -154,11 +154,10 @@ inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail(
grpc_error* grpc_attach_md_to_error(grpc_error* src, grpc_mdelem md); grpc_error* grpc_attach_md_to_error(grpc_error* src, grpc_mdelem md);
typedef struct { struct grpc_filtered_mdelem {
grpc_error* error; grpc_error* error;
grpc_mdelem md; grpc_mdelem md;
} grpc_filtered_mdelem; };
#define GRPC_FILTERED_ERROR(error) \ #define GRPC_FILTERED_ERROR(error) \
{ (error), GRPC_MDNULL } { (error), GRPC_MDNULL }
#define GRPC_FILTERED_MDELEM(md) \ #define GRPC_FILTERED_MDELEM(md) \

@ -233,13 +233,12 @@ grpc_transport_op* grpc_make_transport_op(grpc_closure* on_complete) {
return &op->op; return &op->op;
} }
typedef struct { struct made_transport_stream_op {
grpc_closure outer_on_complete; grpc_closure outer_on_complete;
grpc_closure* inner_on_complete; grpc_closure* inner_on_complete;
grpc_transport_stream_op_batch op; grpc_transport_stream_op_batch op;
grpc_transport_stream_op_batch_payload payload; grpc_transport_stream_op_batch_payload payload;
} made_transport_stream_op; };
static void destroy_made_transport_stream_op(void* arg, grpc_error* error) { static void destroy_made_transport_stream_op(void* arg, grpc_error* error) {
made_transport_stream_op* op = static_cast<made_transport_stream_op*>(arg); made_transport_stream_op* op = static_cast<made_transport_stream_op*>(arg);
grpc_closure* c = op->inner_on_complete; grpc_closure* c = op->inner_on_complete;

@ -23,7 +23,7 @@
#include <stddef.h> #include <stddef.h>
typedef struct { struct grpc_uri {
char* scheme; char* scheme;
char* authority; char* authority;
char* path; char* path;
@ -35,8 +35,7 @@ typedef struct {
/** Split each query part by '='. NULL if not present. */ /** Split each query part by '='. NULL if not present. */
char** query_parts_values; char** query_parts_values;
char* fragment; char* fragment;
} grpc_uri; };
/** parse a uri, return NULL on failure */ /** parse a uri, return NULL on failure */
grpc_uri* grpc_uri_parse(const char* uri_text, bool suppress_errors); grpc_uri* grpc_uri_parse(const char* uri_text, bool suppress_errors);

@ -31,7 +31,7 @@
#include "src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h" #include "src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h"
/* V-table for alts_grpc_record_protocol implementations. */ /* V-table for alts_grpc_record_protocol implementations. */
typedef struct { struct alts_grpc_record_protocol_vtable {
tsi_result (*protect)(alts_grpc_record_protocol* self, tsi_result (*protect)(alts_grpc_record_protocol* self,
grpc_slice_buffer* unprotected_slices, grpc_slice_buffer* unprotected_slices,
grpc_slice_buffer* protected_slices); grpc_slice_buffer* protected_slices);
@ -39,8 +39,7 @@ typedef struct {
grpc_slice_buffer* protected_slices, grpc_slice_buffer* protected_slices,
grpc_slice_buffer* unprotected_slices); grpc_slice_buffer* unprotected_slices);
void (*destruct)(alts_grpc_record_protocol* self); void (*destruct)(alts_grpc_record_protocol* self);
} alts_grpc_record_protocol_vtable; };
/* Main struct for alts_grpc_record_protocol implementation, shared by both /* Main struct for alts_grpc_record_protocol implementation, shared by both
* integrity-only record protocol and privacy-integrity record protocol. * integrity-only record protocol and privacy-integrity record protocol.
* Integrity-only record protocol has additional data elements. * Integrity-only record protocol has additional data elements.

@ -42,14 +42,13 @@
| size | data | | size | data |
where the size field value is the size of the size field plus the size of where the size field value is the size of the size field plus the size of
the data encoded in little endian on 4 bytes. */ the data encoded in little endian on 4 bytes. */
typedef struct { struct tsi_fake_frame {
unsigned char* data; unsigned char* data;
size_t size; size_t size;
size_t allocated_size; size_t allocated_size;
size_t offset; size_t offset;
int needs_draining; int needs_draining;
} tsi_fake_frame; };
typedef enum { typedef enum {
TSI_FAKE_CLIENT_INIT = 0, TSI_FAKE_CLIENT_INIT = 0,
TSI_FAKE_SERVER_INIT = 1, TSI_FAKE_SERVER_INIT = 1,
@ -58,7 +57,7 @@ typedef enum {
TSI_FAKE_HANDSHAKE_MESSAGE_MAX = 4 TSI_FAKE_HANDSHAKE_MESSAGE_MAX = 4
} tsi_fake_handshake_message; } tsi_fake_handshake_message;
typedef struct { struct tsi_fake_handshaker {
tsi_handshaker base; tsi_handshaker base;
int is_client; int is_client;
tsi_fake_handshake_message next_message_to_send; tsi_fake_handshake_message next_message_to_send;
@ -68,23 +67,20 @@ typedef struct {
unsigned char* outgoing_bytes_buffer; unsigned char* outgoing_bytes_buffer;
size_t outgoing_bytes_buffer_size; size_t outgoing_bytes_buffer_size;
tsi_result result; tsi_result result;
} tsi_fake_handshaker; };
struct tsi_fake_frame_protector {
typedef struct {
tsi_frame_protector base; tsi_frame_protector base;
tsi_fake_frame protect_frame; tsi_fake_frame protect_frame;
tsi_fake_frame unprotect_frame; tsi_fake_frame unprotect_frame;
size_t max_frame_size; size_t max_frame_size;
} tsi_fake_frame_protector; };
struct tsi_fake_zero_copy_grpc_protector {
typedef struct {
tsi_zero_copy_grpc_protector base; tsi_zero_copy_grpc_protector base;
grpc_slice_buffer header_sb; grpc_slice_buffer header_sb;
grpc_slice_buffer protected_sb; grpc_slice_buffer protected_sb;
size_t max_frame_size; size_t max_frame_size;
size_t parsed_frame_size; size_t parsed_frame_size;
} tsi_fake_zero_copy_grpc_protector; };
/* --- Utils. ---*/ /* --- Utils. ---*/
static const char* tsi_fake_handshake_message_strings[] = { static const char* tsi_fake_handshake_message_strings[] = {
@ -488,12 +484,11 @@ static const tsi_zero_copy_grpc_protector_vtable
/* --- tsi_handshaker_result methods implementation. ---*/ /* --- tsi_handshaker_result methods implementation. ---*/
typedef struct { struct fake_handshaker_result {
tsi_handshaker_result base; tsi_handshaker_result base;
unsigned char* unused_bytes; unsigned char* unused_bytes;
size_t unused_bytes_size; size_t unused_bytes_size;
} fake_handshaker_result; };
static tsi_result fake_handshaker_result_extract_peer( static tsi_result fake_handshaker_result_extract_peer(
const tsi_handshaker_result* self, tsi_peer* peer) { const tsi_handshaker_result* self, tsi_peer* peer) {
/* Construct a tsi_peer with 1 property: certificate type, security_level. */ /* Construct a tsi_peer with 1 property: certificate type, security_level. */

@ -106,7 +106,7 @@ struct tsi_ssl_server_handshaker_factory {
size_t alpn_protocol_list_length; size_t alpn_protocol_list_length;
}; };
typedef struct { struct tsi_ssl_handshaker {
tsi_handshaker base; tsi_handshaker base;
SSL* ssl; SSL* ssl;
BIO* network_io; BIO* network_io;
@ -114,25 +114,22 @@ typedef struct {
unsigned char* outgoing_bytes_buffer; unsigned char* outgoing_bytes_buffer;
size_t outgoing_bytes_buffer_size; size_t outgoing_bytes_buffer_size;
tsi_ssl_handshaker_factory* factory_ref; tsi_ssl_handshaker_factory* factory_ref;
} tsi_ssl_handshaker; };
struct tsi_ssl_handshaker_result {
typedef struct {
tsi_handshaker_result base; tsi_handshaker_result base;
SSL* ssl; SSL* ssl;
BIO* network_io; BIO* network_io;
unsigned char* unused_bytes; unsigned char* unused_bytes;
size_t unused_bytes_size; size_t unused_bytes_size;
} tsi_ssl_handshaker_result; };
struct tsi_ssl_frame_protector {
typedef struct {
tsi_frame_protector base; tsi_frame_protector base;
SSL* ssl; SSL* ssl;
BIO* network_io; BIO* network_io;
unsigned char* buffer; unsigned char* buffer;
size_t buffer_size; size_t buffer_size;
size_t buffer_offset; size_t buffer_offset;
} tsi_ssl_frame_protector; };
/* --- Library Initialization. ---*/ /* --- Library Initialization. ---*/
static gpr_once g_init_openssl_once = GPR_ONCE_INIT; static gpr_once g_init_openssl_once = GPR_ONCE_INIT;

@ -83,7 +83,7 @@ typedef struct tsi_ssl_client_handshaker_factory
tsi_ssl_client_handshaker_factory; tsi_ssl_client_handshaker_factory;
/* Object that holds a private key / certificate chain pair in PEM format. */ /* Object that holds a private key / certificate chain pair in PEM format. */
typedef struct { struct tsi_ssl_pem_key_cert_pair {
/* private_key is the NULL-terminated string containing the PEM encoding of /* private_key is the NULL-terminated string containing the PEM encoding of
the client's private key. */ the client's private key. */
const char* private_key; const char* private_key;
@ -91,8 +91,7 @@ typedef struct {
/* cert_chain is the NULL-terminated string containing the PEM encoding of /* cert_chain is the NULL-terminated string containing the PEM encoding of
the client's certificate chain. */ the client's certificate chain. */
const char* cert_chain; const char* cert_chain;
} tsi_ssl_pem_key_cert_pair; };
/* TO BE DEPRECATED. /* TO BE DEPRECATED.
Creates a client handshaker factory. Creates a client handshaker factory.
- pem_key_cert_pair is a pointer to the object containing client's private - pem_key_cert_pair is a pointer to the object containing client's private
@ -334,10 +333,9 @@ typedef void (*tsi_ssl_handshaker_factory_destructor)(
tsi_ssl_handshaker_factory* factory); tsi_ssl_handshaker_factory* factory);
/* Virtual table for tsi_ssl_handshaker_factory. */ /* Virtual table for tsi_ssl_handshaker_factory. */
typedef struct { struct tsi_ssl_handshaker_factory_vtable {
tsi_ssl_handshaker_factory_destructor destroy; tsi_ssl_handshaker_factory_destructor destroy;
} tsi_ssl_handshaker_factory_vtable; };
/* Set destructor of handshaker_factory to new_destructor, returns previous /* Set destructor of handshaker_factory to new_destructor, returns previous
destructor. */ destructor. */
const tsi_ssl_handshaker_factory_vtable* tsi_ssl_handshaker_factory_swap_vtable( const tsi_ssl_handshaker_factory_vtable* tsi_ssl_handshaker_factory_swap_vtable(

@ -30,7 +30,7 @@ extern grpc_core::TraceFlag tsi_tracing_enabled;
/* Base for tsi_frame_protector implementations. /* Base for tsi_frame_protector implementations.
See transport_security_interface.h for documentation. */ See transport_security_interface.h for documentation. */
typedef struct { struct tsi_frame_protector_vtable {
tsi_result (*protect)(tsi_frame_protector* self, tsi_result (*protect)(tsi_frame_protector* self,
const unsigned char* unprotected_bytes, const unsigned char* unprotected_bytes,
size_t* unprotected_bytes_size, size_t* unprotected_bytes_size,
@ -46,15 +46,14 @@ typedef struct {
unsigned char* unprotected_bytes, unsigned char* unprotected_bytes,
size_t* unprotected_bytes_size); size_t* unprotected_bytes_size);
void (*destroy)(tsi_frame_protector* self); void (*destroy)(tsi_frame_protector* self);
} tsi_frame_protector_vtable; };
struct tsi_frame_protector { struct tsi_frame_protector {
const tsi_frame_protector_vtable* vtable; const tsi_frame_protector_vtable* vtable;
}; };
/* Base for tsi_handshaker implementations. /* Base for tsi_handshaker implementations.
See transport_security_interface.h for documentation. */ See transport_security_interface.h for documentation. */
typedef struct { struct tsi_handshaker_vtable {
tsi_result (*get_bytes_to_send_to_peer)(tsi_handshaker* self, tsi_result (*get_bytes_to_send_to_peer)(tsi_handshaker* self,
unsigned char* bytes, unsigned char* bytes,
size_t* bytes_size); size_t* bytes_size);
@ -74,8 +73,7 @@ typedef struct {
tsi_handshaker_result** handshaker_result, tsi_handshaker_result** handshaker_result,
tsi_handshaker_on_next_done_cb cb, void* user_data); tsi_handshaker_on_next_done_cb cb, void* user_data);
void (*shutdown)(tsi_handshaker* self); void (*shutdown)(tsi_handshaker* self);
} tsi_handshaker_vtable; };
struct tsi_handshaker { struct tsi_handshaker {
const tsi_handshaker_vtable* vtable; const tsi_handshaker_vtable* vtable;
bool frame_protector_created; bool frame_protector_created;
@ -91,7 +89,7 @@ struct tsi_handshaker {
in grpc, where we do need the exec_ctx passed through, but the API still in grpc, where we do need the exec_ctx passed through, but the API still
needs to compile in other applications, where grpc_exec_ctx is not defined. needs to compile in other applications, where grpc_exec_ctx is not defined.
*/ */
typedef struct { struct tsi_handshaker_result_vtable {
tsi_result (*extract_peer)(const tsi_handshaker_result* self, tsi_peer* peer); tsi_result (*extract_peer)(const tsi_handshaker_result* self, tsi_peer* peer);
tsi_result (*create_zero_copy_grpc_protector)( tsi_result (*create_zero_copy_grpc_protector)(
const tsi_handshaker_result* self, const tsi_handshaker_result* self,
@ -104,8 +102,7 @@ typedef struct {
const unsigned char** bytes, const unsigned char** bytes,
size_t* bytes_size); size_t* bytes_size);
void (*destroy)(tsi_handshaker_result* self); void (*destroy)(tsi_handshaker_result* self);
} tsi_handshaker_result_vtable; };
struct tsi_handshaker_result { struct tsi_handshaker_result {
const tsi_handshaker_result_vtable* vtable; const tsi_handshaker_result_vtable* vtable;
}; };

@ -61,7 +61,7 @@ tsi_result tsi_zero_copy_grpc_protector_max_frame_size(
tsi_zero_copy_grpc_protector* self, size_t* max_frame_size); tsi_zero_copy_grpc_protector* self, size_t* max_frame_size);
/* Base for tsi_zero_copy_grpc_protector implementations. */ /* Base for tsi_zero_copy_grpc_protector implementations. */
typedef struct { struct tsi_zero_copy_grpc_protector_vtable {
tsi_result (*protect)(tsi_zero_copy_grpc_protector* self, tsi_result (*protect)(tsi_zero_copy_grpc_protector* self,
grpc_slice_buffer* unprotected_slices, grpc_slice_buffer* unprotected_slices,
grpc_slice_buffer* protected_slices); grpc_slice_buffer* protected_slices);
@ -71,8 +71,7 @@ typedef struct {
void (*destroy)(tsi_zero_copy_grpc_protector* self); void (*destroy)(tsi_zero_copy_grpc_protector* self);
tsi_result (*max_frame_size)(tsi_zero_copy_grpc_protector* self, tsi_result (*max_frame_size)(tsi_zero_copy_grpc_protector* self,
size_t* max_frame_size); size_t* max_frame_size);
} tsi_zero_copy_grpc_protector_vtable; };
struct tsi_zero_copy_grpc_protector { struct tsi_zero_copy_grpc_protector {
const tsi_zero_copy_grpc_protector_vtable* vtable; const tsi_zero_copy_grpc_protector_vtable* vtable;
}; };

@ -208,11 +208,10 @@ typedef struct tsi_peer_property {
} value; } value;
} tsi_peer_property; } tsi_peer_property;
typedef struct { struct tsi_peer {
tsi_peer_property* properties; tsi_peer_property* properties;
size_t property_count; size_t property_count;
} tsi_peer; };
/* Destructs the tsi_peer object. */ /* Destructs the tsi_peer object. */
void tsi_peer_destruct(tsi_peer* self); void tsi_peer_destruct(tsi_peer* self);

Loading…
Cancel
Save