diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-07-21 15:56:13 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-07-21 15:56:13 +0200 |
commit | 749a4b2eda0b3b2d7a796530bb64fdfb4b5f3df4 (patch) | |
tree | 54e98714ecea47f9398185ee3f65eb0a43f5ca86 | |
parent | 50a65c5358beef1cc2859e4bf6e9ae7805c29087 (diff) |
clang-format
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r-- | client.c | 7 | ||||
-rw-r--r-- | common-sodium.c | 6 | ||||
-rw-r--r-- | common-sodium.h | 5 | ||||
-rw-r--r-- | protocol.c | 3 | ||||
-rw-r--r-- | protocol.h | 2 | ||||
-rw-r--r-- | server.c | 12 |
6 files changed, 25 insertions, 10 deletions
@@ -41,7 +41,9 @@ static void send_data(struct connection * const state) close(data_fd); data_fd = -1; } else { - LOG(NOTICE, "Send DATA: %zd bytes, buffer capacity %0.2f%% unused", bytes_read, + LOG(NOTICE, + "Send DATA: %zd bytes, buffer capacity %0.2f%% unused", + bytes_read, 100.0f - ((float)bytes_read / sizeof(buf)) * 100.0f); } } @@ -217,7 +219,8 @@ __attribute__((noreturn)) static void cleanup_and_exit(struct event_base ** cons LOG(LP_DEBUG, "Cleanup and exit with exit code: %d", exit_code); if (*state != NULL) { - LOG(NOTICE, "Closed connection; received %s; sent %s", + LOG(NOTICE, + "Closed connection; received %s; sent %s", prettify_bytes_with_units(pretty_bytes_rx, sizeof(pretty_bytes_rx), (*state)->total_bytes_recv), prettify_bytes_with_units(pretty_bytes_tx, sizeof(pretty_bytes_tx), (*state)->total_bytes_sent)); } diff --git a/common-sodium.c b/common-sodium.c index 202eca6..d17b70a 100644 --- a/common-sodium.c +++ b/common-sodium.c @@ -4,8 +4,10 @@ #include "logging.h" #include "protocol.h" -void log_bin2hex_sodium(enum log_priority log_prio, char const * const prefix, - uint8_t const * const buffer, size_t size) +void log_bin2hex_sodium(enum log_priority log_prio, + char const * const prefix, + uint8_t const * const buffer, + size_t size) { char hexstr[2 * size + 1]; diff --git a/common-sodium.h b/common-sodium.h index b4a7d23..858a38b 100644 --- a/common-sodium.h +++ b/common-sodium.h @@ -9,7 +9,10 @@ struct connection; -void log_bin2hex_sodium(enum log_priority log_prio, char const * const prefix, uint8_t const * const buffer, size_t size); +void log_bin2hex_sodium(enum log_priority log_prio, + char const * const prefix, + uint8_t const * const buffer, + size_t size); __attribute__((warn_unused_result)) struct longterm_keypair * generate_keypair_sodium(void); @@ -411,7 +411,8 @@ enum recv_return process_received(struct connection * const state, **************************/ static void protocol_response(struct connection * const state, - void * const buffer, uint32_t body_and_payload_size, + void * const buffer, + uint32_t body_and_payload_size, enum header_types type) { struct protocol_header * const header = (struct protocol_header *)buffer; @@ -11,7 +11,7 @@ #define PROTOCOL_MAGIC 0xBAADC0DE #define PROTOCOL_VERSION 0xDEADCAFE #define PROTOCOL_TIME_STRLEN 32 -#define WINDOW_SIZE (65535*2) +#define WINDOW_SIZE (65535 * 2) #if WINDOW_SIZE > (UINT_MAX) #error "Window size is limited by sizeof(header.body_size)" #endif @@ -65,7 +65,10 @@ enum recv_return protocol_request_client_auth(struct connection * const state, return RECV_FATAL_UNAUTH; } - log_bin2hex_sodium(NOTICE, "Client AUTH with PublicKey", auth_pkt->client_publickey, sizeof(auth_pkt->client_publickey)); + log_bin2hex_sodium(NOTICE, + "Client AUTH with PublicKey", + auth_pkt->client_publickey, + sizeof(auth_pkt->client_publickey)); if (init_crypto_server(state, auth_pkt->server_rx_header, sizeof(auth_pkt->server_rx_header)) != 0) { LOG(ERROR, "Client session keypair generation failed"); return RECV_FATAL_CRYPTO_ERROR; @@ -158,7 +161,8 @@ void on_disconnect(struct connection * const state) char pretty_bytes_rx[16]; char pretty_bytes_tx[16]; - LOG(NOTICE, "Client closed connection; received %s; sent %s", + LOG(NOTICE, + "Client closed connection; received %s; sent %s", prettify_bytes_with_units(pretty_bytes_rx, sizeof(pretty_bytes_rx), state->total_bytes_recv), prettify_bytes_with_units(pretty_bytes_tx, sizeof(pretty_bytes_tx), state->total_bytes_sent)); (void)state; @@ -380,7 +384,9 @@ int main(int argc, char ** argv) accept_conn_cb, my_keypair, LEV_OPT_CLOSE_ON_FREE | LEV_OPT_REUSEABLE, - -1, ai->ai_addr, ai->ai_addrlen); + -1, + ai->ai_addr, + ai->ai_addrlen); if (ev_listener != NULL) { break; } |