Skip to content

Commit

Permalink
Reorg variables for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
kp-mariappan-ramasamy committed Jan 3, 2025
1 parent d95a208 commit 360e30b
Showing 1 changed file with 40 additions and 31 deletions.
71 changes: 40 additions & 31 deletions src/he/he_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,42 +144,13 @@ struct he_ssl_ctx {
typedef struct he_fragment_table he_fragment_table_t;

struct he_conn {
// -------------- Configs (Immutable) -----------------

/// Internal Structure Member for client/server determination
/// No explicit setter or getter, we internally set this in
/// either client or server connect functions
bool is_server;

/// Client State
_Atomic he_conn_state_t state;

/// Pointer to incoming data buffer
uint8_t *incoming_data;
/// Length of the data in the
size_t incoming_data_length;
// WolfSSL stuff
WOLFSSL *wolf_ssl;
/// Wolf Timeout
_Atomic int wolf_timeout;
/// Write buffer
uint8_t write_buffer[HE_MAX_WIRE_MTU];
/// Packet seen
bool packet_seen;
/// Session ID
_Atomic uint64_t session_id;
_Atomic uint64_t pending_session_id;
/// Has the first message been received?
_Atomic bool first_message_received;
/// Bytes left to read in the packet buffer (Streaming only)
size_t incoming_data_left_to_read;
/// Index into the incoming data buffer
uint8_t *incoming_data_read_offset_ptr;

bool renegotiation_in_progress;
bool renegotiation_due;

/// Do we already have a timer running? If so, we don't want to generate new callbacks
_Atomic bool is_nudge_timer_running;

he_plugin_chain_t *inside_plugins;
he_plugin_chain_t *outside_plugins;

Expand Down Expand Up @@ -244,6 +215,44 @@ struct he_conn {
/// Random number generator
RNG wolf_rng;

/// WolfSSL stuff
WOLFSSL *wolf_ssl;

// -------------- State (Mutable) -----------------

/// Client State
_Atomic he_conn_state_t state;

/// Wolf Timeout
_Atomic int wolf_timeout;

/// Pointer to incoming data buffer
uint8_t *incoming_data;
/// Length of the data in the
size_t incoming_data_length;
/// Packet seen
bool packet_seen;
/// Bytes left to read in the packet buffer (Streaming only)
size_t incoming_data_left_to_read;
/// Index into the incoming data buffer
uint8_t *incoming_data_read_offset_ptr;

/// Write buffer
uint8_t write_buffer[HE_MAX_WIRE_MTU];

/// Session ID
_Atomic uint64_t session_id;
_Atomic uint64_t pending_session_id;

/// Has the first message been received?
_Atomic bool first_message_received;

/// Do we already have a timer running? If so, we don't want to generate new callbacks
_Atomic bool is_nudge_timer_running;

bool renegotiation_in_progress;
bool renegotiation_due;

/// Identifier of the next ping message
uint16_t ping_next_id;
/// Identifier of the ping message pending reply
Expand Down

0 comments on commit 360e30b

Please sign in to comment.