Document of c-modernization-kit (porter) 1.0.0
Loading...
Searching...
No Matches
PotrPacket Struct Reference

ネットワーク送受信用パケット構造体。 More...

#include <porter_type.h>

Collaboration diagram for PotrPacket:

Data Fields

int64_t service_id
 サービス識別子 (NBO)。受信時に照合する。
int64_t session_tv_sec
 セッション開始時刻 秒部 (NBO)。struct timespec の tv_sec 相当。
uint32_t session_id
 セッション識別子 (NBO)。potrOpenService 時に決定する乱数。
int32_t session_tv_nsec
 セッション開始時刻 ナノ秒部 (NBO)。struct timespec の tv_nsec 相当。
uint32_t seq_num
 通番。送信側が付与する連番 (NBO)。
uint32_t ack_num
 再送要求番号 / 再送不能通番 (NBO)。NACK では要求通番、REJECT では再送不能通番を格納する。
uint16_t flags
 パケット種別フラグ (POTR_FLAG_*) (NBO)。
uint16_t payload_len
 ペイロード長 (バイト) (NBO)。
uint32_t _reserved
 パディング (payload ポインタを 8 バイト境界に揃える)。
const uint8_t * payload
 ペイロードデータへのポインタ (読み取り専用)。ウィンドウプールまたは受信バッファ内を指す。

Detailed Description

ネットワーク送受信用パケット構造体。

UDP で送受信される物理パケットのレイアウトです。
各フィールドはネットワークバイトオーダー (ビッグエンディアン) で格納します。
ヘッダー固定長: offsetof(PotrPacket, payload) = 40 バイト (64 ビット環境)。
payload フィールドはポインタであり、wire データとして直接 sendto に渡せません。
送信時は PotrContext_ の send_wire_buf / recv_buf に wire データを組み立ててください。

ワイヤーフォーマット (バイトオフセット):

0: service_id (int64_t, 8 bytes)
8: session_tv_sec (int64_t, 8 bytes)
16: session_id (uint32_t, 4 bytes)
20: session_tv_nsec (int32_t, 4 bytes)
24: seq_num (uint32_t, 4 bytes)
28: ack_num (uint32_t, 4 bytes)
32: flags (uint16_t, 2 bytes)
34: payload_len (uint16_t, 2 bytes)
36: _reserved (uint32_t, 4 bytes, padding)
40: payload (pointer)
uint32_t _reserved
パディング (payload ポインタを 8 バイト境界に揃える)。
uint32_t ack_num
再送要求番号 / 再送不能通番 (NBO)。NACK では要求通番、REJECT では再送不能通番を格納する。
int64_t session_tv_sec
セッション開始時刻 秒部 (NBO)。struct timespec の tv_sec 相当。
uint32_t session_id
セッション識別子 (NBO)。potrOpenService 時に決定する乱数。
uint16_t flags
パケット種別フラグ (POTR_FLAG_*) (NBO)。
const uint8_t * payload
ペイロードデータへのポインタ (読み取り専用)。ウィンドウプールまたは受信バッファ内を指す。
int32_t session_tv_nsec
セッション開始時刻 ナノ秒部 (NBO)。struct timespec の tv_nsec 相当。
uint32_t seq_num
通番。送信側が付与する連番 (NBO)。
int64_t service_id
サービス識別子 (NBO)。受信時に照合する。
uint16_t payload_len
ペイロード長 (バイト) (NBO)。

Definition at line 215 of file porter_type.h.

Field Documentation

◆ service_id

int64_t PotrPacket::service_id

サービス識別子 (NBO)。受信時に照合する。

Definition at line 217 of file porter_type.h.

Referenced by fill_session_hdr(), packet_parse(), packet_unpack_next(), recv_thread_func(), and tcp_recv_thread_func().

◆ session_tv_sec

int64_t PotrPacket::session_tv_sec

セッション開始時刻 秒部 (NBO)。struct timespec の tv_sec 相当。

Definition at line 218 of file porter_type.h.

Referenced by check_and_update_session(), fill_session_hdr(), n1_check_and_update_session(), packet_parse(), packet_unpack_next(), recv_thread_func(), and tcp_session_compare().

◆ session_id

◆ session_tv_nsec

int32_t PotrPacket::session_tv_nsec

セッション開始時刻 ナノ秒部 (NBO)。struct timespec の tv_nsec 相当。

Definition at line 220 of file porter_type.h.

Referenced by check_and_update_session(), fill_session_hdr(), n1_check_and_update_session(), packet_parse(), packet_unpack_next(), recv_thread_func(), and tcp_session_compare().

◆ seq_num

◆ ack_num

uint32_t PotrPacket::ack_num

再送要求番号 / 再送不能通番 (NBO)。NACK では要求通番、REJECT では再送不能通番を格納する。

Definition at line 222 of file porter_type.h.

Referenced by n1_send_nack(), n1_send_reject(), packet_build_fin(), packet_build_nack(), packet_build_packed(), packet_build_ping(), packet_build_reject(), packet_parse(), packet_unpack_next(), recv_thread_func(), send_nack(), send_reject(), and tcp_recv_thread_func().

◆ flags

◆ payload_len

◆ _reserved

uint32_t PotrPacket::_reserved

パディング (payload ポインタを 8 バイト境界に揃える)。

Definition at line 225 of file porter_type.h.

◆ payload

const uint8_t* PotrPacket::payload

ペイロードデータへのポインタ (読み取り専用)。ウィンドウプールまたは受信バッファ内を指す。

Definition at line 226 of file porter_type.h.

Referenced by deliver_payload_elem(), n1_deliver_payload_elem(), packet_build_fin(), packet_build_nack(), packet_build_packed(), packet_build_ping(), packet_build_reject(), packet_parse(), packet_unpack_next(), recv_thread_func(), tcp_recv_thread_func(), window_init(), window_recv_push(), and window_send_push().


The documentation for this struct was generated from the following file: