Dan Albert | 020292b | 2015-02-18 18:03:26 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 __ADB_LISTENERS_H |
| 18 | #define __ADB_LISTENERS_H |
| 19 | |
| 20 | #include "adb.h" |
| 21 | |
Elliott Hughes | 88b4c85 | 2015-04-30 17:32:03 -0700 | [diff] [blame] | 22 | #include <string> |
| 23 | |
David Pursell | 19d0c23 | 2016-04-07 11:25:48 -0700 | [diff] [blame] | 24 | #include <android-base/macros.h> |
| 25 | |
Dan Albert | 020292b | 2015-02-18 18:03:26 -0800 | [diff] [blame] | 26 | // error/status codes for install_listener. |
Elliott Hughes | 3aec2ba | 2015-05-05 13:10:43 -0700 | [diff] [blame] | 27 | enum InstallStatus { |
Dan Albert | 020292b | 2015-02-18 18:03:26 -0800 | [diff] [blame] | 28 | INSTALL_STATUS_OK = 0, |
| 29 | INSTALL_STATUS_INTERNAL_ERROR = -1, |
| 30 | INSTALL_STATUS_CANNOT_BIND = -2, |
| 31 | INSTALL_STATUS_CANNOT_REBIND = -3, |
Elliott Hughes | a585cbd | 2015-04-20 08:09:20 -0700 | [diff] [blame] | 32 | INSTALL_STATUS_LISTENER_NOT_FOUND = -4, |
Elliott Hughes | fe7ff81 | 2015-04-17 09:47:42 -0700 | [diff] [blame] | 33 | }; |
Dan Albert | 020292b | 2015-02-18 18:03:26 -0800 | [diff] [blame] | 34 | |
David Pursell | 19d0c23 | 2016-04-07 11:25:48 -0700 | [diff] [blame] | 35 | InstallStatus install_listener(const std::string& local_name, const char* connect_to, |
| 36 | atransport* transport, int no_rebind, int* resolved_tcp_port, |
Spencer Low | 753d485 | 2015-07-30 23:07:55 -0700 | [diff] [blame] | 37 | std::string* error); |
Dan Albert | 020292b | 2015-02-18 18:03:26 -0800 | [diff] [blame] | 38 | |
Elliott Hughes | 88b4c85 | 2015-04-30 17:32:03 -0700 | [diff] [blame] | 39 | std::string format_listeners(); |
Dan Albert | 020292b | 2015-02-18 18:03:26 -0800 | [diff] [blame] | 40 | |
Elliott Hughes | 3aec2ba | 2015-05-05 13:10:43 -0700 | [diff] [blame] | 41 | InstallStatus remove_listener(const char* local_name, atransport* transport); |
Dan Albert | 020292b | 2015-02-18 18:03:26 -0800 | [diff] [blame] | 42 | void remove_all_listeners(void); |
| 43 | |
Dan Albert | 020292b | 2015-02-18 18:03:26 -0800 | [diff] [blame] | 44 | #endif /* __ADB_LISTENERS_H */ |