Files
2026-08-07 17:38:18 +09:00

63 lines
2.1 KiB
C

/***************************************************************************
cc_collectd 통신 관련 protocol header
-----------------------------------------
begin : 2014/09/25
copyright : (C) 2005 Solbox Inc.
author : Storage Dev Team
email : storage.sd@solbox.com
version : 3.4
CopyRight(C) 2005 Solbox Inc. All Rights reserved.
Redistribution and use in source and binary forms, with or with out
modification, are not permitted in outside of Solbox Inc.
***************************************************************************/
#ifndef __CC_COLLECTD_PROTOCOL_H__
#define __CC_COLLECTD_PROTOCOL_H__
// cc_collectd 에서 사용할 통신 Header 구조체
// - 계산상 크기는 16Byte 이지만...
// - 통신상 sizeof() : 20Byte ( 64Bit OS )
struct CcCollectdPacketHeader {
char stx; // Packet 유효성 관리 코드
char type; // Request or Response 여부 ( 0x00: Request, 0x01: Response )
char command[4]; // Command Code ( 4 Byte) : 0th client-cc_collectd 간 사용, 그외는 미사용.
char result[4]; // Result Code ( 4 Byte )
unsigned int data_length; // Packet Data 부분의 길이값 ( Network Byte Order 사용)
char extend_code[2]; // 확장 및 Padding bits ( 2 Byte )
};
// Packet Header stx 코드
#define HEADER_STX_CODE 0x04
// Packet Header type 구분코드
#define HEADER_TYPE_REQUEST 0x00
#define HEADER_TYPE_RESPONSE 0x01
// Packet command 공통.
#define COMMON_ALIVE_CHECK 0x7F
// Packet command
// client <-> cc_collect 통신 (command 0th byte 만 사용)
#define REQUEST_NOT_VALID 0x00 // 유효하지 않은 요청.
#define REQUEST_AVAILABLE_SIZE 0x01 // Client 에서 전송 가능한 Available Size 요청
#define REQUEST_FILE_SAVE 0x02 // Client 에서 저장 목적의 File 전송
#define REQUEST_FILE_CHECK 0x03 // Client 에서 File 존재 여부 확인 요청
// Packet Result
// => type이 Response 인 경우에만 세팅됨.( 0th Byte 만 사용시 )
#define HEADER_RESULT_SUCCESS 0x00
#define HEADER_RESULT_ERROR 0x01
// 기타 정보
#define LENGTH_FIELD_SIZE 4 // 가변데이터 형식 사용시 Length 필드의 메모리 크기 (unsigned int)
#endif /* __CC_COLLECTD_PROTOCOL_H__ */