1cc290419Sopenharmony_ci/* 2cc290419Sopenharmony_ci * Copyright (C) 2021 Huawei Device Co., Ltd. 3cc290419Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4cc290419Sopenharmony_ci * you may not use this file except in compliance with the License. 5cc290419Sopenharmony_ci * You may obtain a copy of the License at 6cc290419Sopenharmony_ci * 7cc290419Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8cc290419Sopenharmony_ci * 9cc290419Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10cc290419Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11cc290419Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12cc290419Sopenharmony_ci * See the License for the specific language governing permissions and 13cc290419Sopenharmony_ci * limitations under the License. 14cc290419Sopenharmony_ci */ 15cc290419Sopenharmony_ci#ifndef HDC_SERIAL_STRUCT_H 16cc290419Sopenharmony_ci#define HDC_SERIAL_STRUCT_H 17cc290419Sopenharmony_ci#include "common.h" 18cc290419Sopenharmony_ci#include "serial_struct_define.h" 19cc290419Sopenharmony_ci#include "transfer.h" 20cc290419Sopenharmony_ci 21cc290419Sopenharmony_cinamespace Hdc { 22cc290419Sopenharmony_cinamespace SerialStruct { 23cc290419Sopenharmony_ci constexpr int fieldOne = 1; 24cc290419Sopenharmony_ci constexpr int fieldTwo = 2; 25cc290419Sopenharmony_ci constexpr int fieldThree = 3; 26cc290419Sopenharmony_ci constexpr int fieldFour = 4; 27cc290419Sopenharmony_ci constexpr int fieldFive = 5; 28cc290419Sopenharmony_ci constexpr int fieldSix = 6; 29cc290419Sopenharmony_ci constexpr int fieldSeven = 7; 30cc290419Sopenharmony_ci constexpr int fieldEight = 8; 31cc290419Sopenharmony_ci constexpr int fieldNine = 9; 32cc290419Sopenharmony_ci constexpr int fieldTen = 10; 33cc290419Sopenharmony_ci constexpr int field11 = 11; 34cc290419Sopenharmony_ci constexpr int field12 = 12; 35cc290419Sopenharmony_ci constexpr int field13 = 13; 36cc290419Sopenharmony_ci 37cc290419Sopenharmony_ci template<> struct Descriptor<Hdc::HdcTransferBase::TransferConfig> { 38cc290419Sopenharmony_ci static auto type() 39cc290419Sopenharmony_ci { 40cc290419Sopenharmony_ci return Message(Field<fieldOne, &Hdc::HdcTransferBase::TransferConfig::fileSize>("fileSize"), 41cc290419Sopenharmony_ci Field<fieldTwo, &Hdc::HdcTransferBase::TransferConfig::atime>("atime"), 42cc290419Sopenharmony_ci Field<fieldThree, &Hdc::HdcTransferBase::TransferConfig::mtime>("mtime"), 43cc290419Sopenharmony_ci Field<fieldFour, &Hdc::HdcTransferBase::TransferConfig::options>("options"), 44cc290419Sopenharmony_ci Field<fieldFive, &Hdc::HdcTransferBase::TransferConfig::path>("path"), 45cc290419Sopenharmony_ci Field<fieldSix, &Hdc::HdcTransferBase::TransferConfig::optionalName>("optionalName"), 46cc290419Sopenharmony_ci Field<fieldSeven, &Hdc::HdcTransferBase::TransferConfig::updateIfNew>("updateIfNew"), 47cc290419Sopenharmony_ci Field<fieldEight, &Hdc::HdcTransferBase::TransferConfig::compressType>("compressType"), 48cc290419Sopenharmony_ci Field<fieldNine, &Hdc::HdcTransferBase::TransferConfig::holdTimestamp>("holdTimestamp"), 49cc290419Sopenharmony_ci Field<fieldTen, &Hdc::HdcTransferBase::TransferConfig::functionName>("functionName"), 50cc290419Sopenharmony_ci Field<field11, &Hdc::HdcTransferBase::TransferConfig::clientCwd>("clientCwd"), 51cc290419Sopenharmony_ci Field<field12, &Hdc::HdcTransferBase::TransferConfig::reserve1>("reserve1"), 52cc290419Sopenharmony_ci Field<field13, &Hdc::HdcTransferBase::TransferConfig::reserve2>("reserve2")); 53cc290419Sopenharmony_ci } 54cc290419Sopenharmony_ci }; 55cc290419Sopenharmony_ci 56cc290419Sopenharmony_ci template<> struct Descriptor<Hdc::HdcTransferBase::FileMode> { 57cc290419Sopenharmony_ci static auto type() 58cc290419Sopenharmony_ci { 59cc290419Sopenharmony_ci return Message(Field<fieldOne, &Hdc::HdcTransferBase::FileMode::perm>("perm"), 60cc290419Sopenharmony_ci Field<fieldTwo, &Hdc::HdcTransferBase::FileMode::uId>("uId"), 61cc290419Sopenharmony_ci Field<fieldThree, &Hdc::HdcTransferBase::FileMode::gId>("gId"), 62cc290419Sopenharmony_ci Field<fieldFour, &Hdc::HdcTransferBase::FileMode::context>("context"), 63cc290419Sopenharmony_ci Field<fieldFive, &Hdc::HdcTransferBase::FileMode::fullName>("fullName")); 64cc290419Sopenharmony_ci } 65cc290419Sopenharmony_ci }; 66cc290419Sopenharmony_ci 67cc290419Sopenharmony_ci template<> struct Descriptor<Hdc::HdcTransferBase::TransferPayload> { 68cc290419Sopenharmony_ci static auto type() 69cc290419Sopenharmony_ci { 70cc290419Sopenharmony_ci return Message(Field<fieldOne, &Hdc::HdcTransferBase::TransferPayload::index>("index"), 71cc290419Sopenharmony_ci Field<fieldTwo, &Hdc::HdcTransferBase::TransferPayload::compressType>("compressType"), 72cc290419Sopenharmony_ci Field<fieldThree, &Hdc::HdcTransferBase::TransferPayload::compressSize>("compressSize"), 73cc290419Sopenharmony_ci Field<fieldFour, &Hdc::HdcTransferBase::TransferPayload::uncompressSize>("uncompressSize")); 74cc290419Sopenharmony_ci } 75cc290419Sopenharmony_ci }; 76cc290419Sopenharmony_ci 77cc290419Sopenharmony_ci template<> struct Descriptor<Hdc::HdcSessionBase::SessionHandShake> { 78cc290419Sopenharmony_ci static auto type() 79cc290419Sopenharmony_ci { 80cc290419Sopenharmony_ci return Message(Field<fieldOne, &Hdc::HdcSessionBase::SessionHandShake::banner>("banner"), 81cc290419Sopenharmony_ci Field<fieldTwo, &Hdc::HdcSessionBase::SessionHandShake::authType>("authType"), 82cc290419Sopenharmony_ci Field<fieldThree, &Hdc::HdcSessionBase::SessionHandShake::sessionId>("sessionId"), 83cc290419Sopenharmony_ci Field<fieldFour, &Hdc::HdcSessionBase::SessionHandShake::connectKey>("connectKey"), 84cc290419Sopenharmony_ci Field<fieldFive, &Hdc::HdcSessionBase::SessionHandShake::buf>("buf"), 85cc290419Sopenharmony_ci Field<fieldSix, &Hdc::HdcSessionBase::SessionHandShake::version>("version")); 86cc290419Sopenharmony_ci } 87cc290419Sopenharmony_ci }; 88cc290419Sopenharmony_ci 89cc290419Sopenharmony_ci template<> struct Descriptor<Hdc::HdcSessionBase::PayloadProtect> { 90cc290419Sopenharmony_ci static auto type() 91cc290419Sopenharmony_ci { 92cc290419Sopenharmony_ci return Message(Field<fieldOne, &Hdc::HdcSessionBase::PayloadProtect::channelId>("channelId"), 93cc290419Sopenharmony_ci Field<fieldTwo, &Hdc::HdcSessionBase::PayloadProtect::commandFlag>("commandFlag"), 94cc290419Sopenharmony_ci Field<fieldThree, &Hdc::HdcSessionBase::PayloadProtect::checkSum>("checkSum"), 95cc290419Sopenharmony_ci Field<fieldFour, &Hdc::HdcSessionBase::PayloadProtect::vCode>("vCode")); 96cc290419Sopenharmony_ci } 97cc290419Sopenharmony_ci }; 98cc290419Sopenharmony_ci} // SerialStruct 99cc290419Sopenharmony_ci} // Hdc 100cc290419Sopenharmony_ci#endif // HDC_SERIAL_STRUCT_H 101