blob: 1c91201df927c9770f3186c31ccad447ebf96d8c [file] [log] [blame]
Andreas Wundsam40e14f72013-05-06 14:49:08 -07001package org.openflow.protocol.match;
2
3import org.jboss.netty.buffer.ChannelBuffer;
Andreas Wundsam40e14f72013-05-06 14:49:08 -07004import org.openflow.types.EthType;
5import org.openflow.types.IPv4;
Yotam Harchold7b84202013-07-26 16:08:10 -07006import org.openflow.types.IpDscp;
Andreas Wundsam40e14f72013-05-06 14:49:08 -07007import org.openflow.types.IpProtocol;
8import org.openflow.types.MacAddress;
9import org.openflow.types.OFPort;
Yotam Harchold7b84202013-07-26 16:08:10 -070010import org.openflow.types.OFValueType;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070011import org.openflow.types.U16;
12import org.openflow.types.VlanPcp;
13import org.openflow.types.VlanVid;
14
15public class MatchBuilderVer10 implements MatchBuilder {
16
17 interface BuilderParamHandler<T> {
18 public T get(MatchBuilderVer10 builder);
19
20 public void set(MatchBuilderVer10 builder, T value);
21 }
22
23 // public static Map<MatchField<?,?>, BuilderParamHandler<?>>
24 // handlerMap = new HashMap();
Andreas Wundsam40e14f72013-05-06 14:49:08 -070025
26 protected int wildcards;
27 protected OFPort inputPort;
28 protected MacAddress dataLayerSource;
29 protected MacAddress dataLayerDestination;
30 protected VlanVid dataLayerVirtualLan;
31 protected VlanPcp dataLayerVirtualLanPriorityCodePoint;
32 protected EthType dataLayerType;
33 protected IpDscp ipDscp;
34 protected IpProtocol networkProtocol;
35 protected IPv4 networkSource;
36 protected IPv4 networkDestination;
37 protected U16 transportSource;
38 protected U16 transportDestination;
39
40 @SuppressWarnings("unchecked")
41 @Override
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070042 public <F extends OFValueType<F>> F get(final MatchField<F> match) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070043 switch (match.id) {
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070044 case IN_PORT:
Andreas Wundsam40e14f72013-05-06 14:49:08 -070045 return (F) inputPort;
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070046 case ETH_SRC:
Andreas Wundsam40e14f72013-05-06 14:49:08 -070047 return (F) dataLayerSource;
48 default:
49 return null;
50 }
51 }
52
Andreas Wundsam40e14f72013-05-06 14:49:08 -070053 @Override
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070054 public <F extends OFValueType<F>> MatchBuilder set(final MatchField<F> match, final F value) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070055 switch (match.id) {
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070056 case IN_PORT:
Andreas Wundsam40e14f72013-05-06 14:49:08 -070057 inputPort = (OFPort) value;
58 break;
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070059 case ETH_SRC:
Andreas Wundsam40e14f72013-05-06 14:49:08 -070060 dataLayerSource = (MacAddress) value;
61 break;
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070062 default:
63 break;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070064 }
65 return this;
66 }
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070067
68 @Override
69 public <F extends OFValueType<F>> MatchBuilder unset(final MatchField<F> match) {
70 // TODO Auto-generated method stub
71 return null;
72 }
Andreas Wundsam40e14f72013-05-06 14:49:08 -070073
74 public OFPort getInputPort() {
75 return inputPort;
76 }
77
78 public void setInputPort(final OFPort inputPort) {
79 this.inputPort = inputPort;
80 }
81
82 public MacAddress getDataLayerSource() {
83 return dataLayerSource;
84 }
85
86 public void setDataLayerSource(final MacAddress dataLayerSource) {
87 this.dataLayerSource = dataLayerSource;
88 }
89
90 @Override
Yotam Harchold7b84202013-07-26 16:08:10 -070091 public boolean supports(final MatchField<?> field) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070092 // TODO Auto-generated method stub
93 return false;
94 }
95
96 @Override
Yotam Harchold7b84202013-07-26 16:08:10 -070097 public boolean supportsMasked(final MatchField<?> field) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070098 // TODO Auto-generated method stub
99 return false;
100 }
101
102 @Override
Yotam Harchold7b84202013-07-26 16:08:10 -0700103 public boolean isExact(final MatchField<?> field) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700104 // TODO Auto-generated method stub
105 return false;
106 }
107
108 @Override
Yotam Harchold7b84202013-07-26 16:08:10 -0700109 public boolean isFullyWildcarded(final MatchField<?> field) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700110 // TODO Auto-generated method stub
111 return false;
112 }
113
114 @Override
Yotam Harchold7b84202013-07-26 16:08:10 -0700115 public boolean isPartiallyMasked(final MatchField<?> field) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700116 // TODO Auto-generated method stub
117 return false;
118 }
119
120 @Override
121 public MatchBuilder getBuilder() {
122 // TODO Auto-generated method stub
123 return null;
124 }
125
126 @Override
127 public int getLength() {
128 // TODO Auto-generated method stub
129 return 0;
130 }
131
132 @Override
Andreas Wundsam27303462013-07-16 12:52:35 -0700133 public void writeTo(final ChannelBuffer bb) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700134 // TODO Auto-generated method stub
135
136 }
Yotam Harchold7b84202013-07-26 16:08:10 -0700137/*
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700138 @Override
139 public <M> void setMasked(final MatchField<?, M> match, final M value) {
140 // TODO Auto-generated method stub
141
142 }
Yotam Harchold7b84202013-07-26 16:08:10 -0700143*/
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700144 @Override
145 public Match getMatch() {
146 // TODO Auto-generated method stub
147 return null;
148 }
149
150}