mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
Define const variants for our channel_tls_t* casts.
This commit is contained in:
parent
47a48e2f5a
commit
b3eb409157
@ -389,6 +389,25 @@ channel_tls_from_base(channel_t *chan)
|
||||
return (channel_tls_t *)(chan);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast a const channel_tls_t to a const channel_t.
|
||||
*/
|
||||
const channel_t *
|
||||
channel_tls_to_base_const(const channel_tls_t *tlschan)
|
||||
{
|
||||
return channel_tls_to_base((channel_tls_t*) tlschan);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast a const channel_t to a const channel_tls_t, with appropriate
|
||||
* type-checking asserts.
|
||||
*/
|
||||
const channel_tls_t *
|
||||
channel_tls_from_base_const(const channel_t *chan)
|
||||
{
|
||||
return channel_tls_from_base((channel_t *)chan);
|
||||
}
|
||||
|
||||
/********************************************
|
||||
* Method implementations for channel_tls_t *
|
||||
*******************************************/
|
||||
|
@ -19,6 +19,8 @@ struct curve25519_public_key_t;
|
||||
|
||||
#define BASE_CHAN_TO_TLS(c) (channel_tls_from_base((c)))
|
||||
#define TLS_CHAN_TO_BASE(c) (channel_tls_to_base((c)))
|
||||
#define CONST_BASE_CHAN_TO_TLS(c) (channel_tls_from_base_const((c)))
|
||||
#define CONST_TLS_CHAN_TO_BASE(c) (channel_tls_to_base_const((c)))
|
||||
|
||||
#define TLS_CHAN_MAGIC 0x8a192427U
|
||||
|
||||
@ -44,6 +46,8 @@ channel_t * channel_tls_handle_incoming(or_connection_t *orconn);
|
||||
|
||||
channel_t * channel_tls_to_base(channel_tls_t *tlschan);
|
||||
channel_tls_t * channel_tls_from_base(channel_t *chan);
|
||||
const channel_t * channel_tls_to_base_const(const channel_tls_t *tlschan);
|
||||
const channel_tls_t * channel_tls_from_base_const(const channel_t *chan);
|
||||
|
||||
/* Things for connection_or.c to call back into */
|
||||
void channel_tls_handle_cell(cell_t *cell, or_connection_t *conn);
|
||||
|
Loading…
Reference in New Issue
Block a user