1 /* 2 * Copyright (C) 2022 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 #ifndef HDC_EXT_CLIENT_H 16 #define HDC_EXT_CLIENT_H 17 18 #include "host_common.h" 19 20 extern std::map<std::string, std::string> g_lists; 21 extern bool g_show; 22 23 namespace Hdc { 24 class ExtClient { 25 public: 26 std::string connectKey; 27 std::string containerInOut; 28 ExtClient(); 29 virtual ~ExtClient(); 30 void ExecuteCommand(const string &command); 31 bool Init(); 32 static bool SharedLibraryExist(); 33 34 private: 35 uv_lib_t lib; 36 void Version(const std::string &str); 37 static void Help(const std::string &str); 38 void Discover(const std::string &str); 39 void Start(const std::string &str); 40 void Kill(const std::string &str); 41 void ListTargets(const std::string &str); 42 void Connect(const std::string &str); 43 void Shell(const std::string &str); 44 void File(const std::string &str); 45 void Fport(const std::string &str); 46 void Rport(const std::string &str); 47 void Install(const std::string &str); 48 void Uninstall(const std::string &str); 49 void Jpid(const std::string &str); 50 void TrackJpid(const std::string &str); 51 void Utility(const std::string &str); 52 void Bugreport(const std::string &str); 53 void WaitFor(const std::string &str); 54 void UnknowCommand(const std::string &str); 55 std::string RemoveRemoteCwd(const std::string &str); 56 void UpdateList(const std::string &str); 57 static std::string HandleLib(const std::string &str, const char *name, uv_lib_t &lib); 58 std::string Handle(const std::string &str, const char *name); 59 string WithConnectKey(const string &str); 60 static void WaitForExtent(const std::string &str); 61 static string GetPath(); 62 static void RegistExecFunc(uv_lib_t *lib); 63 }; 64 } 65 #endif 66 67