16315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonrpackage com.android.server.wifi.hotspot2;
26315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr
3462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao/**
4462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao * Match score for EAP credentials:
5462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao * None means that there is a distinct mismatch, i.e. realm, method or parameter is defined
6462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao * and mismatches that of the credential.
7462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao * Indeterminate means that there is no ANQP information to match against.
8462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao * Note: The numeric values given to the constants are used for preference comparison and
99ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao * must be maintained accordingly.
109ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao */
11462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liaopublic abstract class AuthMatch {
129ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao    public static final int None = -1;
13462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao    public static final int Indeterminate = 0;
14462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao    public static final int Realm = 0x04;
156315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr    public static final int Method = 0x02;
166315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr    public static final int Param = 0x01;
179ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao    public static final int MethodParam = Method | Param;
18462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao    public static final int Exact = Realm | Method | Param;
19462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao
206315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr    public static String toString(int match) {
216315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr        if (match < 0) {
226315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr            return "None";
236315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr        }
246315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr        else if (match == 0) {
259ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao            return "Indeterminate";
26462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao        }
27462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao
28a41ce1d98094da84643995d40d71c529905123fcZonr Chang        StringBuilder sb = new StringBuilder();
29a41ce1d98094da84643995d40d71c529905123fcZonr Chang        if ((match & Realm) != 0) {
30a41ce1d98094da84643995d40d71c529905123fcZonr Chang            sb.append("Realm");
31a41ce1d98094da84643995d40d71c529905123fcZonr Chang        }
32462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao        if ((match & Method) != 0) {
33462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao            sb.append("Method");
349ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao        }
359ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao        if ((match & Param) != 0) {
369ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao            sb.append("Param");
379ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao        }
389ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao        return sb.toString();
39a41ce1d98094da84643995d40d71c529905123fcZonr Chang    }
409ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao}
419ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao