diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-04-20 05:29:11 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-04-20 05:29:11 +0200 |
commit | 7adeb6e88196a594ec3d36ffc1c658340ffcd7bc (patch) | |
tree | 6a6bfb84387141bf39d573ef9fa47f2c993d1923 /src/handshake.h | |
parent | b9c8603931203f5d94091f7a05a5967304b62fbd (diff) | |
download | fastd-7adeb6e88196a594ec3d36ffc1c658340ffcd7bc.tar fastd-7adeb6e88196a594ec3d36ffc1c658340ffcd7bc.zip |
Make ctx global
Diffstat (limited to 'src/handshake.h')
-rw-r--r-- | src/handshake.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/handshake.h b/src/handshake.h index 5674b83..a401c2a 100644 --- a/src/handshake.h +++ b/src/handshake.h @@ -77,10 +77,10 @@ struct fastd_handshake { }; -fastd_buffer_t fastd_handshake_new_init(fastd_context_t *ctx, size_t tail_space); -fastd_buffer_t fastd_handshake_new_reply(fastd_context_t *ctx, const fastd_handshake_t *handshake, const fastd_method_info_t *method, bool with_method_list, size_t tail_space); +fastd_buffer_t fastd_handshake_new_init(size_t tail_space); +fastd_buffer_t fastd_handshake_new_reply(const fastd_handshake_t *handshake, const fastd_method_info_t *method, bool with_method_list, size_t tail_space); -void fastd_handshake_handle(fastd_context_t *ctx, fastd_socket_t *sock, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *remote_addr, fastd_peer_t *peer, fastd_buffer_t buffer); +void fastd_handshake_handle(fastd_socket_t *sock, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *remote_addr, fastd_peer_t *peer, fastd_buffer_t buffer); static inline void* fastd_handshake_tlv_data(const fastd_buffer_t *buffer) { @@ -93,11 +93,11 @@ static inline uint16_t fastd_handshake_tlv_len(const fastd_buffer_t *buffer) { return ntohs(packet->tlv_len); } -static inline uint8_t* fastd_handshake_extend(fastd_context_t *ctx, fastd_buffer_t *buffer, fastd_handshake_record_type_t type, size_t len) { +static inline uint8_t* fastd_handshake_extend(fastd_buffer_t *buffer, fastd_handshake_record_type_t type, size_t len) { uint8_t *dst = buffer->data + buffer->len; if (buffer->data + buffer->len + 4 + len > buffer->base + buffer->base_len) - exit_bug(ctx, "not enough buffer allocated for handshake"); + exit_bug("not enough buffer allocated for handshake"); buffer->len += 4 + len; @@ -112,27 +112,27 @@ static inline uint8_t* fastd_handshake_extend(fastd_context_t *ctx, fastd_buffer return dst+4; } -static inline void fastd_handshake_add(fastd_context_t *ctx, fastd_buffer_t *buffer, fastd_handshake_record_type_t type, size_t len, const void *data) { - uint8_t *dst = fastd_handshake_extend(ctx, buffer, type, len); +static inline void fastd_handshake_add(fastd_buffer_t *buffer, fastd_handshake_record_type_t type, size_t len, const void *data) { + uint8_t *dst = fastd_handshake_extend(buffer, type, len); memcpy(dst, data, len); } -static inline uint8_t* fastd_handshake_add_zero(fastd_context_t *ctx, fastd_buffer_t *buffer, fastd_handshake_record_type_t type, size_t len) { - uint8_t *dst = fastd_handshake_extend(ctx, buffer, type, len); +static inline uint8_t* fastd_handshake_add_zero(fastd_buffer_t *buffer, fastd_handshake_record_type_t type, size_t len) { + uint8_t *dst = fastd_handshake_extend(buffer, type, len); memset(dst, 0, len); return dst; } -static inline void fastd_handshake_add_uint8(fastd_context_t *ctx, fastd_buffer_t *buffer, fastd_handshake_record_type_t type, uint8_t value) { - uint8_t *dst = fastd_handshake_extend(ctx, buffer, type, 1); +static inline void fastd_handshake_add_uint8(fastd_buffer_t *buffer, fastd_handshake_record_type_t type, uint8_t value) { + uint8_t *dst = fastd_handshake_extend(buffer, type, 1); dst[0] = value; } -static inline void fastd_handshake_add_uint16(fastd_context_t *ctx, fastd_buffer_t *buffer, fastd_handshake_record_type_t type, uint16_t value) { - uint8_t *dst = fastd_handshake_extend(ctx, buffer, type, 2); +static inline void fastd_handshake_add_uint16(fastd_buffer_t *buffer, fastd_handshake_record_type_t type, uint16_t value) { + uint8_t *dst = fastd_handshake_extend(buffer, type, 2); dst[0] = value; dst[1] = value >> 8; |