Rich Lane | 64585d9 | 2013-10-02 16:01:37 -0700 | [diff] [blame] | 1 | # Copyright 2013, Big Switch Networks, Inc. |
| 2 | # |
| 3 | # LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with |
| 4 | # the following special exception: |
| 5 | # |
| 6 | # LOXI Exception |
| 7 | # |
| 8 | # As a special exception to the terms of the EPL, you may distribute libraries |
| 9 | # generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided |
| 10 | # that copyright and licensing notices generated by LoxiGen are not altered or removed |
| 11 | # from the LoxiGen Libraries and the notice provided below is (i) included in |
| 12 | # the LoxiGen Libraries, if distributed in source code form and (ii) included in any |
| 13 | # documentation for the LoxiGen Libraries, if distributed in binary form. |
| 14 | # |
| 15 | # Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler." |
| 16 | # |
| 17 | # You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain |
| 18 | # a copy of the EPL at: |
| 19 | # |
| 20 | # http://www.eclipse.org/legal/epl-v10.html |
| 21 | # |
| 22 | # Unless required by applicable law or agreed to in writing, software |
| 23 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 24 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 25 | # EPL for the specific language governing permissions and limitations |
| 26 | # under the EPL. |
| 27 | |
| 28 | # Map from LOXI types to Wireshark types |
| 29 | oftype_to_wireshark_type = { |
Rich Lane | 4df40f3 | 2013-10-08 15:40:39 -0700 | [diff] [blame] | 30 | "char": "int8", |
| 31 | "uint8_t": "uint8", |
| 32 | "uint16_t": "uint16", |
| 33 | "uint32_t": "uint32", |
| 34 | "uint64_t": "uint64", |
| 35 | "of_mac_addr_t": "ether", |
| 36 | "of_ipv4_t": "ipv4", |
| 37 | "of_ipv6_t": "ipv6", |
| 38 | "of_port_name_t": "stringz", |
| 39 | "of_table_name_t": "stringz", |
| 40 | "of_desc_str_t": "stringz", |
| 41 | "of_serial_num_t": "stringz", |
| 42 | "of_octets_t": "bytes", |
| 43 | "of_port_no_t": "uint32", |
| 44 | "of_port_desc_t": "stringz", |
| 45 | "of_bsn_vport_t": "bytes", |
| 46 | "of_bsn_vport_q_in_q_t": "bytes", |
| 47 | "of_fm_cmd_t": "uint16", |
| 48 | "of_wc_bmap_t": "uint64", |
| 49 | "of_match_bmap_t": "uint64", |
| 50 | "of_match_t": "bytes", |
| 51 | "of_oxm_t": "bytes", |
| 52 | "of_meter_features_t": "bytes", |
Rich Lane | 9d25b08 | 2013-10-08 15:53:33 -0700 | [diff] [blame] | 53 | "of_bitmap_128_t": "bytes", |
Rich Lane | 64585d9 | 2013-10-02 16:01:37 -0700 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | # Map from LOXI type to Wireshark base |
| 57 | oftype_to_base = { |
| 58 | "char": "DEC", |
| 59 | "uint8_t": "DEC", |
| 60 | "uint16_t": "DEC", |
| 61 | "uint32_t": "DEC", |
| 62 | "uint64_t": "DEC", |
| 63 | "of_mac_addr_t": "NONE", |
| 64 | "of_ipv4_t": "NONE", |
| 65 | "of_ipv6_t": "NONE", |
| 66 | "of_port_name_t": "NONE", |
| 67 | "of_table_name_t": "NONE", |
| 68 | "of_desc_str_t": "NONE", |
| 69 | "of_serial_num_t": "NONE", |
| 70 | "of_octets_t": "NONE", |
| 71 | "of_port_no_t": "DEC", |
| 72 | "of_port_desc_t": "NONE", |
| 73 | "of_bsn_vport_t": "NONE", |
| 74 | "of_bsn_vport_q_in_q_t": "NONE", |
| 75 | "of_fm_cmd_t": "DEC", |
| 76 | "of_wc_bmap_t": "HEX", |
| 77 | "of_match_bmap_t": "HEX", |
| 78 | "of_match_t": "NONE", |
| 79 | "of_oxm_t": "NONE", |
| 80 | "of_meter_features_t": "NONE", |
Rich Lane | 9d25b08 | 2013-10-08 15:53:33 -0700 | [diff] [blame] | 81 | "of_bitmap_128_t": "NONE", |
Rich Lane | 64585d9 | 2013-10-02 16:01:37 -0700 | [diff] [blame] | 82 | } |
| 83 | |
Rich Lane | 5245266 | 2013-10-25 13:34:42 -0700 | [diff] [blame] | 84 | # Use enums for certain fields where it isn't specified in the LOXI input |
| 85 | class_field_to_enum = { |
| 86 | ('of_flow_mod', 'type'): 'ofp_type', |
| 87 | ('of_error_msg', 'type'): 'ofp_type', |
| 88 | ('of_stats_request', 'type'): 'ofp_type', |
| 89 | ('of_stats_request', 'stats_type'): 'ofp_stats_type', |
| 90 | ('of_stats_request', 'flags'): 'ofp_stats_request_flags', |
| 91 | ('of_stats_reply', 'type'): 'ofp_type', |
| 92 | ('of_stats_reply', 'stats_type'): 'ofp_stats_type', |
| 93 | ('of_stats_reply', 'flags'): 'ofp_stats_reply_flags', |
| 94 | ('of_flow_mod', 'table_id'): 'ofp_table', |
| 95 | ('of_flow_mod', '_command'): 'ofp_flow_mod_command', |
| 96 | ('of_flow_mod', 'out_port'): 'ofp_port', |
| 97 | ('of_flow_mod', 'out_group'): 'ofp_group', |
| 98 | ('of_error_msg', 'err_type'): 'ofp_error_type', |
| 99 | ('of_port_mod', 'type'): 'ofp_type', |
| 100 | ('of_hello', 'type'): 'ofp_type', |
| 101 | ('of_features_request', 'type'): 'ofp_type', |
| 102 | ('of_features_reply', 'type'): 'ofp_type', |
| 103 | ('of_barrier_request', 'type'): 'ofp_type', |
| 104 | ('of_barrier_reply', 'type'): 'ofp_type', |
| 105 | ('of_echo_request', 'type'): 'ofp_type', |
| 106 | ('of_echo_reply', 'type'): 'ofp_type', |
Tomasz | db2045d | 2013-10-25 02:29:23 -0700 | [diff] [blame] | 107 | ('of_match_v3', 'type'): 'ofp_match_type', |
| 108 | ('of_action_set_nw_ttl', 'type'): 'ofp_action_type', |
| 109 | ('of_action_output', 'type'): 'ofp_action_type', |
| 110 | ('of_action_group', 'type'): 'ofp_action_type', |
| 111 | ('of_action_id', 'type'): 'ofp_action_type', |
| 112 | ('of_instruction_apply_actions', 'type'): 'ofp_instruction_type', |
| 113 | ('of_instruction_write_actions', 'type'): 'ofp_instruction_type', |
Tomasz | a17a669 | 2013-10-30 17:34:18 -0700 | [diff] [blame] | 114 | ('of_group_mod', 'group_type'): 'ofp_group_type', |
| 115 | ('of_group_mod', 'type'): 'ofp_type', |
Tomasz | 5e7ffbf | 2013-11-02 15:09:02 -0700 | [diff] [blame] | 116 | ('of_group_mod', 'command'): 'ofp_group_mod_command', |
Tomasz | a17a669 | 2013-10-30 17:34:18 -0700 | [diff] [blame] | 117 | ('of_group_mod', 'group_id'): 'ofp_group', |
Tomasz | 5e7ffbf | 2013-11-02 15:09:02 -0700 | [diff] [blame] | 118 | ('of_packet_out', 'type'): 'ofp_type', |
| 119 | ('of_packet_in', 'type'): 'ofp_type', |
| 120 | ('of_packet_in', 'reason'): 'ofp_packet_in_reason', |
| 121 | ('of_flow_stats_request', 'type'): 'ofp_type', |
| 122 | ('of_flow_stats_request', 'stats_type'): 'ofp_stats_type', |
| 123 | ('of_desc_stats_request', 'type'): 'ofp_type', |
| 124 | ('of_desc_stats_request', 'stats_type'): 'ofp_stats_type', |
| 125 | ('of_queue_stats_request', 'type'): 'ofp_type', |
| 126 | ('of_queue_stats_request', 'stats_type'): 'ofp_stats_type', |
| 127 | ('of_port_stats_request', 'type'): 'ofp_type', |
| 128 | ('of_port_stats_request', 'stats_type'): 'ofp_stats_type', |
| 129 | ('of_table_stats_request', 'type'): 'ofp_type', |
| 130 | ('of_table_stats_request', 'stats_type'): 'ofp_stats_type', |
| 131 | ('of_port_desc_stats_request', 'type'): 'ofp_type', |
| 132 | ('of_port_desc_stats_request', 'stats_type'): 'ofp_stats_type', |
| 133 | ('of_meter_stats_request', 'type'): 'ofp_type', |
| 134 | ('of_meter_stats_request', 'stats_type'): 'ofp_stats_type', |
| 135 | ('of_meter_features_stats_request', 'type'): 'ofp_type', |
| 136 | ('of_meter_features_stats_request', 'stats_type'): 'ofp_stats_type', |
| 137 | ('of_meter_config_stats_request', 'type'): 'ofp_type', |
| 138 | ('of_meter_config_stats_request', 'stats_type'): 'ofp_stats_type', |
| 139 | ('of_group_stats_request', 'type'): 'ofp_type', |
| 140 | ('of_group_stats_request', 'stats_type'): 'ofp_stats_type', |
| 141 | ('of_group_features_stats_request', 'type'): 'ofp_type', |
| 142 | ('of_group_features_stats_request', 'stats_type'): 'ofp_stats_type', |
| 143 | ('of_group_desc_stats_request', 'type'): 'ofp_type', |
| 144 | ('of_group_desc_stats_request', 'stats_type'): 'ofp_stats_type', |
| 145 | ('of_aggregate_stats_request', 'type'): 'ofp_type', |
| 146 | ('of_aggregate_stats_request', 'stats_type'): 'ofp_stats_type', |
| 147 | ('of_async_get_request', 'type'): 'ofp_type', |
| 148 | ('of_flow_stats_reply', 'type'): 'ofp_type', |
| 149 | ('of_flow_stats_reply', 'stats_type'): 'ofp_stats_type', |
| 150 | ('of_desc_stats_reply', 'type'): 'ofp_type', |
| 151 | ('of_desc_stats_reply', 'stats_type'): 'ofp_stats_type', |
| 152 | ('of_queue_stats_reply', 'type'): 'ofp_type', |
| 153 | ('of_queue_stats_reply', 'stats_type'): 'ofp_stats_type', |
| 154 | ('of_port_stats_reply', 'type'): 'ofp_type', |
| 155 | ('of_port_stats_reply', 'stats_type'): 'ofp_stats_type', |
| 156 | ('of_table_stats_reply', 'type'): 'ofp_type', |
| 157 | ('of_table_stats_reply', 'stats_type'): 'ofp_stats_type', |
| 158 | ('of_port_desc_stats_reply', 'type'): 'ofp_type', |
| 159 | ('of_port_desc_stats_reply', 'stats_type'): 'ofp_stats_type', |
| 160 | ('of_aggregate_stats_reply', 'type'): 'ofp_type', |
| 161 | ('of_aggregate_stats_reply', 'stats_type'): 'ofp_stats_type', |
Rich Lane | 5245266 | 2013-10-25 13:34:42 -0700 | [diff] [blame] | 162 | } |
| 163 | |
Rich Lane | 64585d9 | 2013-10-02 16:01:37 -0700 | [diff] [blame] | 164 | # Override oftype_to_base for certain field names |
| 165 | field_to_base = { |
| 166 | "eth_type": "HEX", |
| 167 | "cookie": "HEX", |
| 168 | "datapath_id": "HEX", |
| 169 | } |