1 2 /* 3 * Copyright (C) 2008 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 #ifndef _DhcpClient_H 19 #define _DhcpClient_H 20 21 #include <pthread.h> 22 23 class IDhcpEventHandlers; 24 class ServiceManager; 25 class DhcpListener; 26 class Controller; 27 28 class DhcpClient { 29 public: 30 static const int STATUS_MONITOR_PORT = 6666; 31 32 private: 33 int mState; 34 IDhcpEventHandlers *mHandlers; 35 ServiceManager *mServiceManager; 36 DhcpListener *mListener; 37 int mListenerSocket; 38 pthread_mutex_t mLock; 39 Controller *mController; 40 bool mDoArpProbe; 41 42 public: 43 DhcpClient(IDhcpEventHandlers *handlers); 44 virtual ~DhcpClient(); 45 46 int getState() { return mState; } 47 bool getDoArpProbe() { return mDoArpProbe; } 48 void setDoArpProbe(bool probe); 49 50 int start(Controller *c); 51 int stop(); 52 }; 53 54 #endif 55