Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 1 | package org.openflow.util; |
| 2 | |
| 3 | import java.util.List; |
| 4 | |
| 5 | import org.jboss.netty.buffer.ChannelBuffer; |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 6 | import org.openflow.protocol.OFBsnInterface; |
| 7 | import org.openflow.protocol.OFBsnVportQInQ; |
| 8 | import org.openflow.protocol.OFBsnVportQInQT; |
| 9 | import org.openflow.protocol.OFBucket; |
| 10 | import org.openflow.protocol.OFFlowStatsEntry; |
| 11 | import org.openflow.protocol.OFGroupDescStatsEntry; |
| 12 | import org.openflow.protocol.OFGroupStatsEntry; |
| 13 | import org.openflow.protocol.OFHelloElem; |
| 14 | import org.openflow.protocol.OFMeterFeatures; |
| 15 | import org.openflow.protocol.OFMeterStats; |
| 16 | import org.openflow.protocol.OFPacketQueue; |
| 17 | import org.openflow.protocol.OFPortStatsEntry; |
| 18 | import org.openflow.protocol.OFQueueStatsEntry; |
| 19 | import org.openflow.protocol.OFTableFeature; |
| 20 | import org.openflow.protocol.OFTableFeatures; |
| 21 | import org.openflow.protocol.OFTableStatsEntry; |
| 22 | import org.openflow.protocol.action.OFAction; |
| 23 | import org.openflow.protocol.instruction.OFInstruction; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 24 | import org.openflow.protocol.match.Match; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 25 | import org.openflow.types.OFFlowModCmd; |
| 26 | import org.openflow.types.OFHelloElement; |
| 27 | import org.openflow.types.OFMeterBand; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 28 | import org.openflow.types.OFPhysicalPort; |
| 29 | |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 30 | import com.google.common.base.Charsets; |
| 31 | |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 32 | /** |
| 33 | * Collection of helper functions for reading and writing into ChannelBuffers |
| 34 | * |
| 35 | * @author capveg |
| 36 | */ |
| 37 | |
| 38 | public class ChannelUtils { |
| 39 | |
| 40 | static public byte[] readBytes(final ChannelBuffer bb, final int length) { |
| 41 | byte byteArray[] = new byte[length]; |
| 42 | bb.readBytes(byteArray); |
| 43 | return byteArray; |
| 44 | } |
| 45 | |
| 46 | static public void writeBytes(final ChannelBuffer bb, final byte byteArray[]) { |
| 47 | bb.writeBytes(byteArray); |
| 48 | } |
| 49 | |
| 50 | public static List<OFPhysicalPort> readPhysicalPortList(final ChannelBuffer bb, |
| 51 | final int i) { |
| 52 | // TODO Auto-generated method stub |
| 53 | return null; |
| 54 | } |
| 55 | |
| 56 | public static List<OFInstruction> readInstructionsList(final ChannelBuffer bb, |
| 57 | final int i) { |
| 58 | // TODO Auto-generated method stub |
| 59 | return null; |
| 60 | } |
| 61 | |
| 62 | public static Match readOFMatch(final ChannelBuffer bb) { |
| 63 | // TODO Auto-generated method stub |
| 64 | return null; |
| 65 | } |
| 66 | |
| 67 | public static OFFlowModCmd readOFFlowModCmd(final ChannelBuffer bb) { |
| 68 | // TODO Auto-generated method stub |
| 69 | return null; |
| 70 | } |
| 71 | |
| 72 | public static List<OFAction> readActionsList(final ChannelBuffer bb, final int i) { |
| 73 | // TODO Auto-generated method stub |
| 74 | return null; |
| 75 | } |
| 76 | |
| 77 | public static List<OFBsnInterface> readBsnInterfaceList(final ChannelBuffer bb) { |
| 78 | // TODO Auto-generated method stub |
| 79 | return null; |
| 80 | } |
| 81 | |
| 82 | public static OFPhysicalPort readPhysicalPort(final ChannelBuffer bb) { |
| 83 | // TODO Auto-generated method stub |
| 84 | return null; |
| 85 | } |
| 86 | |
| 87 | public static List<OFPacketQueue> readPacketQueueList(final ChannelBuffer bb, |
| 88 | final int i) { |
| 89 | // TODO Auto-generated method stub |
| 90 | return null; |
| 91 | } |
| 92 | |
| 93 | public static List<OFHelloElement> readHelloElementList(final ChannelBuffer bb) { |
| 94 | // TODO Auto-generated method stub |
| 95 | return null; |
| 96 | } |
| 97 | |
| 98 | public static List<OFBucket> readBucketList(final ChannelBuffer bb, final int i) { |
| 99 | // TODO Auto-generated method stub |
| 100 | return null; |
| 101 | } |
| 102 | |
| 103 | public static List<OFMeterBand> readMeterBandList(final ChannelBuffer bb) { |
| 104 | // TODO Auto-generated method stub |
| 105 | return null; |
| 106 | } |
| 107 | |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 108 | public static void writeOFMatch(ChannelBuffer bb, Match match) { |
| 109 | // TODO Auto-generated method stub |
| 110 | |
| 111 | } |
| 112 | |
| 113 | public static void writeList(ChannelBuffer bb, List<?> ports) { |
| 114 | // TODO Auto-generated method stub |
| 115 | |
| 116 | } |
| 117 | |
| 118 | public static void writeOFFlowModCmd(ChannelBuffer bb, OFFlowModCmd command) { |
| 119 | // TODO Auto-generated method stub |
| 120 | |
| 121 | } |
| 122 | |
| 123 | public static String readFixedLengthString(ChannelBuffer bb, int length) { |
| 124 | byte[] dst = new byte[length]; |
| 125 | bb.readBytes(dst, 0, length); |
| 126 | return new String(dst, Charsets.US_ASCII); |
| 127 | } |
| 128 | |
| 129 | public static void writeFixedLengthString(ChannelBuffer bb, String string, int length) { |
| 130 | int l = string.length(); |
| 131 | if(l > length) { |
| 132 | throw new IllegalArgumentException("Error writing string: length="+l+" > max Length="+length); |
| 133 | } |
| 134 | bb.writeBytes(string.getBytes(Charsets.US_ASCII)); |
| 135 | if(l < length) { |
| 136 | bb.writeZero(length - l); |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | public static void writeBsnInterfaceList(ChannelBuffer bb, List<OFBsnInterface> interfaces) { |
| 141 | // TODO Auto-generated method stub |
| 142 | |
| 143 | } |
| 144 | |
| 145 | public static void writeTableFeatureList(ChannelBuffer bb, |
| 146 | List<OFTableFeature> entries) { |
| 147 | // TODO Auto-generated method stub |
| 148 | |
| 149 | } |
| 150 | |
| 151 | public static void writeBsnInterface(ChannelBuffer bb, |
| 152 | List<OFBsnInterface> interfaces) { |
| 153 | // TODO Auto-generated method stub |
| 154 | |
| 155 | } |
| 156 | |
| 157 | public static void writeFlowStatsEntry(ChannelBuffer bb, |
| 158 | List<OFFlowStatsEntry> entries) { |
| 159 | // TODO Auto-generated method stub |
| 160 | |
| 161 | } |
| 162 | |
| 163 | public static List<OFFlowStatsEntry> readFlowStatsEntry(ChannelBuffer bb) { |
| 164 | // TODO Auto-generated method stub |
| 165 | return null; |
| 166 | } |
| 167 | |
| 168 | public static void writeTableStatsEntryList(ChannelBuffer bb, |
| 169 | List<OFTableStatsEntry> entries) { |
| 170 | // TODO Auto-generated method stub |
| 171 | |
| 172 | } |
| 173 | |
| 174 | public static List<OFTableStatsEntry> readTableStatsEntryList( |
| 175 | ChannelBuffer bb) { |
| 176 | // TODO Auto-generated method stub |
| 177 | return null; |
| 178 | } |
| 179 | |
| 180 | public static List<OFFlowStatsEntry> readFlowStatsEntryList(ChannelBuffer bb) { |
| 181 | // TODO Auto-generated method stub |
| 182 | return null; |
| 183 | } |
| 184 | |
| 185 | public static void writeFlowStatsEntryList(ChannelBuffer bb, |
| 186 | List<OFFlowStatsEntry> entries) { |
| 187 | // TODO Auto-generated method stub |
| 188 | |
| 189 | } |
| 190 | |
| 191 | public static void writeGroupDescStatsEntryList(ChannelBuffer bb, |
| 192 | List<OFGroupDescStatsEntry> entries) { |
| 193 | // TODO Auto-generated method stub |
| 194 | |
| 195 | } |
| 196 | |
| 197 | public static List<OFGroupDescStatsEntry> readGroupDescStatsEntryList( |
| 198 | ChannelBuffer bb) { |
| 199 | // TODO Auto-generated method stub |
| 200 | return null; |
| 201 | } |
| 202 | |
| 203 | public static void writeOFBsnVportQInQT(ChannelBuffer bb, |
| 204 | OFBsnVportQInQT vport) { |
| 205 | // TODO Auto-generated method stub |
| 206 | |
| 207 | } |
| 208 | |
| 209 | public static void writeMeterBandList(ChannelBuffer bb, |
| 210 | List<OFMeterBand> entries) { |
| 211 | // TODO Auto-generated method stub |
| 212 | |
| 213 | } |
| 214 | |
| 215 | public static int writeActionsList(ChannelBuffer bb, List<OFAction> actions) { |
| 216 | // TODO Auto-generated method stub |
| 217 | return 0; |
| 218 | } |
| 219 | |
| 220 | public static OFBsnVportQInQ readOFBsnVportQInQ(ChannelBuffer bb) { |
| 221 | // TODO Auto-generated method stub |
| 222 | return null; |
| 223 | } |
| 224 | |
| 225 | public static void writePortStatsEntryList(ChannelBuffer bb, |
| 226 | List<OFPortStatsEntry> entries) { |
| 227 | // TODO Auto-generated method stub |
| 228 | |
| 229 | } |
| 230 | |
| 231 | public static void write(ChannelBuffer bb, OFPhysicalPort desc) { |
| 232 | // TODO Auto-generated method stub |
| 233 | |
| 234 | } |
| 235 | |
| 236 | public static List<OFPortStatsEntry> readPortStatsEntryList(ChannelBuffer bb) { |
| 237 | // TODO Auto-generated method stub |
| 238 | return null; |
| 239 | } |
| 240 | |
| 241 | public static void writeOFBsnVportQInQ(ChannelBuffer bb, |
| 242 | OFBsnVportQInQ vport) { |
| 243 | // TODO Auto-generated method stub |
| 244 | |
| 245 | } |
| 246 | |
| 247 | public static List<OFHelloElem> readHelloElemList(ChannelBuffer bb) { |
| 248 | // TODO Auto-generated method stub |
| 249 | return null; |
| 250 | } |
| 251 | |
| 252 | public static void writeHelloElemList(ChannelBuffer bb, |
| 253 | List<OFHelloElem> elements) { |
| 254 | // TODO Auto-generated method stub |
| 255 | |
| 256 | } |
| 257 | |
| 258 | public static List<OFGroupStatsEntry> readGroupStatsEntryList( |
| 259 | ChannelBuffer bb) { |
| 260 | // TODO Auto-generated method stub |
| 261 | return null; |
| 262 | } |
| 263 | |
| 264 | public static void writeGroupStatsEntryList(ChannelBuffer bb, |
| 265 | List<OFGroupStatsEntry> entries) { |
| 266 | // TODO Auto-generated method stub |
| 267 | |
| 268 | } |
| 269 | |
| 270 | public static List<OFQueueStatsEntry> readQueueStatsEntryList( |
| 271 | ChannelBuffer bb) { |
| 272 | // TODO Auto-generated method stub |
| 273 | return null; |
| 274 | } |
| 275 | |
| 276 | public static void writeQueueStatsEntryList(ChannelBuffer bb, |
| 277 | List<OFQueueStatsEntry> entries) { |
| 278 | // TODO Auto-generated method stub |
| 279 | |
| 280 | } |
| 281 | |
| 282 | public static OFMeterFeatures readOFMeterFeatures(ChannelBuffer bb) { |
| 283 | // TODO Auto-generated method stub |
| 284 | return null; |
| 285 | } |
| 286 | |
| 287 | public static void writeOFMeterFeatures(ChannelBuffer bb, |
| 288 | OFMeterFeatures features) { |
| 289 | // TODO Auto-generated method stub |
| 290 | |
| 291 | } |
| 292 | |
| 293 | public static List<OFMeterStats> readMeterStatsList(ChannelBuffer bb) { |
| 294 | // TODO Auto-generated method stub |
| 295 | return null; |
| 296 | } |
| 297 | |
| 298 | public static void writeMeterStatsList(ChannelBuffer bb, |
| 299 | List<OFMeterStats> entries) { |
| 300 | // TODO Auto-generated method stub |
| 301 | |
| 302 | } |
| 303 | |
| 304 | public static List<OFTableFeatures> readTableFeaturesList(ChannelBuffer bb) { |
| 305 | // TODO Auto-generated method stub |
| 306 | return null; |
| 307 | } |
| 308 | |
| 309 | public static void writeTableFeaturesList(ChannelBuffer bb, |
| 310 | List<OFTableFeatures> entries) { |
| 311 | // TODO Auto-generated method stub |
| 312 | |
| 313 | } |
| 314 | |
| 315 | |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 316 | } |