bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 1 | /* |
bigbiff bigbiff | af32bb9 | 2018-12-18 18:39:53 -0500 | [diff] [blame] | 2 | * Copyright (C) 2018 TeamWin |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 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 | #ifndef TWRPMTP_HPP |
| 18 | #define TWRPMTP_HPP |
| 19 | |
| 20 | #include <fcntl.h> |
| 21 | #include <utils/Errors.h> |
| 22 | #include <utils/threads.h> |
| 23 | #include <string> |
| 24 | #include <vector> |
| 25 | #include <pthread.h> |
| 26 | #include "MtpTypes.h" |
| 27 | #include "MtpPacket.h" |
| 28 | #include "MtpDataPacket.h" |
| 29 | #include "MtpDatabase.h" |
| 30 | #include "MtpRequestPacket.h" |
| 31 | #include "MtpResponsePacket.h" |
| 32 | #include "mtp_MtpDatabase.hpp" |
bigbiff bigbiff | af32bb9 | 2018-12-18 18:39:53 -0500 | [diff] [blame] | 33 | #include "mtp_MtpServer.hpp" |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 34 | |
| 35 | class twrpMtp { |
| 36 | public: |
Matt Mower | 72cf09d | 2015-11-12 01:29:58 -0600 | [diff] [blame] | 37 | twrpMtp(int debug_enabled = 0); |
Ethan Yonker | 8dfa777 | 2014-09-04 21:48:41 -0500 | [diff] [blame] | 38 | pthread_t threadserver(void); |
Ethan Yonker | 726a020 | 2014-12-16 20:01:38 -0600 | [diff] [blame] | 39 | pid_t forkserver(int mtppipe[2]); |
bigbiff | 7cb4c33 | 2014-11-26 20:36:07 -0500 | [diff] [blame] | 40 | void addStorage(std::string display, std::string path, int mtpid, uint64_t maxFileSize); |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 41 | private: |
| 42 | int start(void); |
| 43 | typedef int (twrpMtp::*ThreadPtr)(void); |
| 44 | typedef void* (*PThreadPtr)(void *); |
| 45 | storages *mtpstorages; |
| 46 | storage *s; |
Ethan Yonker | 726a020 | 2014-12-16 20:01:38 -0600 | [diff] [blame] | 47 | int mtp_read_pipe; |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 48 | }; |
| 49 | #endif |