Rich Lane | 2e67201 | 2015-01-02 15:39:22 -0800 | [diff] [blame] | 1 | // Copyright 2015, Big Switch Networks, Inc. |
| 2 | // |
| 3 | // LoxiGen is licensed under the Eclipse Public License, |
| 4 | // version 1.0 (EPL), with the following special exception: |
| 5 | // |
| 6 | // LOXI Exception |
| 7 | // |
| 8 | // As a special exception to the terms of the EPL, you may |
| 9 | // distribute libraries generated by LoxiGen (LoxiGen Libraries) |
| 10 | // under the terms of your choice, provided that copyright and |
| 11 | // licensing notices generated by LoxiGen are not altered or removed |
| 12 | // from the LoxiGen Libraries and the notice provided below is (i) |
| 13 | // included in the LoxiGen Libraries, if distributed in source code |
| 14 | // form and (ii) included in any documentation for the LoxiGen |
| 15 | // Libraries, if distributed in binary form. |
| 16 | // |
| 17 | // Notice: "Copyright 2013, Big Switch Networks, Inc. |
| 18 | // This library was generated by the LoxiGen Compiler." |
| 19 | // |
| 20 | // You may not use this file except in compliance with the EPL or |
| 21 | // LOXI Exception. You may obtain a copy of the EPL at: |
| 22 | // |
| 23 | // http://www.eclipse.org/legal/epl-v10.html |
| 24 | // |
| 25 | // Unless required by applicable law or agreed to in writing, |
| 26 | // software distributed under the License is distributed on an "AS |
| 27 | // IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 28 | // express or implied. See the EPL for the specific language |
| 29 | // governing permissions and limitations under the EPL. |
| 30 | |
| 31 | // IVS supports running sandboxed Lua code as the forwarding pipeline. |
Rich Lane | 4559707 | 2015-01-09 15:38:25 -0800 | [diff] [blame] | 32 | // This extension allows the controller to upload the Lua code, send |
| 33 | // commands to it, and receive async notifications. |
| 34 | // |
| 35 | // Most of the data passed between the controller and the Lua code is |
| 36 | // opaque to the rest of the switch. It's assumed that the controller |
| 37 | // is tightly coupled to the Lua code it uploaded, so there's no need |
| 38 | // to version the protocol between them. |
Rich Lane | 2e67201 | 2015-01-02 15:39:22 -0800 | [diff] [blame] | 39 | |
| 40 | #version 4 |
| 41 | #version 5 |
| 42 | |
| 43 | // Upload chunks of Lua code to the switch |
| 44 | // |
| 45 | // If the MORE flag is not set, the old VM will be cleaned up and |
| 46 | // a new VM will be initialized with the uploaded code. Each chunk |
| 47 | // of code is executed in the VM in the order it was received. |
| 48 | // |
| 49 | // If the FORCE flag is not set, the switch will check to see if the |
| 50 | // old and new code is identical. If they are identical the message |
| 51 | // will be ignored. |
| 52 | // |
| 53 | // As part of the VM cleanup, all gentables registered by Lua code |
| 54 | // will be unregistered. |
| 55 | // |
| 56 | // Consecutive messages with the same filename are concatenated, |
| 57 | // to support chunks larger than 64K. |
| 58 | |
| 59 | enum ofp_bsn_lua_upload_flags(wire_type=uint16_t, bitmask=True) { |
| 60 | OFP_BSN_LUA_UPLOAD_MORE = 0x1, |
| 61 | OFP_BSN_LUA_UPLOAD_FORCE = 0x2, |
| 62 | }; |
| 63 | |
| 64 | struct of_bsn_lua_upload : of_bsn_header { |
| 65 | uint8_t version; |
| 66 | uint8_t type == 4; |
| 67 | uint16_t length; |
| 68 | uint32_t xid; |
| 69 | uint32_t experimenter == 0x5c16c7; |
| 70 | uint32_t subtype == 64; |
| 71 | enum ofp_bsn_lua_upload_flags flags; |
| 72 | of_str64_t filename; |
| 73 | of_octets_t data; |
| 74 | }; |
Rich Lane | 4559707 | 2015-01-09 15:38:25 -0800 | [diff] [blame] | 75 | |
| 76 | // Send a command to Lua |
| 77 | |
| 78 | struct of_bsn_lua_command_request : of_bsn_header { |
| 79 | uint8_t version; |
| 80 | uint8_t type == 4; |
| 81 | uint16_t length; |
| 82 | uint32_t xid; |
| 83 | uint32_t experimenter == 0x5c16c7; |
| 84 | uint32_t subtype == 65; |
| 85 | of_octets_t data; |
| 86 | }; |
| 87 | |
| 88 | struct of_bsn_lua_command_reply : of_bsn_header { |
| 89 | uint8_t version; |
| 90 | uint8_t type == 4; |
| 91 | uint16_t length; |
| 92 | uint32_t xid; |
| 93 | uint32_t experimenter == 0x5c16c7; |
| 94 | uint32_t subtype == 66; |
| 95 | of_octets_t data; |
| 96 | }; |
| 97 | |
| 98 | // Async message from Lua to the controller |
| 99 | |
| 100 | struct of_bsn_lua_notification : of_bsn_header { |
| 101 | uint8_t version; |
| 102 | uint8_t type == 4; |
| 103 | uint16_t length; |
| 104 | uint32_t xid; |
| 105 | uint32_t experimenter == 0x5c16c7; |
| 106 | uint32_t subtype == 67; |
| 107 | of_octets_t data; |
| 108 | }; |