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