San Mehat | 192331d | 2009-05-22 13:58:06 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2008 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 _INTERFACE_CONFIG_H |
| 18 | #define _INTERFACE_CONFIG_H |
| 19 | |
| 20 | #include <netinet/in.h> |
| 21 | #include <arpa/inet.h> |
| 22 | |
| 23 | class InterfaceConfig { |
| 24 | private: |
| 25 | char *mName; |
| 26 | bool mUseDhcp; |
| 27 | struct in_addr mIp; |
| 28 | struct in_addr mNetmask; |
| 29 | struct in_addr mGateway; |
| 30 | struct in_addr mDns1; |
| 31 | struct in_addr mDns2; |
| 32 | struct in_addr mDns3; |
| 33 | |
| 34 | public: |
| 35 | InterfaceConfig(const char *name); |
| 36 | InterfaceConfig(const char *name, const char *ip, const char *nm, |
| 37 | const char *gw, const char *dns1, const char *dns2, |
| 38 | const char *dns3); |
| 39 | |
| 40 | InterfaceConfig(const char *name, const struct in_addr *ip, |
| 41 | const struct in_addr *nm, const struct in_addr *gw, |
| 42 | const struct in_addr *dns1, const struct in_addr *dns2, |
| 43 | const struct in_addr *dns3); |
| 44 | |
| 45 | virtual ~InterfaceConfig(); |
| 46 | |
| 47 | const char *getName() const { return mName; } |
| 48 | bool getUseDhcp() const { return mUseDhcp; } |
| 49 | const struct in_addr &getIp() const { return mIp; } |
| 50 | const struct in_addr &getNetmask() const { return mNetmask; } |
| 51 | const struct in_addr &getGateway() const { return mGateway; } |
| 52 | const struct in_addr &getDns1() const { return mDns1; } |
| 53 | const struct in_addr &getDns2() const { return mDns2; } |
| 54 | const struct in_addr &getDns3() const { return mDns3; } |
| 55 | }; |
| 56 | |
| 57 | |
| 58 | #endif |