13f085823Sopenharmony_ci/*
23f085823Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
33f085823Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
43f085823Sopenharmony_ci * you may not use this file except in compliance with the License.
53f085823Sopenharmony_ci * You may obtain a copy of the License at
63f085823Sopenharmony_ci *
73f085823Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
83f085823Sopenharmony_ci *
93f085823Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
103f085823Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
113f085823Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
123f085823Sopenharmony_ci * See the License for the specific language governing permissions and
133f085823Sopenharmony_ci * limitations under the License.
143f085823Sopenharmony_ci */
153f085823Sopenharmony_ci
163f085823Sopenharmony_ci#ifndef AW_CXX_DISTRIBUTED_DISTRIBUTED_H_
173f085823Sopenharmony_ci#define AW_CXX_DISTRIBUTED_DISTRIBUTED_H_
183f085823Sopenharmony_ci
193f085823Sopenharmony_ci#include <iostream>
203f085823Sopenharmony_ci#include "securec.h"
213f085823Sopenharmony_ci
223f085823Sopenharmony_cinamespace OHOS {
233f085823Sopenharmony_cinamespace DistributeSystemTest {
243f085823Sopenharmony_ciconstexpr int MAX_BUFF_LEN = 1024;
253f085823Sopenharmony_ciconstexpr int DST_COMMAND_NOTIFY = 0;
263f085823Sopenharmony_ciconstexpr int DST_COMMAND_CALL = 1;
273f085823Sopenharmony_ciconstexpr int DST_COMMAND_MSG = 2;
283f085823Sopenharmony_ciconstexpr int DST_COMMAND_END = 3;
293f085823Sopenharmony_ciconstexpr int DEFAULT_AGENT_PORT = 6789;
303f085823Sopenharmony_ci
313f085823Sopenharmony_cistruct DistributedCmd {
323f085823Sopenharmony_ci    int no;  // record command no, as return no.
333f085823Sopenharmony_ci    int cmdTestType;
343f085823Sopenharmony_ci    int len; // len + userszcmdinfo + len + cmd args + len + rexpectreturn. type of len is int
353f085823Sopenharmony_ci    union {
363f085823Sopenharmony_ci        char alignmentCmd[1]; // int Byte alignment
373f085823Sopenharmony_ci        int returnValue; // record ret value;
383f085823Sopenharmony_ci    };
393f085823Sopenharmony_ci};
403f085823Sopenharmony_ciusing DistributedMsg = DistributedCmd;
413f085823Sopenharmony_ci
423f085823Sopenharmony_ci#define DST_COMMAND_HEAD_LEN (sizeof(DistributedCmd) - sizeof(int))
433f085823Sopenharmony_ci
443f085823Sopenharmony_cistruct DistDevInfo {
453f085823Sopenharmony_ci    int devNo;
463f085823Sopenharmony_ci    std::string ipAddr;
473f085823Sopenharmony_ci    int fd;
483f085823Sopenharmony_ci};
493f085823Sopenharmony_ciusing DistDeviceInfo = DistDevInfo;
503f085823Sopenharmony_ci} // namespace DistributeSystemTest
513f085823Sopenharmony_ci} // namespace OHOS
523f085823Sopenharmony_ci
533f085823Sopenharmony_ci#endif // AW_CXX_DISTRIBUTED_DISTRIBUTED_H_
54