Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 1 | # |
| 2 | # Interface definition for packetstreamer service |
| 3 | # |
| 4 | |
| 5 | namespace java net.floodlightcontroller.packetstreamer.thrift |
| 6 | namespace cpp net.floodlightcontroller.packetstreamer |
| 7 | namespace py packetstreamer |
| 8 | namespace php packetstreamer |
| 9 | namespace perl packetstreamer |
| 10 | |
| 11 | const string VERSION = "0.1.0" |
| 12 | |
| 13 | # |
| 14 | # data structures |
| 15 | # |
| 16 | |
| 17 | /** |
| 18 | * OFMessage type |
| 19 | **/ |
| 20 | enum OFMessageType { |
| 21 | HELLO = 0, |
| 22 | ERROR = 1, |
| 23 | ECHO_REQUEST = 2, |
| 24 | ECHO_REPLY = 3, |
| 25 | VENDOR = 4, |
| 26 | FEATURES_REQUEST = 5, |
| 27 | FEATURES_REPLY = 6, |
| 28 | GET_CONFIG_REQUEST = 7, |
| 29 | GET_CONFIG_REPLY = 8, |
| 30 | SET_CONFIG = 9, |
| 31 | PACKET_IN = 10, |
| 32 | FLOW_REMOVED = 11, |
| 33 | PORT_STATUS = 12, |
| 34 | PACKET_OUT = 13, |
| 35 | FLOW_MOD = 14, |
| 36 | PORT_MOD = 15, |
| 37 | STATS_REQUEST = 16, |
| 38 | STATS_REPLY = 17, |
| 39 | BARRIER_REQUEST = 18, |
| 40 | BARRIER_REPLY = 19, |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * A struct that defines switch port tuple |
| 45 | */ |
| 46 | struct SwitchPortTuple { |
| 47 | 1: i64 dpid, |
| 48 | 2: i16 port, |
| 49 | } |
| 50 | |
| 51 | struct Packet { |
| 52 | 1: OFMessageType messageType, |
| 53 | 2: SwitchPortTuple swPortTuple, |
| 54 | 3: binary data, |
| 55 | } |
| 56 | |
| 57 | struct Message { |
| 58 | 1: list<string> sessionIDs, |
| 59 | 2: Packet packet, |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Packetstreamer API |
| 64 | */ |
| 65 | service PacketStreamer { |
| 66 | |
| 67 | /** |
| 68 | * Synchronous method to get packets for a given sessionid |
| 69 | */ |
| 70 | list<binary> getPackets(1:string sessionid), |
| 71 | |
| 72 | /** |
| 73 | * Synchronous method to publish a packet. |
| 74 | * It ensure the order that the packets are pushed |
| 75 | */ |
| 76 | i32 pushMessageSync(1:Message packet), |
| 77 | |
| 78 | /** |
| 79 | * Asynchronous method to publish a packet. |
| 80 | * Order is not guaranteed. |
| 81 | */ |
| 82 | oneway void pushMessageAsync(1:Message packet) |
| 83 | |
| 84 | /** |
| 85 | * Terminate a session |
| 86 | */ |
| 87 | void terminateSession(1:string sessionid) |
| 88 | } |