Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 1 | package org.openflow.protocol.match; |
| 2 | |
| 3 | import org.jboss.netty.buffer.ChannelBuffer; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 4 | import org.openflow.types.EthType; |
| 5 | import org.openflow.types.IPv4; |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 6 | import org.openflow.types.IpDscp; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 7 | import org.openflow.types.IpProtocol; |
| 8 | import org.openflow.types.MacAddress; |
Yotam Harchol | fb4bfb9 | 2013-08-01 14:02:04 -0700 | [diff] [blame] | 9 | import org.openflow.types.Masked; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 10 | import org.openflow.types.OFPort; |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 11 | import org.openflow.types.OFValueType; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 12 | import org.openflow.types.U16; |
| 13 | import org.openflow.types.VlanPcp; |
| 14 | import org.openflow.types.VlanVid; |
| 15 | |
| 16 | public 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 Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 26 | |
| 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 Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 43 | public <F extends OFValueType<F>> F get(final MatchField<F> match) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 44 | switch (match.id) { |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 45 | case IN_PORT: |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 46 | return (F) inputPort; |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 47 | case ETH_SRC: |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 48 | return (F) dataLayerSource; |
| 49 | default: |
| 50 | return null; |
| 51 | } |
| 52 | } |
| 53 | |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 54 | @Override |
Yotam Harchol | fb4bfb9 | 2013-08-01 14:02:04 -0700 | [diff] [blame] | 55 | 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 Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 64 | switch (match.id) { |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 65 | case IN_PORT: |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 66 | inputPort = (OFPort) value; |
| 67 | break; |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 68 | case ETH_SRC: |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 69 | dataLayerSource = (MacAddress) value; |
| 70 | break; |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 71 | default: |
| 72 | break; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 73 | } |
| 74 | return this; |
| 75 | } |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 76 | |
| 77 | @Override |
Yotam Harchol | fb4bfb9 | 2013-08-01 14:02:04 -0700 | [diff] [blame] | 78 | 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 Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 93 | // TODO Auto-generated method stub |
| 94 | return null; |
| 95 | } |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 96 | |
| 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 Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 114 | public boolean supports(final MatchField<?> field) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 115 | // TODO Auto-generated method stub |
| 116 | return false; |
| 117 | } |
| 118 | |
| 119 | @Override |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 120 | public boolean supportsMasked(final MatchField<?> field) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 121 | // TODO Auto-generated method stub |
| 122 | return false; |
| 123 | } |
| 124 | |
| 125 | @Override |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 126 | public boolean isExact(final MatchField<?> field) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 127 | // TODO Auto-generated method stub |
| 128 | return false; |
| 129 | } |
| 130 | |
| 131 | @Override |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 132 | public boolean isFullyWildcarded(final MatchField<?> field) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 133 | // TODO Auto-generated method stub |
| 134 | return false; |
| 135 | } |
| 136 | |
| 137 | @Override |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 138 | public boolean isPartiallyMasked(final MatchField<?> field) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 139 | // 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 Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 156 | public void writeTo(final ChannelBuffer bb) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 157 | // TODO Auto-generated method stub |
| 158 | |
| 159 | } |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 160 | /* |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 161 | @Override |
| 162 | public <M> void setMasked(final MatchField<?, M> match, final M value) { |
| 163 | // TODO Auto-generated method stub |
| 164 | |
| 165 | } |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 166 | */ |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 167 | @Override |
| 168 | public Match getMatch() { |
| 169 | // TODO Auto-generated method stub |
| 170 | return null; |
| 171 | } |
| 172 | |
| 173 | } |