|
Document of c-modernization-kit (porter) 1.0.0
|
セッションコンテキスト構造体。PotrHandle の実体。 More...
#include <potrContext.h>
Data Fields | |
| PotrRecvCallback | callback |
| 受信コールバック。 | |
| PotrThread | recv_thread [POTR_MAX_PATH] |
| 受信スレッドハンドル (path ごと)。 | |
| PotrThread | health_thread [POTR_MAX_PATH] |
| ヘルスチェックスレッドハンドル (path ごと、送信者のみ)。 | |
| PotrMutex | health_mutex [POTR_MAX_PATH] |
| ヘルスチェックスレッド停止用ミューテックス (path ごと)。 | |
| PotrCondVar | health_wakeup [POTR_MAX_PATH] |
| ヘルスチェックスレッドを即時起床させる条件変数 (path ごと)。 | |
| PotrServiceDef | service |
| サービス定義。 | |
| PotrGlobalConfig | global |
| グローバル設定。 | |
| PotrWindow | send_window |
| 送信バッファ (過去 N パケット保持。NACK 再送・REJECT 判定に使用)。 | |
| PotrMutex | send_window_mutex |
| send_window 保護用ミューテックス (送信スレッド・ヘルスチェックスレッド・受信スレッドが競合するため)。 | |
| PotrWindow | recv_window |
| 受信ウィンドウ (順序整列・欠番検出)。 | |
| PotrSocket | sock [POTR_MAX_PATH] |
| 各パスの UDP ソケット。 | |
| int | n_path |
| 有効パス数。 | |
| volatile int | running [POTR_MAX_PATH] |
| 受信スレッド実行フラグ (1: 実行中, 0: 停止)。path ごと。 | |
| volatile int | health_running [POTR_MAX_PATH] |
| ヘルスチェックスレッド実行フラグ (1: 実行中, 0: 停止)。path ごと。 | |
| volatile int | health_alive |
| 疎通状態 (1: alive, 0: dead/未接続)。UDP 用。受信者が管理。 | |
| PotrRole | role |
| 役割 (POTR_ROLE_SENDER / POTR_ROLE_RECEIVER)。 | |
| struct in_addr | src_addr_resolved [POTR_MAX_PATH] |
| 解決済み送信元 IPv4 アドレス。 | |
| struct in_addr | dst_addr_resolved [POTR_MAX_PATH] |
| 解決済み宛先 IPv4 アドレス (unicast のみ)。 | |
| struct sockaddr_in | dest_addr [POTR_MAX_PATH] |
| 送信先ソケットアドレス (送信者が sendto に使用)。 | |
| uint32_t | session_id |
| 自セッション識別子 (乱数)。 | |
| int64_t | session_tv_sec |
| 自セッション開始時刻 秒部。 | |
| int32_t | session_tv_nsec |
| 自セッション開始時刻 ナノ秒部。 | |
| uint32_t | peer_session_id |
| 追跡中の相手セッション識別子。 | |
| int64_t | peer_session_tv_sec |
| 追跡中の相手セッション開始時刻 秒部。 | |
| int32_t | peer_session_tv_nsec |
| 追跡中の相手セッション開始時刻 ナノ秒部。 | |
| int | peer_session_known |
| 相手セッションが初期化済みか (0: 未初期化)。 | |
| uint16_t | peer_port [POTR_MAX_PATH] |
| 各パスで観測した送信者ポート (NBO)。0 = 未観測。 | |
| int32_t | last_recv_tv_nsec |
| 最終受信時刻 ナノ秒部。 | |
| uint32_t | _pad_lastrecv |
| パディング (last_recv_tv_sec を 8 バイト境界に揃える)。 | |
| int64_t | last_recv_tv_sec |
| 最終受信時刻 秒部。0 = 未受信。 | |
| int64_t | path_last_recv_sec [POTR_MAX_PATH] |
| パスごとの最終受信時刻 秒部。0 = 未受信。 | |
| int32_t | path_last_recv_nsec [POTR_MAX_PATH] |
| パスごとの最終受信時刻 ナノ秒部。 | |
| size_t | frag_buf_len |
| フラグメント結合バッファの現在のデータ長 (バイト)。 | |
| int | frag_compressed |
| フラグメント受信中の圧縮フラグ (非 0: 圧縮あり)。 | |
| uint32_t | _pad_frag |
| パディング (frag_buf を 8 バイト境界に揃える)。 | |
| uint8_t * | frag_buf |
| フラグメント結合バッファ (動的確保。max_message_size バイト)。 | |
| uint8_t * | compress_buf |
| 圧縮・解凍用一時バッファ (動的確保)。 | |
| size_t | compress_buf_size |
| compress_buf のサイズ (バイト)。 | |
| uint8_t * | crypto_buf |
| 暗号化・復号用一時バッファ (動的確保)。 | |
| size_t | crypto_buf_size |
| crypto_buf のサイズ (バイト)。 | |
| uint8_t * | recv_buf |
| 受信バッファ / 再送 wire 組立バッファ (動的確保。PACKET_HEADER_SIZE + max_payload バイト)。 | |
| uint8_t * | send_wire_buf |
| 送信 wire 組立バッファ (動的確保。PACKET_HEADER_SIZE + max_payload バイト)。送信スレッドのみ使用。 | |
| PotrThread | send_thread |
| 送信スレッドハンドル。 | |
| volatile int | send_thread_running |
| 送信スレッド実行フラグ (1: 実行中, 0: 停止)。 | |
| uint32_t | _pad_send_thread |
| パディング (last_send_ms を 8 バイト境界に揃える)。 | |
| volatile uint64_t | last_send_ms |
| 最終パケット送信時刻 (データ or PING、ms、単調増加)。0 = 未送信。 | |
| PotrNackDedupEntry | nack_dedup_buf [POTR_NACK_DEDUP_SLOTS] |
| NACK 重複抑制エントリ配列。 | |
| uint8_t | nack_dedup_next |
| 次に書き込むスロットインデックス。 | |
| uint8_t | _pad_nack_dedup [7] |
| パディング (reorder フィールドを 4 バイト境界に揃える)。 | |
| int | reorder_pending |
| リオーダー待機中か (1: 待機中、0: 待機なし)。 | |
| uint32_t | reorder_nack_num |
| 待機中の欠番通番。 | |
| int64_t | reorder_deadline_sec |
| タイムアウト期限 秒部 (CLOCK_MONOTONIC)。 | |
| int32_t | reorder_deadline_nsec |
| タイムアウト期限 ナノ秒部。 | |
| uint32_t | _pad_reorder |
| パディング (send_queue を 8 バイト境界に揃える)。 | |
| PotrSendQueue | send_queue |
| 非同期送信キュー。 | |
| int | is_multi_peer |
| 1: N:1 モード (src_addr/src_port 省略), 0: 1:1 モード。 | |
| uint32_t | _pad_multi_peer |
| パディング (peers を 8 バイト境界に揃える)。 | |
| PotrPeerContext * | peers |
| ピアテーブル (動的確保。max_peers エントリ)。 | |
| int | max_peers |
| ピアテーブルサイズ (service.max_peers から取得)。 | |
| int | n_peers |
| 現在の接続ピア数。 | |
| PotrMutex | peers_mutex |
| ピアテーブル保護用ミューテックス。 | |
| uint32_t | next_peer_id |
| 次に発行するピア ID (単調増加、初期値 1)。 | |
| PotrSocket | tcp_listen_sock [POTR_MAX_PATH] |
| RECEIVER: listen ソケット (path ごと)。 | |
| PotrSocket | tcp_conn_fd [POTR_MAX_PATH] |
| アクティブ TCP 接続 fd (path ごと)。 | |
| volatile int | tcp_active_paths |
| アクティブ TCP path 数 (0 = 全切断)。 | |
| uint32_t | _pad_tcp_connected [2] |
| パディング (tcp_send_mutex を 8 バイト境界に揃える。8 バイト確保)。 | |
| PotrMutex | tcp_send_mutex [POTR_MAX_PATH] |
| TCP send() 排他制御 (path ごと)。送信スレッド・ヘルスチェックスレッド・recv スレッド競合防止。 | |
| PotrMutex | recv_window_mutex |
| recv_window 保護用ミューテックス。 | |
| PotrThread | connect_thread [POTR_MAX_PATH] |
| SENDER: connect スレッド。RECEIVER: accept スレッド。path ごと。 | |
| volatile int | connect_thread_running [POTR_MAX_PATH] |
| connect スレッド実行フラグ (1: 実行中, 0: 停止)。path ごと。 | |
| PotrMutex | tcp_state_mutex |
| tcp_state_cv 保護用ミューテックス。tcp_active_paths のカウンタ更新も保護。 | |
| PotrCondVar | tcp_state_cv |
| 切断通知・reconnect sleep の中断用条件変数。 | |
| volatile uint64_t | tcp_last_ping_recv_ms [POTR_MAX_PATH] |
| TCP PING 応答最終受信時刻 (ms, CLOCK_MONOTONIC 基準)。path ごと。接続確立時に現在時刻で初期化。 | |
| volatile uint64_t | tcp_last_ping_req_recv_ms [POTR_MAX_PATH] |
| TCP PING 要求最終受信時刻 (ms, CLOCK_MONOTONIC 基準)。path ごと。接続確立時に現在時刻で初期化。 | |
| int | buf_full_suppress_cnt [POTR_MAX_PATH] |
| path ごとの送信バッファ満杯ログ抑制カウンタ (0: 抑制なし、1-10: 抑制中)。 | |
| PotrMutex | session_establish_mutex |
| uint8_t * | tcp_first_pkt_buf [POTR_MAX_PATH] |
| 先読みパケットバッファ (動的確保、PACKET_HEADER_SIZE + max_payload バイト)。 | |
| size_t | tcp_first_pkt_len [POTR_MAX_PATH] |
| 先読みパケットのバイト数 (0: 先読みなし)。 | |
セッションコンテキスト構造体。PotrHandle の実体。
Definition at line 155 of file potrContext.h.
| PotrRecvCallback PotrContext_::callback |
受信コールバック。
Definition at line 157 of file potrContext.h.
Referenced by check_health_timeout(), deliver_payload_elem(), n1_check_health_timeout(), n1_deliver_payload_elem(), n1_notify_health_alive(), n1_recv_deliver(), notify_connected_tcp(), notify_health_alive(), potrDisconnectPeer(), potrOpenService(), raw_session_disconnect(), recv_deliver(), recv_thread_func(), and reset_all_paths_disconnected().
| PotrThread PotrContext_::recv_thread[POTR_MAX_PATH] |
受信スレッドハンドル (path ごと)。
Definition at line 158 of file potrContext.h.
Referenced by comm_recv_thread_start(), comm_recv_thread_stop(), join_recv_thread(), tcp_recv_thread_start(), and tcp_recv_thread_stop().
| PotrThread PotrContext_::health_thread[POTR_MAX_PATH] |
ヘルスチェックスレッドハンドル (path ごと、送信者のみ)。
Definition at line 159 of file potrContext.h.
Referenced by potr_health_thread_start(), potr_health_thread_stop(), potr_tcp_health_thread_start(), and potr_tcp_health_thread_stop().
| PotrMutex PotrContext_::health_mutex[POTR_MAX_PATH] |
ヘルスチェックスレッド停止用ミューテックス (path ごと)。
Definition at line 160 of file potrContext.h.
Referenced by flush_packed(), health_sleep(), potr_health_thread_start(), potr_health_thread_stop(), potr_tcp_health_thread_stop(), potrCloseService(), and potrOpenService().
| PotrCondVar PotrContext_::health_wakeup[POTR_MAX_PATH] |
ヘルスチェックスレッドを即時起床させる条件変数 (path ごと)。
Definition at line 161 of file potrContext.h.
Referenced by flush_packed(), health_sleep(), potr_health_thread_start(), potr_health_thread_stop(), potr_tcp_health_thread_stop(), potrCloseService(), and potrOpenService().
| PotrServiceDef PotrContext_::service |
サービス定義。
Definition at line 162 of file potrContext.h.
Referenced by check_and_update_session(), check_health_timeout(), check_reorder_timeout(), check_src_addr(), comm_recv_thread_start(), connect_thread_func(), drain_recv_window(), flush_packed(), flush_packed_peer(), health_thread_func(), n1_check_health_timeout(), n1_notify_health_alive(), n1_process_outer_pkt(), n1_recv_deliver(), n1_send_nack(), n1_send_ping_reply(), n1_send_reject(), notify_connected_tcp(), notify_health_alive(), open_socket_tcp_receiver(), open_socket_tcp_sender(), peer_create(), peer_free(), peer_path_clear(), peer_send_fin(), peer_table_destroy(), peer_table_init(), potr_connect_thread_start(), potr_connect_thread_stop(), potr_health_thread_start(), potr_tcp_health_thread_start(), potrCloseService(), potrDisconnectPeer(), potrOpenService(), potrSend(), process_outer_pkt(), raw_session_disconnect(), receiver_accept_loop(), recv_deliver(), recv_thread_func(), reorder_gap_ready(), reset_all_paths_disconnected(), send_fin(), send_nack(), send_packed_peer_mode(), send_ping_reply(), send_reject(), send_thread_func(), send_to_peer(), sender_connect_loop(), start_connected_threads(), stop_connected_threads(), tcp_connect_with_timeout(), tcp_health_thread_func(), tcp_recv_thread_func(), tcp_recv_thread_start(), tcp_send_ping_reply(), and update_path_recv().
| PotrGlobalConfig PotrContext_::global |
グローバル設定。
Definition at line 163 of file potrContext.h.
Referenced by check_and_update_session(), check_health_timeout(), check_reorder_timeout(), deliver_payload_elem(), health_thread_func(), n1_check_and_update_session(), n1_check_health_timeout(), n1_deliver_payload_elem(), peer_create(), potr_connect_thread_start(), potr_health_thread_start(), potr_tcp_health_thread_start(), potrOpenService(), potrSend(), receiver_accept_loop(), recv_thread_func(), reorder_gap_ready(), reset_send_queue(), send_packed_peer_mode(), send_thread_func(), send_to_peer(), tcp_health_thread_func(), and tcp_recv_thread_func().
| PotrWindow PotrContext_::send_window |
送信バッファ (過去 N パケット保持。NACK 再送・REJECT 判定に使用)。
Definition at line 164 of file potrContext.h.
Referenced by ctx_cleanup(), flush_packed(), health_thread_func(), potrCloseService(), potrOpenService(), recv_thread_func(), reset_all_paths_disconnected(), send_ping_reply(), tcp_health_thread_func(), and tcp_send_ping_reply().
| PotrMutex PotrContext_::send_window_mutex |
send_window 保護用ミューテックス (送信スレッド・ヘルスチェックスレッド・受信スレッドが競合するため)。
Definition at line 165 of file potrContext.h.
Referenced by flush_packed(), health_thread_func(), potr_send_thread_start(), potr_send_thread_stop(), recv_thread_func(), send_ping_reply(), tcp_health_thread_func(), and tcp_send_ping_reply().
| PotrWindow PotrContext_::recv_window |
受信ウィンドウ (順序整列・欠番検出)。
Definition at line 166 of file potrContext.h.
Referenced by check_and_update_session(), check_health_timeout(), check_reorder_timeout(), ctx_cleanup(), drain_recv_window(), potrCloseService(), potrOpenService(), process_outer_pkt(), recv_thread_func(), and tcp_recv_thread_func().
| PotrSocket PotrContext_::sock[POTR_MAX_PATH] |
各パスの UDP ソケット。
Definition at line 169 of file potrContext.h.
Referenced by cleanup_sockets(), comm_recv_thread_stop(), flush_packed(), flush_packed_peer(), health_thread_func(), n1_send_nack(), n1_send_ping_reply(), n1_send_reject(), peer_send_fin(), potrCloseService(), potrOpenService(), recv_thread_func(), send_fin(), send_nack(), send_ping_reply(), and send_reject().
| int PotrContext_::n_path |
有効パス数。
Definition at line 170 of file potrContext.h.
Referenced by check_health_timeout(), check_src_addr(), comm_recv_thread_stop(), flush_packed(), health_thread_func(), potr_connect_thread_start(), potr_connect_thread_stop(), potrCloseService(), potrOpenService(), receiver_accept_loop(), recv_thread_func(), send_fin(), send_nack(), send_ping_reply(), and send_reject().
| volatile int PotrContext_::running[POTR_MAX_PATH] |
受信スレッド実行フラグ (1: 実行中, 0: 停止)。path ごと。
Definition at line 172 of file potrContext.h.
Referenced by comm_recv_thread_start(), comm_recv_thread_stop(), potrCloseService(), receiver_accept_loop(), recv_thread_func(), start_connected_threads(), tcp_recv_thread_func(), tcp_recv_thread_start(), and tcp_recv_thread_stop().
| volatile int PotrContext_::health_running[POTR_MAX_PATH] |
ヘルスチェックスレッド実行フラグ (1: 実行中, 0: 停止)。path ごと。
Definition at line 173 of file potrContext.h.
Referenced by flush_packed(), health_sleep(), health_thread_func(), potr_health_thread_start(), potr_health_thread_stop(), potr_tcp_health_thread_start(), potr_tcp_health_thread_stop(), potrCloseService(), and tcp_health_thread_func().
| volatile int PotrContext_::health_alive |
疎通状態 (1: alive, 0: dead/未接続)。UDP 用。受信者が管理。
Definition at line 174 of file potrContext.h.
Referenced by check_health_timeout(), notify_connected_tcp(), notify_health_alive(), raw_session_disconnect(), recv_thread_func(), and reset_all_paths_disconnected().
| PotrRole PotrContext_::role |
役割 (POTR_ROLE_SENDER / POTR_ROLE_RECEIVER)。
Definition at line 175 of file potrContext.h.
Referenced by check_src_addr(), connect_thread_func(), potr_connect_thread_start(), potr_connect_thread_stop(), potrCloseService(), potrOpenService(), recv_thread_func(), start_connected_threads(), stop_connected_threads(), and tcp_recv_thread_func().
| struct in_addr PotrContext_::src_addr_resolved[POTR_MAX_PATH] |
解決済み送信元 IPv4 アドレス。
Definition at line 178 of file potrContext.h.
Referenced by check_src_addr(), open_socket_tcp_receiver(), open_socket_tcp_sender(), potrCloseService(), potrOpenService(), receiver_accept_loop(), send_nack(), and tcp_connect_with_timeout().
| struct in_addr PotrContext_::dst_addr_resolved[POTR_MAX_PATH] |
解決済み宛先 IPv4 アドレス (unicast のみ)。
Definition at line 179 of file potrContext.h.
Referenced by check_src_addr(), open_socket_tcp_receiver(), open_socket_tcp_sender(), potrOpenService(), and tcp_connect_with_timeout().
| struct sockaddr_in PotrContext_::dest_addr[POTR_MAX_PATH] |
送信先ソケットアドレス (送信者が sendto に使用)。
Definition at line 180 of file potrContext.h.
Referenced by check_health_timeout(), flush_packed(), health_thread_func(), potrOpenService(), recv_thread_func(), send_fin(), send_nack(), send_ping_reply(), send_reject(), and update_path_recv().
| uint32_t PotrContext_::session_id |
自セッション識別子 (乱数)。
Definition at line 183 of file potrContext.h.
Referenced by flush_packed(), generate_session(), health_thread_func(), send_fin(), send_nack(), send_ping_reply(), send_reject(), tcp_health_thread_func(), and tcp_send_ping_reply().
| int64_t PotrContext_::session_tv_sec |
自セッション開始時刻 秒部。
Definition at line 184 of file potrContext.h.
Referenced by flush_packed(), generate_session(), health_thread_func(), send_fin(), send_nack(), send_ping_reply(), send_reject(), tcp_health_thread_func(), and tcp_send_ping_reply().
| int32_t PotrContext_::session_tv_nsec |
自セッション開始時刻 ナノ秒部。
Definition at line 185 of file potrContext.h.
Referenced by flush_packed(), generate_session(), health_thread_func(), send_fin(), send_nack(), send_ping_reply(), send_reject(), tcp_health_thread_func(), and tcp_send_ping_reply().
| uint32_t PotrContext_::peer_session_id |
追跡中の相手セッション識別子。
Definition at line 188 of file potrContext.h.
Referenced by check_and_update_session(), receiver_accept_loop(), and tcp_session_compare().
| int64_t PotrContext_::peer_session_tv_sec |
追跡中の相手セッション開始時刻 秒部。
Definition at line 189 of file potrContext.h.
Referenced by check_and_update_session(), and tcp_session_compare().
| int32_t PotrContext_::peer_session_tv_nsec |
追跡中の相手セッション開始時刻 ナノ秒部。
Definition at line 190 of file potrContext.h.
Referenced by check_and_update_session(), and tcp_session_compare().
| int PotrContext_::peer_session_known |
相手セッションが初期化済みか (0: 未初期化)。
Definition at line 191 of file potrContext.h.
Referenced by check_and_update_session(), check_health_timeout(), check_reorder_timeout(), recv_thread_func(), reset_all_paths_disconnected(), reset_connection_state(), and tcp_session_compare().
| uint16_t PotrContext_::peer_port[POTR_MAX_PATH] |
各パスで観測した送信者ポート (NBO)。0 = 未観測。
Definition at line 194 of file potrContext.h.
Referenced by check_health_timeout(), send_nack(), and update_path_recv().
| int32_t PotrContext_::last_recv_tv_nsec |
最終受信時刻 ナノ秒部。
Definition at line 197 of file potrContext.h.
Referenced by check_health_timeout(), and update_path_recv().
| uint32_t PotrContext_::_pad_lastrecv |
パディング (last_recv_tv_sec を 8 バイト境界に揃える)。
Definition at line 198 of file potrContext.h.
| int64_t PotrContext_::last_recv_tv_sec |
最終受信時刻 秒部。0 = 未受信。
Definition at line 199 of file potrContext.h.
Referenced by check_health_timeout(), check_reorder_timeout(), recv_thread_func(), and update_path_recv().
| int64_t PotrContext_::path_last_recv_sec[POTR_MAX_PATH] |
パスごとの最終受信時刻 秒部。0 = 未受信。
Definition at line 202 of file potrContext.h.
Referenced by check_health_timeout(), and update_path_recv().
| int32_t PotrContext_::path_last_recv_nsec[POTR_MAX_PATH] |
パスごとの最終受信時刻 ナノ秒部。
Definition at line 203 of file potrContext.h.
Referenced by check_health_timeout(), and update_path_recv().
| size_t PotrContext_::frag_buf_len |
フラグメント結合バッファの現在のデータ長 (バイト)。
Definition at line 205 of file potrContext.h.
Referenced by deliver_payload_elem(), raw_session_disconnect(), reset_all_paths_disconnected(), and reset_connection_state().
| int PotrContext_::frag_compressed |
フラグメント受信中の圧縮フラグ (非 0: 圧縮あり)。
Definition at line 206 of file potrContext.h.
Referenced by deliver_payload_elem(), and raw_session_disconnect().
| uint32_t PotrContext_::_pad_frag |
パディング (frag_buf を 8 バイト境界に揃える)。
Definition at line 207 of file potrContext.h.
| uint8_t* PotrContext_::frag_buf |
フラグメント結合バッファ (動的確保。max_message_size バイト)。
Definition at line 208 of file potrContext.h.
Referenced by ctx_cleanup(), deliver_payload_elem(), potrCloseService(), and potrOpenService().
| uint8_t* PotrContext_::compress_buf |
圧縮・解凍用一時バッファ (動的確保)。
Definition at line 209 of file potrContext.h.
Referenced by ctx_cleanup(), n1_recv_deliver(), potrCloseService(), potrOpenService(), potrSend(), and recv_deliver().
| size_t PotrContext_::compress_buf_size |
compress_buf のサイズ (バイト)。
Definition at line 210 of file potrContext.h.
Referenced by n1_recv_deliver(), potrOpenService(), potrSend(), and recv_deliver().
| uint8_t* PotrContext_::crypto_buf |
暗号化・復号用一時バッファ (動的確保)。
Definition at line 211 of file potrContext.h.
Referenced by ctx_cleanup(), flush_packed(), flush_packed_peer(), potrCloseService(), potrOpenService(), recv_thread_func(), and tcp_recv_thread_func().
| size_t PotrContext_::crypto_buf_size |
crypto_buf のサイズ (バイト)。
Definition at line 212 of file potrContext.h.
Referenced by flush_packed(), flush_packed_peer(), potrOpenService(), recv_thread_func(), and tcp_recv_thread_func().
| uint8_t* PotrContext_::recv_buf |
受信バッファ / 再送 wire 組立バッファ (動的確保。PACKET_HEADER_SIZE + max_payload バイト)。
Definition at line 213 of file potrContext.h.
Referenced by ctx_cleanup(), potrCloseService(), potrOpenService(), recv_thread_func(), and tcp_recv_thread_func().
| uint8_t* PotrContext_::send_wire_buf |
送信 wire 組立バッファ (動的確保。PACKET_HEADER_SIZE + max_payload バイト)。送信スレッドのみ使用。
Definition at line 214 of file potrContext.h.
Referenced by ctx_cleanup(), flush_packed(), flush_packed_peer(), potrCloseService(), potrOpenService(), send_packed_peer_mode(), and send_thread_func().
| PotrThread PotrContext_::send_thread |
送信スレッドハンドル。
Definition at line 217 of file potrContext.h.
Referenced by potr_send_thread_start(), and potr_send_thread_stop().
| volatile int PotrContext_::send_thread_running |
送信スレッド実行フラグ (1: 実行中, 0: 停止)。
Definition at line 218 of file potrContext.h.
Referenced by potr_send_thread_start(), potr_send_thread_stop(), potrCloseService(), send_thread_func(), send_to_peer(), and start_connected_threads().
| uint32_t PotrContext_::_pad_send_thread |
パディング (last_send_ms を 8 バイト境界に揃える)。
Definition at line 219 of file potrContext.h.
| volatile uint64_t PotrContext_::last_send_ms |
最終パケット送信時刻 (データ or PING、ms、単調増加)。0 = 未送信。
Definition at line 220 of file potrContext.h.
Referenced by flush_packed(), flush_packed_peer(), and health_thread_func().
| PotrNackDedupEntry PotrContext_::nack_dedup_buf[POTR_NACK_DEDUP_SLOTS] |
| uint8_t PotrContext_::nack_dedup_next |
| uint8_t PotrContext_::_pad_nack_dedup[7] |
パディング (reorder フィールドを 4 バイト境界に揃える)。
Definition at line 225 of file potrContext.h.
| int PotrContext_::reorder_pending |
リオーダー待機中か (1: 待機中、0: 待機なし)。
Definition at line 228 of file potrContext.h.
Referenced by check_and_update_session(), check_health_timeout(), check_reorder_timeout(), process_outer_pkt(), recv_thread_func(), and reorder_gap_ready().
| uint32_t PotrContext_::reorder_nack_num |
待機中の欠番通番。
Definition at line 229 of file potrContext.h.
Referenced by check_reorder_timeout(), and reorder_gap_ready().
| int64_t PotrContext_::reorder_deadline_sec |
タイムアウト期限 秒部 (CLOCK_MONOTONIC)。
Definition at line 230 of file potrContext.h.
Referenced by reorder_gap_ready().
| int32_t PotrContext_::reorder_deadline_nsec |
| uint32_t PotrContext_::_pad_reorder |
パディング (send_queue を 8 バイト境界に揃える)。
Definition at line 232 of file potrContext.h.
| PotrSendQueue PotrContext_::send_queue |
非同期送信キュー。
Definition at line 234 of file potrContext.h.
Referenced by potr_send_thread_stop(), potrCloseService(), potrOpenService(), reset_send_queue(), send_packed_peer_mode(), send_thread_func(), and send_to_peer().
| int PotrContext_::is_multi_peer |
1: N:1 モード (src_addr/src_port 省略), 0: 1:1 モード。
Definition at line 237 of file potrContext.h.
Referenced by check_src_addr(), ctx_cleanup(), health_thread_func(), potrCloseService(), potrDisconnectPeer(), potrOpenService(), potrSend(), recv_thread_func(), and send_thread_func().
| uint32_t PotrContext_::_pad_multi_peer |
パディング (peers を 8 バイト境界に揃える)。
Definition at line 238 of file potrContext.h.
| PotrPeerContext* PotrContext_::peers |
ピアテーブル (動的確保。max_peers エントリ)。
Definition at line 239 of file potrContext.h.
Referenced by allocate_peer_id(), ctx_cleanup(), health_thread_func(), n1_check_health_timeout(), peer_create(), peer_find_by_id(), peer_find_by_session(), peer_table_destroy(), peer_table_init(), potrCloseService(), and potrSend().
| int PotrContext_::max_peers |
ピアテーブルサイズ (service.max_peers から取得)。
Definition at line 240 of file potrContext.h.
Referenced by allocate_peer_id(), health_thread_func(), n1_check_health_timeout(), peer_create(), peer_find_by_id(), peer_find_by_session(), peer_table_destroy(), peer_table_init(), potrOpenService(), and potrSend().
| int PotrContext_::n_peers |
現在の接続ピア数。
Definition at line 241 of file potrContext.h.
Referenced by peer_create(), peer_free(), peer_table_destroy(), and peer_table_init().
| PotrMutex PotrContext_::peers_mutex |
ピアテーブル保護用ミューテックス。
Definition at line 242 of file potrContext.h.
Referenced by health_thread_func(), n1_check_health_timeout(), peer_table_destroy(), peer_table_init(), potrDisconnectPeer(), potrSend(), recv_thread_func(), and send_packed_peer_mode().
| uint32_t PotrContext_::next_peer_id |
次に発行するピア ID (単調増加、初期値 1)。
Definition at line 243 of file potrContext.h.
Referenced by allocate_peer_id(), and peer_table_init().
| PotrSocket PotrContext_::tcp_listen_sock[POTR_MAX_PATH] |
RECEIVER: listen ソケット (path ごと)。
Definition at line 246 of file potrContext.h.
Referenced by ctx_cleanup(), open_socket_tcp_receiver(), potr_connect_thread_stop(), potrOpenService(), and receiver_accept_loop().
| PotrSocket PotrContext_::tcp_conn_fd[POTR_MAX_PATH] |
アクティブ TCP 接続 fd (path ごと)。
Definition at line 247 of file potrContext.h.
Referenced by close_tcp_conn(), ctx_cleanup(), flush_packed(), potr_connect_thread_stop(), potrOpenService(), receiver_accept_loop(), sender_connect_loop(), tcp_health_thread_func(), tcp_recv_thread_func(), and tcp_send_ping_reply().
| volatile int PotrContext_::tcp_active_paths |
アクティブ TCP path 数 (0 = 全切断)。
Definition at line 248 of file potrContext.h.
Referenced by flush_packed(), potrSend(), receiver_accept_loop(), sender_connect_loop(), and tcp_health_thread_func().
| uint32_t PotrContext_::_pad_tcp_connected[2] |
パディング (tcp_send_mutex を 8 バイト境界に揃える。8 バイト確保)。
Definition at line 249 of file potrContext.h.
| PotrMutex PotrContext_::tcp_send_mutex[POTR_MAX_PATH] |
TCP send() 排他制御 (path ごと)。送信スレッド・ヘルスチェックスレッド・recv スレッド競合防止。
Definition at line 250 of file potrContext.h.
Referenced by flush_packed(), potrCloseService(), potrOpenService(), tcp_health_thread_func(), and tcp_send_ping_reply().
| PotrMutex PotrContext_::recv_window_mutex |
recv_window 保護用ミューテックス。
Definition at line 253 of file potrContext.h.
Referenced by potrCloseService(), potrOpenService(), and tcp_recv_thread_func().
| PotrThread PotrContext_::connect_thread[POTR_MAX_PATH] |
SENDER: connect スレッド。RECEIVER: accept スレッド。path ごと。
Definition at line 256 of file potrContext.h.
Referenced by potr_connect_thread_start(), and potr_connect_thread_stop().
| volatile int PotrContext_::connect_thread_running[POTR_MAX_PATH] |
connect スレッド実行フラグ (1: 実行中, 0: 停止)。path ごと。
Definition at line 257 of file potrContext.h.
Referenced by connect_thread_func(), potr_connect_thread_start(), potr_connect_thread_stop(), receiver_accept_loop(), reconnect_wait(), and sender_connect_loop().
| PotrMutex PotrContext_::tcp_state_mutex |
tcp_state_cv 保護用ミューテックス。tcp_active_paths のカウンタ更新も保護。
Definition at line 260 of file potrContext.h.
Referenced by notify_connected_tcp(), potr_connect_thread_stop(), potrCloseService(), potrOpenService(), receiver_accept_loop(), reconnect_wait(), and sender_connect_loop().
| PotrCondVar PotrContext_::tcp_state_cv |
切断通知・reconnect sleep の中断用条件変数。
Definition at line 261 of file potrContext.h.
Referenced by potr_connect_thread_stop(), potrCloseService(), potrOpenService(), and reconnect_wait().
| volatile uint64_t PotrContext_::tcp_last_ping_recv_ms[POTR_MAX_PATH] |
TCP PING 応答最終受信時刻 (ms, CLOCK_MONOTONIC 基準)。path ごと。接続確立時に現在時刻で初期化。
Definition at line 264 of file potrContext.h.
Referenced by receiver_accept_loop(), sender_connect_loop(), tcp_health_thread_func(), and tcp_recv_thread_func().
| volatile uint64_t PotrContext_::tcp_last_ping_req_recv_ms[POTR_MAX_PATH] |
TCP PING 要求最終受信時刻 (ms, CLOCK_MONOTONIC 基準)。path ごと。接続確立時に現在時刻で初期化。
Definition at line 267 of file potrContext.h.
Referenced by receiver_accept_loop(), sender_connect_loop(), and tcp_recv_thread_func().
| int PotrContext_::buf_full_suppress_cnt[POTR_MAX_PATH] |
path ごとの送信バッファ満杯ログ抑制カウンタ (0: 抑制なし、1-10: 抑制中)。
Definition at line 270 of file potrContext.h.
Referenced by flush_packed().
| PotrMutex PotrContext_::session_establish_mutex |
Definition at line 275 of file potrContext.h.
Referenced by potr_connect_thread_start(), potr_connect_thread_stop(), and receiver_accept_loop().
| uint8_t* PotrContext_::tcp_first_pkt_buf[POTR_MAX_PATH] |
先読みパケットバッファ (動的確保、PACKET_HEADER_SIZE + max_payload バイト)。
Definition at line 282 of file potrContext.h.
Referenced by potr_connect_thread_start(), potr_connect_thread_stop(), receiver_accept_loop(), and tcp_recv_thread_func().
| size_t PotrContext_::tcp_first_pkt_len[POTR_MAX_PATH] |
先読みパケットのバイト数 (0: 先読みなし)。
Definition at line 283 of file potrContext.h.
Referenced by potr_connect_thread_start(), potr_connect_thread_stop(), receiver_accept_loop(), and tcp_recv_thread_func().