Rich Lane | b1f347d | 2013-05-16 16:39:12 -0700 | [diff] [blame] | 1 | -- binary |
| 2 | 01 0d # version/type |
| 3 | 00 23 # length |
| 4 | 12 34 56 78 # xid |
| 5 | ab cd ef 01 # buffer_id |
| 6 | ff fe # in_port |
| 7 | 00 10 # actions_len |
| 8 | 00 00 # actions[0].type |
| 9 | 00 08 # actions[0].len |
| 10 | 00 01 # actions[0].port |
| 11 | 00 00 # actions[0].max_len |
| 12 | 00 00 # actions[1].type |
| 13 | 00 08 # actions[1].len |
| 14 | 00 02 # actions[1].port |
| 15 | 00 00 # actions[1].max_len |
| 16 | 61 62 63 # data |
| 17 | -- python |
| 18 | ofp.message.packet_out( |
| 19 | xid=0x12345678, |
| 20 | buffer_id=0xabcdef01, |
| 21 | in_port=ofp.OFPP_LOCAL, |
| 22 | actions=[ |
| 23 | ofp.action.output(port=1), |
| 24 | ofp.action.output(port=2)], |
| 25 | data='abc') |
Rich Lane | ccae031 | 2013-07-21 23:34:13 -0700 | [diff] [blame] | 26 | -- c |
| 27 | obj = of_packet_out_new(OF_VERSION_1_0); |
| 28 | of_packet_out_buffer_id_set(obj, 2882400001); |
| 29 | of_packet_out_in_port_set(obj, 65534); |
| 30 | of_packet_out_xid_set(obj, 305419896); |
| 31 | { |
| 32 | of_object_t *list = of_list_action_new(OF_VERSION_1_0); |
| 33 | { |
| 34 | of_object_t *obj = of_action_output_new(OF_VERSION_1_0); |
| 35 | of_action_output_max_len_set(obj, 0); |
| 36 | of_action_output_port_set(obj, 1); |
| 37 | of_list_append(list, obj); |
| 38 | of_object_delete(obj); |
| 39 | } |
| 40 | { |
| 41 | of_object_t *obj = of_action_output_new(OF_VERSION_1_0); |
| 42 | of_action_output_max_len_set(obj, 0); |
| 43 | of_action_output_port_set(obj, 2); |
| 44 | of_list_append(list, obj); |
| 45 | of_object_delete(obj); |
| 46 | } |
| 47 | of_packet_out_actions_set(obj, list); |
| 48 | of_object_delete(list); |
| 49 | } |
| 50 | { |
| 51 | of_octets_t data = { .bytes=3, .data=(uint8_t *)"\x61\x62\x63" }; |
| 52 | of_packet_out_data_set(obj, &data); |
| 53 | } |