blob: 761c433b220c6d9e24be72f85a5d7aa2d43d48c6 [file] [log] [blame]
Yotam Harchol4d634682013-09-26 13:21:06 -07001package org.projectfloodlight.openflow.types;
2
3public abstract class IPAddress<F extends IPAddress<F>> implements OFValueType<F> {
4
5 public enum IpVersion {
6 IPv4,
7 IPv6
8 }
9
10 public abstract IpVersion getIpVersion();
11
12 public static IPAddress<?> of(String ip) {
13 if (ip.indexOf('.') != -1)
14 return IPv4Address.of(ip);
15 else if (ip.indexOf(':') != -1)
16 return IPv6Address.of(ip);
17 else
18 throw new IllegalArgumentException("IP Address not well formed: " + ip);
19 }
20
21}