Home | History | Annotate | Download | only in eap
      1 package com.android.anqp.eap;
      2 
      3 import java.net.ProtocolException;
      4 import java.nio.ByteBuffer;
      5 import java.util.Arrays;
      6 
      7 /**
      8  * An EAP authentication parameter, IEEE802.11-2012, table 8-188
      9  */
     10 public class VendorSpecificAuth implements AuthParam {
     11 
     12     private final byte[] mData;
     13 
     14     public VendorSpecificAuth(int length, ByteBuffer payload) throws ProtocolException {
     15         mData = new byte[length];
     16         payload.get(mData);
     17     }
     18 
     19     @Override
     20     public EAP.AuthInfoID getAuthInfoID() {
     21         return EAP.AuthInfoID.VendorSpecific;
     22     }
     23 
     24     public int hashCode() {
     25         return Arrays.hashCode(mData);
     26     }
     27 
     28     @Override
     29     public boolean equals(Object thatObject) {
     30         if (thatObject == this) {
     31             return true;
     32         } else if (thatObject == null || thatObject.getClass() != VendorSpecificAuth.class) {
     33             return false;
     34         } else {
     35             return Arrays.equals(((VendorSpecificAuth) thatObject).getData(), getData());
     36         }
     37     }
     38 
     39     public byte[] getData() {
     40         return mData;
     41     }
     42 
     43     @Override
     44     public String toString() {
     45         return "Auth method VendorSpecificAuth, data = " + Arrays.toString(mData) + '\n';
     46     }
     47 }
     48