Tor 0.4.9.2-alpha-dev
|
Inline functions for reading and writing multibyte values from the middle of strings, and for manipulating byte order. More...
Go to the source code of this file.
Functions | |
static uint8_t | get_uint8 (const void *cp) |
static void | set_uint8 (void *cp, uint8_t v) |
static uint16_t | get_uint16 (const void *cp) |
static uint32_t | get_uint32 (const void *cp) |
static uint64_t | get_uint64 (const void *cp) |
static void | set_uint16 (void *cp, uint16_t v) |
static void | set_uint32 (void *cp, uint32_t v) |
static void | set_uint64 (void *cp, uint64_t v) |
static uint16_t | tor_htons (uint16_t a) |
static uint16_t | tor_ntohs (uint16_t a) |
static uint32_t | tor_htonl (uint32_t a) |
static uint32_t | tor_ntohl (uint32_t a) |
static uint64_t | tor_htonll (uint64_t a) |
static uint64_t | tor_ntohll (uint64_t a) |
Inline functions for reading and writing multibyte values from the middle of strings, and for manipulating byte order.
Definition in file bytes.h.
|
inlinestatic |
Read a 16-bit value beginning at cp. Equivalent to *(uint16_t*)(cp), but will not cause segfaults on platforms that forbid unaligned memory access.
Definition at line 42 of file bytes.h.
Referenced by cell_unpack(), channel_tls_process_authenticate_cell(), channel_tls_process_versions_cell(), created_cell_parse(), decode_v0_cell(), decode_v1_cell(), detect_compression_method(), extended_cell_parse(), fetch_ext_or_command_from_buf(), fetch_var_cell_from_buf(), packed_cell_get_circid(), packed_cell_is_destroy(), parse_create2_payload(), and peek_buf_has_control0_command().
|
inlinestatic |
Read a 32-bit value beginning at cp. Equivalent to *(uint32_t*)(cp), but will not cause segfaults on platforms that forbid unaligned memory access.
Definition at line 54 of file bytes.h.
Referenced by accounting_set_wakeup_time(), begin_cell_parse(), cell_unpack(), connected_cell_parse(), connection_ap_handshake_socks_resolved(), connection_ap_process_end_not_open(), decode_address_from_payload(), fetch_var_cell_from_buf(), get_random_virtual_addr(), packed_cell_get_circid(), packed_cell_is_destroy(), pathbias_check_probe_response(), resolved_cell_parse(), tell_controller_about_resolved_result(), tor1_relay_digest_matches_v0(), and validate_equix_challenge().
|
inlinestatic |
Read a 64-bit value beginning at cp. Equivalent to *(uint64_t*)(cp), but will not cause segfaults on platforms that forbid unaligned memory access.
Definition at line 66 of file bytes.h.
Referenced by commit_decode(), and reveal_decode().
|
inlinestatic |
Read an 8-bit from cp.
Definition at line 23 of file bytes.h.
Referenced by cell_unpack(), connected_cell_parse(), connection_ap_process_end_not_open(), connection_edge_process_relay_cell_not_open(), decode_v0_cell(), decode_v1_cell(), fetch_var_cell_from_buf(), handle_relay_msg(), hs_parse_address_impl(), packed_cell_get_command(), parse_socks(), pathbias_check_probe_response(), and pathbias_count_valid_cells().
|
inlinestatic |
Set a 16-bit value beginning at cp to v. Equivalent to *(uint16_t*)(cp) = v, but will not cause segfaults on platforms that forbid unaligned memory access.
Definition at line 78 of file bytes.h.
Referenced by cell_pack(), connection_ap_handshake_socks_resolved(), connection_or_compute_authenticate_cell_body(), connection_or_send_versions(), connection_write_ext_or_command(), control_send_v0_reject(), create_cell_format_impl(), created_cell_format(), encode_v0_cell(), encode_v1_cell(), extended_cell_format(), and var_cell_pack_header().
|
inlinestatic |
Set a 32-bit value beginning at cp to v. Equivalent to *(uint32_t*)(cp) = v, but will not cause segfaults on platforms that forbid unaligned memory access.
Definition at line 87 of file bytes.h.
Referenced by cell_pack(), chanid_circid_entry_hash(), connected_cell_format_payload(), connection_ap_handshake_send_begin(), connection_edge_end(), crypto_pwbox(), generate_srv(), get_random_virtual_addr(), send_resolved_cell(), send_resolved_hostname_cell(), and var_cell_pack_header().
|
inlinestatic |
Set a 64-bit value beginning at cp to v. Equivalent to *(uint64_t*)(cp) = v, but will not cause segfaults on platforms that forbid unaligned memory access.
Definition at line 96 of file bytes.h.
Referenced by build_blinded_key_param(), build_secret_input(), chanid_circid_entry_hash(), commit_encode(), compute_disaster_srv(), generate_srv(), hs_build_hs_index(), hs_build_hsdir_index(), and reveal_encode().
|
inlinestatic |
Store an 8-bit value from v to cp.
Definition at line 31 of file bytes.h.
Referenced by build_hs_address(), build_hs_checksum(), cell_pack(), connected_cell_format_payload(), and var_cell_pack_header().
|
inlinestatic |
Convert a 32-bit value from host order to network order (big-endian).
Definition at line 163 of file bytes.h.
Referenced by crypto_pwbox(), ope_get_cipher(), tor_htonll(), tor_ntohl(), and validate_equix_challenge().
|
inlinestatic |
Return a uint64_t value from a in network byte order.
Definition at line 184 of file bytes.h.
Referenced by build_blinded_key_param(), build_mac(), build_secret_input(), commit_encode(), compute_disaster_srv(), crypto_mac_sha3_256(), d_add_encap(), generate_srv(), hs_build_hs_index(), hs_build_hsdir_index(), reveal_encode(), tor_ntohll(), and xof_add_encap().
|
inlinestatic |
Convert a 16-bit value from host order to network order (big-endian).
Definition at line 142 of file bytes.h.
Referenced by tor_ntohs().
|
inlinestatic |
Convert a 32-bit value from network order (big-endian) to host order.
Definition at line 177 of file bytes.h.
Referenced by crypto_unpwbox().
|
inlinestatic |
Return a uint64_t value from a in host byte order.
Definition at line 193 of file bytes.h.
Referenced by commit_decode(), and reveal_decode().
|
inlinestatic |
Convert a 16-bit value from network order (big-endian) to host order.
Definition at line 154 of file bytes.h.
Referenced by detect_compression_method().