Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 1 | package net.floodlightcontroller.util; |
| 2 | |
| 3 | /** |
| 4 | * The class representing the Flow Entry error state. |
| 5 | */ |
| 6 | public class FlowEntryErrorState { |
| 7 | private short type; // The error type (e.g., see OF-1.3.1 spec, pp. 95) |
| 8 | private short code; // The error code (e.g., see OF-1.3.1 spec, pp. 95) |
| 9 | |
| 10 | /** |
| 11 | * Default constructor. |
| 12 | */ |
| 13 | public FlowEntryErrorState() { |
| 14 | this.type = 0; |
| 15 | this.code = 0; |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Constructor for a given error type and code. |
| 20 | * |
| 21 | * @param type the error type to use. |
| 22 | * @param code the error code to use. |
| 23 | */ |
| 24 | public FlowEntryErrorState(short type, short code) { |
| 25 | this.type = type; |
| 26 | this.code = code; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Get the error type. |
| 31 | * |
| 32 | * @return the error type. |
| 33 | */ |
| 34 | public short type() { return type; } |
| 35 | |
| 36 | /** |
| 37 | * Get the error code. |
| 38 | * |
| 39 | * @return the error code. |
| 40 | */ |
| 41 | public short code() { return code; } |
| 42 | |
| 43 | /** |
| 44 | * Set the values of the error type and code. |
| 45 | * |
| 46 | * @param type the error type to use. |
| 47 | * @param code the error code to use. |
| 48 | */ |
| 49 | public void setValue(short type, short code) { |
| 50 | this.type = type; |
| 51 | this.code = code; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Convert the error type and code to a string. |
| 56 | * |
| 57 | * @return the error type and code as a string. |
| 58 | */ |
| 59 | @Override |
| 60 | public String toString() { |
| 61 | String ret = ""; |
| 62 | // TODO: Implement it! |
| 63 | return ret; |
| 64 | } |
| 65 | } |