blob: 62c77e59ad6553e90184f7a99dfe8a1fdfa67d49 [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;
Yotam Harcholfb4bfb92013-08-01 14:02:04 -07009import org.openflow.types.Masked;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070010import org.openflow.types.OFPort;
Yotam Harchold7b84202013-07-26 16:08:10 -070011import org.openflow.types.OFValueType;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070012import org.openflow.types.U16;
13import org.openflow.types.VlanPcp;
14import org.openflow.types.VlanVid;
15
16public class MatchBuilderVer10 implements MatchBuilder {
17
18 interface BuilderParamHandler<T> {
19 public T get(MatchBuilderVer10 builder);
20
21 public void set(MatchBuilderVer10 builder, T value);
22 }
23
24 // public static Map<MatchField<?,?>, BuilderParamHandler<?>>
25 // handlerMap = new HashMap();
Andreas Wundsam40e14f72013-05-06 14:49:08 -070026
27 protected int wildcards;
28 protected OFPort inputPort;
29 protected MacAddress dataLayerSource;
30 protected MacAddress dataLayerDestination;
31 protected VlanVid dataLayerVirtualLan;
32 protected VlanPcp dataLayerVirtualLanPriorityCodePoint;
33 protected EthType dataLayerType;
34 protected IpDscp ipDscp;
35 protected IpProtocol networkProtocol;
36 protected IPv4 networkSource;
37 protected IPv4 networkDestination;
38 protected U16 transportSource;
39 protected U16 transportDestination;
40
41 @SuppressWarnings("unchecked")
42 @Override
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070043 public <F extends OFValueType<F>> F get(final MatchField<F> match) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070044 switch (match.id) {
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070045 case IN_PORT:
Andreas Wundsam40e14f72013-05-06 14:49:08 -070046 return (F) inputPort;
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070047 case ETH_SRC:
Andreas Wundsam40e14f72013-05-06 14:49:08 -070048 return (F) dataLayerSource;
49 default:
50 return null;
51 }
52 }
53
Andreas Wundsam40e14f72013-05-06 14:49:08 -070054 @Override
Yotam Harcholfb4bfb92013-08-01 14:02:04 -070055 public <F extends OFValueType<F>> Masked<F>
56 getMasked(MatchField<F> field)
57 throws UnsupportedOperationException {
58 // TODO Auto-generated method stub
59 return null;
60 }
61
62 @Override
63 public <F extends OFValueType<F>> MatchBuilder setExact(final MatchField<F> match, final F value) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070064 switch (match.id) {
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070065 case IN_PORT:
Andreas Wundsam40e14f72013-05-06 14:49:08 -070066 inputPort = (OFPort) value;
67 break;
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070068 case ETH_SRC:
Andreas Wundsam40e14f72013-05-06 14:49:08 -070069 dataLayerSource = (MacAddress) value;
70 break;
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070071 default:
72 break;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070073 }
74 return this;
75 }
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070076
77 @Override
Yotam Harcholfb4bfb92013-08-01 14:02:04 -070078 public <F extends OFValueType<F>> MatchBuilder
79 setMasked(MatchField<F> field, Masked<F> valueWithMask) {
80 // TODO Auto-generated method stub
81 return null;
82 }
83
84 @Override
85 public <F extends OFValueType<F>> MatchBuilder
86 setMasked(MatchField<F> field, F value, F mask) {
87 // TODO Auto-generated method stub
88 return null;
89 }
90
91 @Override
92 public <F extends OFValueType<F>> MatchBuilder wildcard(final MatchField<F> match) {
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070093 // TODO Auto-generated method stub
94 return null;
95 }
Andreas Wundsam40e14f72013-05-06 14:49:08 -070096
97 public OFPort getInputPort() {
98 return inputPort;
99 }
100
101 public void setInputPort(final OFPort inputPort) {
102 this.inputPort = inputPort;
103 }
104
105 public MacAddress getDataLayerSource() {
106 return dataLayerSource;
107 }
108
109 public void setDataLayerSource(final MacAddress dataLayerSource) {
110 this.dataLayerSource = dataLayerSource;
111 }
112
113 @Override
Yotam Harchold7b84202013-07-26 16:08:10 -0700114 public boolean supports(final MatchField<?> field) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700115 // TODO Auto-generated method stub
116 return false;
117 }
118
119 @Override
Yotam Harchold7b84202013-07-26 16:08:10 -0700120 public boolean supportsMasked(final MatchField<?> field) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700121 // TODO Auto-generated method stub
122 return false;
123 }
124
125 @Override
Yotam Harchold7b84202013-07-26 16:08:10 -0700126 public boolean isExact(final MatchField<?> field) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700127 // TODO Auto-generated method stub
128 return false;
129 }
130
131 @Override
Yotam Harchold7b84202013-07-26 16:08:10 -0700132 public boolean isFullyWildcarded(final MatchField<?> field) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700133 // TODO Auto-generated method stub
134 return false;
135 }
136
137 @Override
Yotam Harchold7b84202013-07-26 16:08:10 -0700138 public boolean isPartiallyMasked(final MatchField<?> field) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700139 // TODO Auto-generated method stub
140 return false;
141 }
142
143 @Override
144 public MatchBuilder getBuilder() {
145 // TODO Auto-generated method stub
146 return null;
147 }
148
149 @Override
150 public int getLength() {
151 // TODO Auto-generated method stub
152 return 0;
153 }
154
155 @Override
Andreas Wundsam27303462013-07-16 12:52:35 -0700156 public void writeTo(final ChannelBuffer bb) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700157 // TODO Auto-generated method stub
158
159 }
Yotam Harchold7b84202013-07-26 16:08:10 -0700160/*
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700161 @Override
162 public <M> void setMasked(final MatchField<?, M> match, final M value) {
163 // TODO Auto-generated method stub
164
165 }
Yotam Harchold7b84202013-07-26 16:08:10 -0700166*/
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700167 @Override
168 public Match getMatch() {
169 // TODO Auto-generated method stub
170 return null;
171 }
172
173}