From bfde0e603051a1744ec063e8587057dcebf8d06d Mon Sep 17 00:00:00 2001 From: cheoljun99 Date: Thu, 21 May 2026 19:41:23 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat=20:=20=ED=86=B5=EC=8B=A0=20=EA=B3=84?= =?UTF-8?q?=EC=B8=B5=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/protocol/comm_header.h | 55 +++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/include/protocol/comm_header.h b/include/protocol/comm_header.h index cd90e9d..155f8f7 100644 --- a/include/protocol/comm_header.h +++ b/include/protocol/comm_header.h @@ -5,39 +5,46 @@ #include enum class CommType : uint8_t { - NORMAL_DATA = 0x01, - RELIABLE_DATA = 0x02, - ACK = 0x03, - BIG_DATA = 0x04 + NORMAL_DATA = 0x01, // 일반 전송 + RELIABLE_DATA = 0x02, // 신뢰성 전송 + ACK = 0x03, // 신뢰성 ACK + BIG_DATA = 0x04, // 대용량 전송 }; + #pragma pack(push, 1) struct CommHeader { CommType type; // 통신 유형 (일반 데이터) - DeviceId src_device_id; // 신뢰성 통신을 위한 출발지 디바이스 ID - DeviceId dst_device_id; // 신뢰성 통신을 위한 목적지 디바이스 ID - uint16_t total_length; // 헤더 + 데이터의 총 길이 (최대 65535) - uint16_t data_length; // 데이터의 길이 (최대 65535) + DeviceId src_device_id; // 출발지 디바이스 ID + DeviceId dst_device_id; // 목적지 디바이스 ID + uint16_t total_length; // 프로토콜 헤더 + 페이로드 전체 크기 + uint16_t data_length; // 페이로드 크기(DTO 크기) }; + struct ReliableCommHeader { - CommType type; // 통신 유형 (신뢰성 있는 데이터,ACK) - DeviceId src_device_id; // 신뢰성 통신을 위한 출발지 디바이스 ID - DeviceId dst_device_id; // 신뢰성 통신을 위한 목적지 디바이스 ID - uint32_t reliable_session_unique_key; // 신뢰성 있는 통신을 위한 신뢰성 세션 고유 키 (랜덤값) + CommType type; // 통신 유형 (신뢰성 데이터,ACK) + DeviceId src_device_id; // 출발지 디바이스 ID + DeviceId dst_device_id; // 목적지 디바이스 ID + uint16_t total_length; // 프로토콜 헤더 + 페이로드 전체 크기 + uint16_t data_length; // 페이로드 크기(DTO 크기) + uint32_t reliable_session_unique_key; + //신뢰성 통신을 위한 디바이스 고유키 + //RELIABLE DATA 일때는 출발지 디바이스 고유키가 담김 + //ACK 일때는 목적지 디바이스 고유키가 담김 uint8_t sequence_number; // 신뢰성 통신을 위한 시퀀스 넘버 - uint16_t total_length; // 헤더 + 데이터의 총 길이 (최대 65535) - uint16_t data_length; // 데이터의 길이 (최대 65535) }; + struct BigCommHeader { - CommType type; // 1B - CommType::BIG_DATA - DeviceId src_device_id; // 2B - DeviceId dst_device_id; // 2B - uint32_t message_id; // 4B - 큰 메시지의 고유 ID - uint16_t chunk_index; // 2B - 이 조각이 몇 번째 (0-based) - uint16_t total_chunks; // 2B - 전체 조각 수 - uint32_t total_data_length; // 4B - 원본 데이터 전체 크기 - uint16_t chunk_data_length; // 2B - 이 조각의 payload 크기 - uint16_t total_length; // 2B - 헤더+이 조각 payload 크기 -}; + CommType type; // 통신 유형 (대용량 데이터) + DeviceId src_device_id; // 출발지 디바이스 ID + DeviceId dst_device_id; // 목적지 디바이스 ID + uint16_t total_length; // 프로토콜 헤더 + 해당 조각의 페이로드 전체 크기 + uint16_t chunk_data_length; // 이 조각의 페이로드 크기 + uint32_t message_id; // 큰 메시지의 고유 ID + uint32_t total_data_length; // 원본 페이로드 전체 크기 + uint16_t total_chunks; // 전체 조각 수 + uint16_t chunk_index; // 해당 조각의 인덱스 (0-based) +}; + #pragma pack(pop) #endif // COMM_HEADER_H \ No newline at end of file From 6c045fbd054f01f4e21805aa149201606969f1ea Mon Sep 17 00:00:00 2001 From: cheoljun99 Date: Mon, 25 May 2026 19:15:08 +0900 Subject: [PATCH 2/2] =?UTF-8?q?edit=20:=20=ED=86=B5=EC=8B=A0=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=ED=86=A0=EC=BD=9C=20=EC=88=98=EC=A0=95=20excel=20?= =?UTF-8?q?=EB=AC=B8=EC=84=9C=EB=B0=98=EC=98=81=20=EC=99=84=EB=A3=8C=20?= =?UTF-8?q?=EB=B0=8F=20=ED=97=A4=EB=8D=94=20=EA=B5=AC=EC=A1=B0=EC=B2=B4=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/protocol/comm_header.h | 42 ++++++++++++++++------------------ 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/include/protocol/comm_header.h b/include/protocol/comm_header.h index 155f8f7..ae75042 100644 --- a/include/protocol/comm_header.h +++ b/include/protocol/comm_header.h @@ -4,47 +4,45 @@ #include "enum/device_id.h" #include -enum class CommType : uint8_t { - NORMAL_DATA = 0x01, // 일반 전송 - RELIABLE_DATA = 0x02, // 신뢰성 전송 - ACK = 0x03, // 신뢰성 ACK - BIG_DATA = 0x04, // 대용량 전송 +enum class TypeFlag : uint8_t { + NONE = 0x00, // 0000 0000 일반 전송 (fire and forget) + RELIABLE = 0x01, // 0000 0001 신뢰성 전송 (stop and wait arq) + BIG_DATA = 0x02, // 0000 0010 대용량 데이터 (chunked transfer with reassembly) + // 0x04 향후 확장가능 +}; + +enum class ReliableFlag : uint8_t { + DATA = 0x00, // 0000 0000 신뢰성 데이터 + ACK = 0x01, // 0000 0001 ACK + // 0x02 향후 확장 + // 0x04 향후 확장가능 }; #pragma pack(push, 1) -struct CommHeader { - CommType type; // 통신 유형 (일반 데이터) +struct BaseHeader { DeviceId src_device_id; // 출발지 디바이스 ID DeviceId dst_device_id; // 목적지 디바이스 ID uint16_t total_length; // 프로토콜 헤더 + 페이로드 전체 크기 - uint16_t data_length; // 페이로드 크기(DTO 크기) + TypeFlag flags; // 통신 유형 플래그 (비신뢰성 통신, 신뢰성 통신, 대용량 데이터 통신) }; -struct ReliableCommHeader { - CommType type; // 통신 유형 (신뢰성 데이터,ACK) - DeviceId src_device_id; // 출발지 디바이스 ID - DeviceId dst_device_id; // 목적지 디바이스 ID - uint16_t total_length; // 프로토콜 헤더 + 페이로드 전체 크기 - uint16_t data_length; // 페이로드 크기(DTO 크기) - uint32_t reliable_session_unique_key; +struct ReliableExHeader { + uint32_t reliable_channel_unique_key; //신뢰성 통신을 위한 디바이스 고유키 //RELIABLE DATA 일때는 출발지 디바이스 고유키가 담김 //ACK 일때는 목적지 디바이스 고유키가 담김 uint8_t sequence_number; // 신뢰성 통신을 위한 시퀀스 넘버 + ReliableFlag flags; //신뢰성 통신 유형 플래그 (DATA, ACK) }; -struct BigCommHeader { - CommType type; // 통신 유형 (대용량 데이터) - DeviceId src_device_id; // 출발지 디바이스 ID - DeviceId dst_device_id; // 목적지 디바이스 ID - uint16_t total_length; // 프로토콜 헤더 + 해당 조각의 페이로드 전체 크기 - uint16_t chunk_data_length; // 이 조각의 페이로드 크기 +struct BigDataExHeader { uint32_t message_id; // 큰 메시지의 고유 ID uint32_t total_data_length; // 원본 페이로드 전체 크기 uint16_t total_chunks; // 전체 조각 수 uint16_t chunk_index; // 해당 조각의 인덱스 (0-based) + uint16_t chunk_data_length; // 이 조각의 페이로드 크기 }; #pragma pack(pop) -#endif // COMM_HEADER_H \ No newline at end of file +#endif // COMM_HEADER_H