| 1 |
#ifndef AWS_HTTP_PROXY_IMPL_H |
| 2 |
#define AWS_HTTP_PROXY_IMPL_H |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#include <aws/http/http.h> |
| 10 |
|
| 11 |
#include <aws/common/hash_table.h> |
| 12 |
#include <aws/http/connection.h> |
| 13 |
#include <aws/http/proxy.h> |
| 14 |
#include <aws/http/status_code.h> |
| 15 |
#include <aws/io/channel_bootstrap.h> |
| 16 |
#include <aws/io/socket.h> |
| 17 |
|
| 18 |
struct aws_http_connection_manager_options; |
| 19 |
struct aws_http_message; |
| 20 |
struct aws_channel_slot; |
| 21 |
struct aws_string; |
| 22 |
struct aws_tls_connection_options; |
| 23 |
struct aws_http_proxy_negotiator; |
| 24 |
struct aws_http_proxy_strategy; |
| 25 |
struct aws_http_proxy_strategy_tunneling_sequence_options; |
| 26 |
struct aws_http_proxy_strategy_tunneling_kerberos_options; |
| 27 |
struct aws_http_proxy_strategy_tunneling_ntlm_options; |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
enum aws_proxy_bootstrap_state { |
| 36 |
AWS_PBS_NONE = 0, |
| 37 |
AWS_PBS_SOCKET_CONNECT, |
| 38 |
AWS_PBS_HTTP_CONNECT, |
| 39 |
AWS_PBS_TLS_NEGOTIATION, |
| 40 |
AWS_PBS_SUCCESS, |
| 41 |
AWS_PBS_FAILURE, |
| 42 |
}; |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
struct aws_http_proxy_config { |
| 48 |
|
| 49 |
struct aws_allocator *allocator; |
| 50 |
|
| 51 |
enum aws_http_proxy_connection_type connection_type; |
| 52 |
|
| 53 |
struct aws_byte_buf host; |
| 54 |
|
| 55 |
uint32_t port; |
| 56 |
|
| 57 |
struct aws_tls_connection_options *tls_options; |
| 58 |
|
| 59 |
struct aws_http_proxy_strategy *proxy_strategy; |
| 60 |
|
| 61 |
struct aws_byte_buf no_proxy_hosts; |
| 62 |
}; |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
struct aws_http_proxy_user_data { |
| 73 |
struct aws_allocator *allocator; |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
enum aws_proxy_bootstrap_state state; |
| 79 |
int error_code; |
| 80 |
enum aws_http_status_code connect_status_code; |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
struct aws_http_connection *proxy_connection; |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
struct aws_http_connection *final_connection; |
| 94 |
struct aws_http_message *connect_request; |
| 95 |
struct aws_http_stream *connect_stream; |
| 96 |
struct aws_http_proxy_negotiator *proxy_negotiator; |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
struct aws_string *original_host; |
| 102 |
uint32_t original_port; |
| 103 |
void *original_user_data; |
| 104 |
struct aws_tls_connection_options *original_tls_options; |
| 105 |
struct aws_client_bootstrap *original_bootstrap; |
| 106 |
struct aws_socket_options original_socket_options; |
| 107 |
bool original_manual_window_management; |
| 108 |
size_t original_initial_window_size; |
| 109 |
bool prior_knowledge_http2; |
| 110 |
struct aws_http1_connection_options original_http1_options; |
| 111 |
struct aws_http2_connection_options |
| 112 |
original_http2_options; |
| 113 |
struct aws_hash_table alpn_string_map; |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
aws_http_on_client_connection_setup_fn *original_http_on_setup; |
| 124 |
aws_http_on_client_connection_shutdown_fn *original_http_on_shutdown; |
| 125 |
aws_client_bootstrap_on_channel_event_fn *original_channel_on_setup; |
| 126 |
aws_client_bootstrap_on_channel_event_fn *original_channel_on_shutdown; |
| 127 |
|
| 128 |
struct aws_http_proxy_config *proxy_config; |
| 129 |
|
| 130 |
struct aws_event_loop *requested_event_loop; |
| 131 |
|
| 132 |
const struct aws_host_resolution_config *host_resolution_config; |
| 133 |
}; |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
struct aws_http_proxy_system_vtable { |
| 138 |
int (*aws_channel_setup_client_tls)( |
| 139 |
struct aws_channel_slot *right_of_slot, |
| 140 |
struct aws_tls_connection_options *tls_options); |
| 141 |
}; |
| 142 |
|
| 143 |
AWS_EXTERN_C_BEGIN |
| 144 |
|
| 145 |
AWS_HTTP_API |
| 146 |
struct aws_http_proxy_user_data *aws_http_proxy_user_data_new( |
| 147 |
struct aws_allocator *allocator, |
| 148 |
const struct aws_http_client_connection_options *options, |
| 149 |
aws_client_bootstrap_on_channel_event_fn *on_channel_setup, |
| 150 |
aws_client_bootstrap_on_channel_event_fn *on_channel_shutdown); |
| 151 |
|
| 152 |
AWS_HTTP_API |
| 153 |
void aws_http_proxy_user_data_destroy(struct aws_http_proxy_user_data *user_data); |
| 154 |
|
| 155 |
AWS_HTTP_API |
| 156 |
int aws_http_client_connect_via_proxy(const struct aws_http_client_connection_options *options); |
| 157 |
|
| 158 |
AWS_HTTP_API |
| 159 |
int aws_http_rewrite_uri_for_proxy_request( |
| 160 |
struct aws_http_message *request, |
| 161 |
struct aws_http_proxy_user_data *proxy_user_data); |
| 162 |
|
| 163 |
AWS_HTTP_API |
| 164 |
void aws_http_proxy_system_set_vtable(struct aws_http_proxy_system_vtable *vtable); |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
AWS_HTTP_API |
| 172 |
enum aws_http_proxy_negotiation_retry_directive aws_http_proxy_negotiator_get_retry_directive( |
| 173 |
struct aws_http_proxy_negotiator *proxy_negotiator); |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
AWS_HTTP_API |
| 184 |
struct aws_http_proxy_strategy *aws_http_proxy_strategy_new_tunneling_one_time_identity( |
| 185 |
struct aws_allocator *allocator); |
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
AWS_HTTP_API |
| 195 |
struct aws_http_proxy_strategy *aws_http_proxy_strategy_new_forwarding_identity(struct aws_allocator *allocator); |
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
AWS_HTTP_API |
| 207 |
struct aws_http_proxy_strategy *aws_http_proxy_strategy_new_tunneling_sequence( |
| 208 |
struct aws_allocator *allocator, |
| 209 |
struct aws_http_proxy_strategy_tunneling_sequence_options *config); |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
AWS_HTTP_API |
| 222 |
struct aws_http_proxy_strategy *aws_http_proxy_strategy_new_tunneling_kerberos( |
| 223 |
struct aws_allocator *allocator, |
| 224 |
struct aws_http_proxy_strategy_tunneling_kerberos_options *config); |
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
AWS_HTTP_API |
| 238 |
struct aws_http_proxy_strategy *aws_http_proxy_strategy_new_tunneling_ntlm( |
| 239 |
struct aws_allocator *allocator, |
| 240 |
struct aws_http_proxy_strategy_tunneling_ntlm_options *config); |
| 241 |
|
| 242 |
AWS_EXTERN_C_END |
| 243 |
|
| 244 |
#endif |