• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef AW_CXX_DISTRIBUTED_DISTRIBUTED_H_
17 #define AW_CXX_DISTRIBUTED_DISTRIBUTED_H_
18 
19 #include <iostream>
20 #include "securec.h"
21 
22 namespace OHOS {
23 namespace DistributeSystemTest {
24 constexpr int MAX_BUFF_LEN = 1024;
25 constexpr int DST_COMMAND_NOTIFY = 0;
26 constexpr int DST_COMMAND_CALL = 1;
27 constexpr int DST_COMMAND_MSG = 2;
28 constexpr int DST_COMMAND_END = 3;
29 constexpr int DEFAULT_AGENT_PORT = 6789;
30 
31 struct DistributedCmd {
32     int no;  // record command no, as return no.
33     int cmdTestType;
34     int len; // len + userszcmdinfo + len + cmd args + len + rexpectreturn. type of len is int
35     union {
36         char alignmentCmd[1]; // int Byte alignment
37         int returnValue; // record ret value;
38     };
39 };
40 using DistributedMsg = DistributedCmd;
41 
42 #define DST_COMMAND_HEAD_LEN (sizeof(DistributedCmd) - sizeof(int))
43 
44 struct DistDevInfo {
45     int devNo;
46     std::string ipAddr;
47     int fd;
48 };
49 using DistDeviceInfo = DistDevInfo;
50 } // namespace DistributeSystemTest
51 } // namespace OHOS
52 
53 #endif // AW_CXX_DISTRIBUTED_DISTRIBUTED_H_
54