• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2013 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 #ifndef _FASTBOOTD_TRANSPORT_H_
18 #define _FASTBOOTD_TRANSPORT_H_
19 
20 #include <stdbool.h>
21 
22 struct transport_handle {
23     struct transport *transport;
24 
25     bool stopped;
26 };
27 
28 struct transport {
29     void (*init)();
30     void (*close)(struct transport_handle *thandle);
31     ssize_t (*read)(struct transport_handle *thandle, void *data, size_t len);
32     ssize_t (*write)(struct transport_handle *thandle, const void *data, size_t len);
33     struct transport_handle *(*connect)(struct transport *transport);
34     bool stopped;
35 };
36 
37 void transport_register(struct transport *transport);
38 ssize_t transport_handle_write(struct transport_handle *handle, char *buffer, size_t len);
39 int transport_handle_download(struct transport_handle *handle, size_t len);
40 
41 #endif
42