Skip to content

Commit

Permalink
rename connect and handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
Ichishino committed Dec 7, 2023
1 parent 060a5d1 commit 4cbff89
Show file tree
Hide file tree
Showing 29 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ Visual Studio ([prj/msvc/coldforce.sln](https://github.com/Ichishino/coldforce/t
callbacks->on_receive_frame = (co_ws_receive_frame_fn)on_my_ws_receive_frame;
callbacks->on_close = (co_ws_close_fn)on_my_ws_close;

co_ws_connect(self->client);
co_ws_connect_start(self->client);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/dtls_client/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ bool on_my_app_create(my_app* self)
tls_callbacks->on_handshake = (co_dtls_udp_handshake_fn)on_my_handshake;

// handshake
co_dtls_udp_start_handshake(self->client, &self->remote_net_addr);
co_dtls_udp_handshake_start(self->client, &self->remote_net_addr);

char remote_str[64];
co_net_addr_to_string(&self->remote_net_addr, remote_str, sizeof(remote_str));
Expand Down
2 changes: 1 addition & 1 deletion examples/dtls_server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void on_my_udp_accept(my_app* self, co_udp_server_t* server, co_udp_t* client)
dtls_callbacks->on_handshake = (co_dtls_udp_handshake_fn)on_my_dtls_handshake;

// dtls handshake
if (!co_dtls_udp_start_handshake(client, NULL))
if (!co_dtls_udp_handshake_start(client, NULL))
{
printf("handshake failed %s\n", remote_str);

Expand Down
2 changes: 1 addition & 1 deletion examples/http1_http2_server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void on_my_tcp_accept(my_app* self, co_tcp_server_t* tcp_server, co_tcp_client_t
tls_callbacks->on_handshake = (co_tls_handshake_fn)on_my_tls_handshake;

// TLS handshake
co_tls_tcp_start_handshake(tcp_client);
co_tls_tcp_handshake_start(tcp_client);
}

//---------------------------------------------------------------------------//
Expand Down
2 changes: 1 addition & 1 deletion examples/http2_client/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ bool on_my_app_create(my_app* self)
}

// connect
co_http2_connect(self->client);
co_http2_connect_start(self->client);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/http2_server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ void on_my_tcp_accept(my_app* self, co_tcp_server_t* tcp_server, co_tcp_client_t
tls_callbacks->on_handshake = (co_tls_tcp_handshake_fn)on_my_tls_handshake;

// TLS handshake
co_tls_tcp_start_handshake(tcp_client);
co_tls_tcp_handshake_start(tcp_client);
}

//---------------------------------------------------------------------------//
Expand Down
2 changes: 1 addition & 1 deletion examples/http_client/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ bool on_my_app_create(my_app* self)
}

// connect start
co_http_connect(self->client);
co_http_connect_start(self->client);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/https_server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void on_my_tcp_accept(my_app* self, co_tcp_server_t* tcp_server, co_tcp_client_t
tls_callbacks->on_handshake = (co_tls_handshake_fn)on_my_tls_handshake;

// TLS handshake
co_tls_tcp_start_handshake(tcp_client);
co_tls_tcp_handshake_start(tcp_client);
}

bool on_my_app_create(my_app* self)
Expand Down
2 changes: 1 addition & 1 deletion examples/tcp_client/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void my_connect(my_app* self)
callbacks->on_close = (co_tcp_close_fn)on_my_tcp_close;

// connect
co_tcp_connect(self->client, &self->remote_net_addr);
co_tcp_connect_start(self->client, &self->remote_net_addr);

char remote_str[64];
co_net_addr_to_string(&self->remote_net_addr, remote_str, sizeof(remote_str));
Expand Down
4 changes: 2 additions & 2 deletions examples/tls_client/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void on_my_connect(my_app* self, co_tcp_client_t* client, int error_code)
printf("handshake start\n");

// handshake
co_tls_tcp_start_handshake(client);
co_tls_tcp_handshake_start(client);
}
else
{
Expand Down Expand Up @@ -150,7 +150,7 @@ bool my_connect(my_app* self)
tls_callbacks->on_handshake = (co_tls_handshake_fn)on_my_handshake;

// connect
co_tcp_connect(self->client, &self->remote_net_addr);
co_tcp_connect_start(self->client, &self->remote_net_addr);

char remote_str[64];
co_net_addr_to_string(&self->remote_net_addr, remote_str, sizeof(remote_str));
Expand Down
2 changes: 1 addition & 1 deletion examples/tls_echo_server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void on_my_tcp_accept(my_app* self, co_tcp_server_t* server, co_tcp_client_t* cl
tls_callbacks->on_handshake = (co_tls_handshake_fn)on_my_tls_handshake;

// TLS handshake
co_tls_tcp_start_handshake(client);
co_tls_tcp_handshake_start(client);

co_list_add_tail(self->client_list, client);

Expand Down
2 changes: 1 addition & 1 deletion examples/ws_client/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ bool on_my_app_create(my_app* self)
callbacks->on_close = (co_ws_close_fn)on_my_ws_close;

// connect
co_ws_connect(self->client);
co_ws_connect_start(self->client);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion inc/coldforce/http/co_http_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ co_http_get_callbacks(

CO_HTTP_API
bool
co_http_connect(
co_http_connect_start(
co_http_client_t* client
);

Expand Down
2 changes: 1 addition & 1 deletion inc/coldforce/http2/co_http2_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ co_http2_is_running(

CO_HTTP2_API
bool
co_http2_connect(
co_http2_connect_start(
co_http2_client_t* client
);

Expand Down
2 changes: 1 addition & 1 deletion inc/coldforce/net/co_tcp_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ co_tcp_close(

CO_NET_API
bool
co_tcp_connect(
co_tcp_connect_start(
co_tcp_client_t* client,
const co_net_addr_t* remote_net_addr
);
Expand Down
2 changes: 1 addition & 1 deletion inc/coldforce/tls/co_dtls_udp_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ co_dtls_udp_client_destroy(

CO_TLS_API
bool
co_dtls_udp_start_handshake(
co_dtls_udp_handshake_start(
co_udp_t* udp,
const co_net_addr_t* remote_net_addr
);
Expand Down
6 changes: 3 additions & 3 deletions inc/coldforce/tls/co_tls_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ typedef struct
#ifdef CO_USE_OPENSSL_COMPATIBLE

void
co_tls_on_receive_handshake(
co_tls_on_handshake_receive(
co_thread_t* thread,
co_socket_t* sock
);

bool
co_tls_receive_handshake(
co_tls_handshake_receive(
co_thread_t* thread,
co_socket_t* sock
);
Expand Down Expand Up @@ -85,7 +85,7 @@ co_tls_client_cleanup(
);

bool
co_tls_start_handshake(
co_tls_handshake_start(
co_socket_t* sock,
uint32_t timeout_msec
);
Expand Down
2 changes: 1 addition & 1 deletion inc/coldforce/tls/co_tls_tcp_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ co_tls_tcp_client_destroy(

CO_TLS_API
bool
co_tls_tcp_start_handshake(
co_tls_tcp_handshake_start(
co_tcp_client_t* tcp_client
);

Expand Down
2 changes: 1 addition & 1 deletion inc/coldforce/ws/co_ws_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ co_ws_get_callbacks(

CO_WS_API
bool
co_ws_connect(
co_ws_connect_start(
co_ws_client_t* client
);

Expand Down
2 changes: 1 addition & 1 deletion src/http/co_http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ co_http_get_callbacks(
}

bool
co_http_connect(
co_http_connect_start(
co_http_client_t* client
)
{
Expand Down
6 changes: 3 additions & 3 deletions src/http/co_http_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ co_http_connection_on_tcp_connect(
tls->callbacks.on_handshake =
(co_tls_handshake_fn)co_http_connection_on_tls_handshake;

co_tls_tcp_start_handshake(tcp_client);
co_tls_tcp_handshake_start(tcp_client);

return;
}
Expand Down Expand Up @@ -112,7 +112,7 @@ co_http_connection_setup(
{
conn->module.destroy = co_tls_tcp_client_destroy;
conn->module.close = co_tcp_close;
conn->module.connect = co_tcp_connect;
conn->module.connect = co_tcp_connect_start;
conn->module.send = co_tls_tcp_send;
conn->module.receive_all = co_tls_tcp_receive_all;

Expand All @@ -135,7 +135,7 @@ co_http_connection_setup(
{
conn->module.destroy = co_tcp_client_destroy;
conn->module.close = co_tcp_close;
conn->module.connect = co_tcp_connect;
conn->module.connect = co_tcp_connect_start;
conn->module.send = co_tcp_send;
conn->module.receive_all = co_tcp_receive_all;

Expand Down
2 changes: 1 addition & 1 deletion src/http/co_http_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ co_http_thread_on_create(
(co_http_receive_data_fn)co_http_thread_on_receive_data;
}

return co_http_connect(self->client);
return co_http_connect_start(self->client);
}

static void
Expand Down
4 changes: 2 additions & 2 deletions src/http/co_http_tcp_extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ co_tcp_upgrade_to_http_connection(
{
conn->module.destroy = co_tls_tcp_client_destroy;
conn->module.close = co_tcp_close;
conn->module.connect = co_tcp_connect;
conn->module.connect = co_tcp_connect_start;
conn->module.send = co_tls_tcp_send;
conn->module.receive_all = co_tls_tcp_receive_all;
}
else
{
conn->module.destroy = co_tcp_client_destroy;
conn->module.close = co_tcp_close;
conn->module.connect = co_tcp_connect;
conn->module.connect = co_tcp_connect_start;
conn->module.send = co_tcp_send;
conn->module.receive_all = co_tcp_receive_all;
}
Expand Down
2 changes: 1 addition & 1 deletion src/http2/co_http2_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ co_http2_is_running(
}

bool
co_http2_connect(
co_http2_connect_start(
co_http2_client_t* client
)
{
Expand Down
2 changes: 1 addition & 1 deletion src/net/co_tcp_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ co_tcp_client_destroy(
}

bool
co_tcp_connect(
co_tcp_connect_start(
co_tcp_client_t* client,
const co_net_addr_t* remote_net_addr
)
Expand Down
8 changes: 4 additions & 4 deletions src/tls/co_dtls_udp_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ co_dtls_udp_client_destroy(
}

bool
co_dtls_udp_start_handshake(
co_dtls_udp_handshake_start(
co_udp_t* udp,
const co_net_addr_t* remote_net_addr
)
Expand Down Expand Up @@ -120,9 +120,9 @@ co_dtls_udp_start_handshake(
tls->on_receive_origin =
(void*)udp->callbacks.on_receive;
udp->callbacks.on_receive =
(co_udp_receive_fn)co_tls_on_receive_handshake;
(co_udp_receive_fn)co_tls_on_handshake_receive;

if (!co_tls_start_handshake(
if (!co_tls_handshake_start(
&udp->sock, co_tls_get_config()->handshake_timeout))
{
return false;
Expand All @@ -133,7 +133,7 @@ co_dtls_udp_start_handshake(
co_queue_push_array(
tls->receive_data_queue, data, data_size);

if (co_tls_receive_handshake(NULL, &udp->sock))
if (co_tls_handshake_receive(NULL, &udp->sock))
{
return false;
}
Expand Down
22 changes: 11 additions & 11 deletions src/tls/co_tls_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ co_tls_client_cleanup(
}

static bool
co_tls_send_handshake(
co_tls_handshake_send(
co_socket_t* sock
)
{
Expand Down Expand Up @@ -222,7 +222,7 @@ co_tls_send_handshake(
}

static void
co_tls_finished_handshake(
co_tls_handshake_finished(
co_thread_t* thread,
co_socket_t* sock,
int error_code
Expand Down Expand Up @@ -285,7 +285,7 @@ co_tls_finished_handshake(
}

bool
co_tls_receive_handshake(
co_tls_handshake_receive(
co_thread_t* thread,
co_socket_t* sock
)
Expand Down Expand Up @@ -331,7 +331,7 @@ co_tls_receive_handshake(
if ((ssl_error == SSL_ERROR_WANT_READ) ||
(ssl_error == SSL_ERROR_WANT_WRITE))
{
co_tls_send_handshake(sock);
co_tls_handshake_send(sock);

return false;
}
Expand All @@ -349,17 +349,17 @@ co_tls_receive_handshake(
}
else
{
co_tls_send_handshake(sock);
co_tls_handshake_send(sock);
}
}

co_tls_finished_handshake(thread, sock, error_code);
co_tls_handshake_finished(thread, sock, error_code);

return true;
}

void
co_tls_on_receive_handshake(
co_tls_on_handshake_receive(
co_thread_t* thread,
co_socket_t* sock
)
Expand Down Expand Up @@ -438,7 +438,7 @@ co_tls_on_receive_handshake(

#endif

co_tls_receive_handshake(thread, sock);
co_tls_handshake_receive(thread, sock);
}

static void
Expand All @@ -454,7 +454,7 @@ co_tls_on_handshake_timer(
&sock->local.net_addr, "<--", &sock->remote.net_addr,
"tls handshake timeout");

co_tls_finished_handshake(
co_tls_handshake_finished(
thread, sock, CO_TLS_ERROR_HANDSHAKE_FAILED);
}

Expand Down Expand Up @@ -547,7 +547,7 @@ co_tls_decrypt_data(
}

bool
co_tls_start_handshake(
co_tls_handshake_start(
co_socket_t* sock,
uint32_t timeout_msec
)
Expand Down Expand Up @@ -578,7 +578,7 @@ co_tls_start_handshake(
{
if (SSL_is_server(tls->ssl) == 0)
{
return co_tls_send_handshake(sock);
return co_tls_handshake_send(sock);
}

return true;
Expand Down
Loading

0 comments on commit 4cbff89

Please sign in to comment.