Home | History | Annotate | Download | only in adb
      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 
     22 #include <string>
     23 
     24 // error/status codes for install_listener.
     25 enum install_status_t {
     26   INSTALL_STATUS_OK = 0,
     27   INSTALL_STATUS_INTERNAL_ERROR = -1,
     28   INSTALL_STATUS_CANNOT_BIND = -2,
     29   INSTALL_STATUS_CANNOT_REBIND = -3,
     30   INSTALL_STATUS_LISTENER_NOT_FOUND = -4,
     31 };
     32 
     33 extern alistener listener_list;
     34 
     35 void listener_disconnect(void*  _l, atransport*  t);
     36 void listener_event_func(int _fd, unsigned ev, void *_l);
     37 void ss_listener_event_func(int _fd, unsigned ev, void *_l);
     38 
     39 install_status_t install_listener(const std::string& local_name,
     40                                   const char* connect_to,
     41                                   atransport* transport,
     42                                   int no_rebind);
     43 
     44 std::string format_listeners();
     45 
     46 install_status_t remove_listener(const char* local_name, atransport* transport);
     47 void remove_all_listeners(void);
     48 
     49 #endif /* __ADB_LISTENERS_H */
     50