blob: 42bfda07342d7b81244784898fa189437308f108 [file] [log] [blame]
San Mehat54962e02009-06-22 10:37:54 -07001
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 Mehatc4a895b2009-06-23 21:10:57 -070021#include <pthread.h>
22
San Mehat54962e02009-06-22 10:37:54 -070023class IDhcpEventHandlers;
24class ServiceManager;
25class DhcpListener;
San Mehatc4a895b2009-06-23 21:10:57 -070026class Controller;
San Mehat54962e02009-06-22 10:37:54 -070027
28class DhcpClient {
San Mehatc4a895b2009-06-23 21:10:57 -070029public:
30 static const int STATUS_MONITOR_PORT = 6666;
31
32private:
San Mehat54962e02009-06-22 10:37:54 -070033 int mState;
34 IDhcpEventHandlers *mHandlers;
35 ServiceManager *mServiceManager;
36 DhcpListener *mListener;
San Mehatc4a895b2009-06-23 21:10:57 -070037 int mListenerSocket;
38 pthread_mutex_t mLock;
39 Controller *mController;
40 bool mDoArpProbe;
San Mehat54962e02009-06-22 10:37:54 -070041
42public:
43 DhcpClient(IDhcpEventHandlers *handlers);
44 virtual ~DhcpClient();
45
46 int getState() { return mState; }
San Mehatc4a895b2009-06-23 21:10:57 -070047 bool getDoArpProbe() { return mDoArpProbe; }
48 void setDoArpProbe(bool probe);
San Mehat54962e02009-06-22 10:37:54 -070049
San Mehatc4a895b2009-06-23 21:10:57 -070050 int start(Controller *c);
San Mehat54962e02009-06-22 10:37:54 -070051 int stop();
52};
53
54#endif