San Mehat | 54962e0 | 2009-06-22 10:37:54 -0700 | [diff] [blame] | 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 | |
San Mehat | c4a895b | 2009-06-23 21:10:57 -0700 | [diff] [blame] | 21 | #include <pthread.h> |
| 22 | |
San Mehat | 54962e0 | 2009-06-22 10:37:54 -0700 | [diff] [blame] | 23 | class IDhcpEventHandlers; |
| 24 | class ServiceManager; |
| 25 | class DhcpListener; |
San Mehat | c4a895b | 2009-06-23 21:10:57 -0700 | [diff] [blame] | 26 | class Controller; |
San Mehat | 54962e0 | 2009-06-22 10:37:54 -0700 | [diff] [blame] | 27 | |
| 28 | class DhcpClient { |
San Mehat | c4a895b | 2009-06-23 21:10:57 -0700 | [diff] [blame] | 29 | public: |
| 30 | static const int STATUS_MONITOR_PORT = 6666; |
| 31 | |
| 32 | private: |
San Mehat | 54962e0 | 2009-06-22 10:37:54 -0700 | [diff] [blame] | 33 | int mState; |
| 34 | IDhcpEventHandlers *mHandlers; |
| 35 | ServiceManager *mServiceManager; |
| 36 | DhcpListener *mListener; |
San Mehat | c4a895b | 2009-06-23 21:10:57 -0700 | [diff] [blame] | 37 | int mListenerSocket; |
| 38 | pthread_mutex_t mLock; |
| 39 | Controller *mController; |
| 40 | bool mDoArpProbe; |
San Mehat | 54962e0 | 2009-06-22 10:37:54 -0700 | [diff] [blame] | 41 | |
| 42 | public: |
| 43 | DhcpClient(IDhcpEventHandlers *handlers); |
| 44 | virtual ~DhcpClient(); |
| 45 | |
| 46 | int getState() { return mState; } |
San Mehat | c4a895b | 2009-06-23 21:10:57 -0700 | [diff] [blame] | 47 | bool getDoArpProbe() { return mDoArpProbe; } |
| 48 | void setDoArpProbe(bool probe); |
San Mehat | 54962e0 | 2009-06-22 10:37:54 -0700 | [diff] [blame] | 49 | |
San Mehat | c4a895b | 2009-06-23 21:10:57 -0700 | [diff] [blame] | 50 | int start(Controller *c); |
San Mehat | 54962e0 | 2009-06-22 10:37:54 -0700 | [diff] [blame] | 51 | int stop(); |
| 52 | }; |
| 53 | |
| 54 | #endif |