blob: 2e8c2b888903d1f239cf11219b1ec8e4a0cad0eb [file] [log] [blame]
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -04001/*
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -05002 * Copyright (C) 2018 TeamWin
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -04003 *
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 bigbiffaf32bb92018-12-18 18:39:53 -050033#include "mtp_MtpServer.hpp"
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040034
35class twrpMtp {
36 public:
Matt Mower72cf09d2015-11-12 01:29:58 -060037 twrpMtp(int debug_enabled = 0);
Ethan Yonker8dfa7772014-09-04 21:48:41 -050038 pthread_t threadserver(void);
Ethan Yonker726a0202014-12-16 20:01:38 -060039 pid_t forkserver(int mtppipe[2]);
bigbiff7cb4c332014-11-26 20:36:07 -050040 void addStorage(std::string display, std::string path, int mtpid, uint64_t maxFileSize);
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040041 private:
42 int start(void);
43 typedef int (twrpMtp::*ThreadPtr)(void);
44 typedef void* (*PThreadPtr)(void *);
45 storages *mtpstorages;
46 storage *s;
Ethan Yonker726a0202014-12-16 20:01:38 -060047 int mtp_read_pipe;
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040048};
49#endif