Stan Chesnutt | 7da02ad | 2010-12-14 09:49:26 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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 | package android.net.dhcp; |
| 18 | |
| 19 | import java.net.InetAddress; |
Stan Chesnutt | 7da02ad | 2010-12-14 09:49:26 -0800 | [diff] [blame] | 20 | import java.util.List; |
| 21 | |
| 22 | /** |
| 23 | * This class defines the "next steps" which occur after a given DHCP |
| 24 | * packet has been received. |
| 25 | */ |
| 26 | interface DhcpStateMachine { |
| 27 | /** |
| 28 | * Signals that an offer packet has been received with the specified |
| 29 | * parameters. |
| 30 | */ |
| 31 | public void onOfferReceived(boolean broadcast, int transactionId, |
| 32 | byte[] myMac, InetAddress offeredIpAddress, |
| 33 | InetAddress serverIpAddress); |
| 34 | |
| 35 | /** |
| 36 | * Signals that a NAK packet has been received. |
| 37 | */ |
| 38 | public void onNakReceived(); |
| 39 | |
| 40 | /** |
| 41 | * Signals that the final ACK has been received from the server. |
| 42 | */ |
| 43 | public void onAckReceived(InetAddress myIpAddress, InetAddress myNetMask, |
| 44 | InetAddress myGateway, List<InetAddress> myDnsServers, |
| 45 | InetAddress myDhcpServer, int leaseTime); |
| 46 | |
| 47 | /** |
| 48 | * Signals that a client's DISCOVER packet has been received with the |
| 49 | * specified parameters. |
| 50 | */ |
| 51 | public void onDiscoverReceived(boolean broadcast, int transactionId, |
| 52 | byte[] clientMac, byte[] requestedParameterList); |
| 53 | |
| 54 | /** |
| 55 | * Signals that a client's REQUEST packet has been received with the |
| 56 | * specified parameters. |
| 57 | */ |
| 58 | public void onRequestReceived(boolean broadcast, int transactionId, |
| 59 | byte[] clientMac, InetAddress requestedIp, byte[] requestedParams, |
| 60 | String clientHostName); |
| 61 | |
| 62 | /** |
| 63 | * Signals that a client's INFORM packet has been received with the |
| 64 | * specified parameters. |
| 65 | */ |
| 66 | public void onInformReceived(int transactionId, byte[] clientMac, |
| 67 | InetAddress preassignedIp, byte[] requestedParams); |
| 68 | |
| 69 | /** |
| 70 | * Signals that a client's DECLINE packet has been received with the |
| 71 | * specified parameters. |
| 72 | */ |
| 73 | public void onDeclineReceived(byte[] clientMac, InetAddress declinedIp); |
| 74 | } |