67da57985f66a09144cd3e6bc8605f95a508fec3
[lispflowmapping.git] / mappingservice / api / src / main / java / org / opendaylight / lispflowmapping / type / AddressFamilyNumberEnum.java
1 /*
2  * Copyright (c) 2014 Contextream, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.lispflowmapping.type;
10
11 /**
12  * The AFI enum:
13  * http://www.iana.org/assignments/address-family-numbers/address-family
14  * -numbers.xhtml
15  */
16 public enum AddressFamilyNumberEnum {
17     NO_ADDRESS(0), //
18     IP(1), //
19     IP6(2), //
20     DISTINGUISHED_NAME(17), //
21     AS(18), //
22     LCAF(16387), //
23     MAC(16389), //
24     UNKNOWN(-1);
25
26     private short ianaCode;
27
28     private AddressFamilyNumberEnum(int ianaCode) {
29         this.ianaCode = (short) ianaCode;
30     }
31
32     public short getIanaCode() {
33         return ianaCode;
34     }
35
36     public static AddressFamilyNumberEnum valueOf(short ianaCode) {
37         for (AddressFamilyNumberEnum val : values()) {
38             if (val.getIanaCode() == ianaCode) {
39                 return val;
40             }
41         }
42         return UNKNOWN;
43     }
44 }