• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <string>
20 
21 #include <android-base/result.h>
22 #include <android-base/unique_fd.h>
23 
24 #define TIPC_MAX_MSG_SIZE PAGE_SIZE
25 
26 namespace android {
27 namespace trusty {
28 namespace fuzz {
29 
30 class TrustyApp {
31   public:
32     TrustyApp(std::string tipc_dev, std::string ta_port);
33 
34     android::base::Result<void> Connect();
35     android::base::Result<void> Read(void* buf, size_t len);
36     android::base::Result<void> Write(const void* buf, size_t len);
37     void Disconnect();
38 
39     android::base::Result<int> GetRawFd();
40 
41   private:
42     std::string tipc_dev_;
43     std::string ta_port_;
44     android::base::unique_fd ta_fd_;
45 };
46 
47 void Abort();
48 
49 }  // namespace fuzz
50 }  // namespace trusty
51 }  // namespace android
52