Neale Ranns | b8d4481 | 2017-11-10 06:53:54 -0800 | [diff] [blame] | 1 | /* |
Neale Ranns | 50f0ac0 | 2019-05-15 02:13:37 -0700 | [diff] [blame] | 2 | * Copyright (c) 2015-2019 Cisco and/or its affiliates. |
Neale Ranns | b8d4481 | 2017-11-10 06:53:54 -0800 | [diff] [blame] | 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | |
Jakub Grajciar | f72ad93 | 2019-10-09 14:15:56 +0200 | [diff] [blame] | 16 | option version = "2.2.1"; |
Neale Ranns | 50f0ac0 | 2019-05-15 02:13:37 -0700 | [diff] [blame] | 17 | import "vnet/ip/ip_types.api"; |
Pavel Kotucek | e88865d | 2018-11-28 07:42:11 +0100 | [diff] [blame] | 18 | |
Neale Ranns | 50f0ac0 | 2019-05-15 02:13:37 -0700 | [diff] [blame] | 19 | /** \brief The types of packets to be punted |
Pavel Kotucek | e88865d | 2018-11-28 07:42:11 +0100 | [diff] [blame] | 20 | */ |
Neale Ranns | 50f0ac0 | 2019-05-15 02:13:37 -0700 | [diff] [blame] | 21 | enum punt_type |
Pavel Kotucek | e88865d | 2018-11-28 07:42:11 +0100 | [diff] [blame] | 22 | { |
Neale Ranns | 50f0ac0 | 2019-05-15 02:13:37 -0700 | [diff] [blame] | 23 | /* L4 (UDP) packets */ |
| 24 | PUNT_API_TYPE_L4, |
Neale Ranns | b538dd8 | 2019-05-21 06:54:54 -0700 | [diff] [blame] | 25 | /* IP proto (i.e. OSPF, RIP, etc) packets */ |
| 26 | PUNT_API_TYPE_IP_PROTO, |
Neale Ranns | 50f0ac0 | 2019-05-15 02:13:37 -0700 | [diff] [blame] | 27 | /* Exception packets handled by the VLIB punt infra */ |
| 28 | PUNT_API_TYPE_EXCEPTION, |
| 29 | }; |
| 30 | |
| 31 | /** \brief Punt L4 traffic definition |
| 32 | @param af - Address Family, IPv4 or IPV6 |
| 33 | @param protocol - L4 protocol to be punted |
| 34 | @param port - TCP/UDP port to be punted |
| 35 | */ |
| 36 | typedef punt_l4 |
| 37 | { |
| 38 | vl_api_address_family_t af; |
| 39 | vl_api_ip_proto_t protocol; |
| 40 | u16 port; |
| 41 | }; |
| 42 | |
Neale Ranns | b538dd8 | 2019-05-21 06:54:54 -0700 | [diff] [blame] | 43 | /** \brief Punt IP protocol traffic definition |
| 44 | @param af - Address Family, IPv4 or IPV6 |
| 45 | @param protocol - IP protocol to be punted |
| 46 | */ |
| 47 | typedef punt_ip_proto |
| 48 | { |
| 49 | vl_api_address_family_t af; |
| 50 | vl_api_ip_proto_t protocol; |
| 51 | }; |
| 52 | |
Neale Ranns | 50f0ac0 | 2019-05-15 02:13:37 -0700 | [diff] [blame] | 53 | /** \brief The ID of the punt exception reason |
| 54 | Dump all the reasons to obtain this |
| 55 | */ |
| 56 | typedef punt_exception |
| 57 | { |
| 58 | u32 id; |
| 59 | }; |
| 60 | |
| 61 | /** \brief Union of the different punt packet descriptions |
| 62 | */ |
| 63 | union punt_union |
| 64 | { |
| 65 | vl_api_punt_exception_t exception; |
| 66 | vl_api_punt_l4_t l4; |
Neale Ranns | b538dd8 | 2019-05-21 06:54:54 -0700 | [diff] [blame] | 67 | vl_api_punt_ip_proto_t ip_proto; |
Neale Ranns | 50f0ac0 | 2019-05-15 02:13:37 -0700 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | /** \brief Full description of which packets are requested to be punted |
| 71 | @param type - Which packet type |
| 72 | @param punt - Description corresponding to the type |
| 73 | */ |
| 74 | typedef punt |
| 75 | { |
| 76 | vl_api_punt_type_t type; |
Jakub Grajciar | f72ad93 | 2019-10-09 14:15:56 +0200 | [diff] [blame] | 77 | vl_api_punt_union_t punt; |
Pavel Kotucek | e88865d | 2018-11-28 07:42:11 +0100 | [diff] [blame] | 78 | }; |
Neale Ranns | b8d4481 | 2017-11-10 06:53:54 -0800 | [diff] [blame] | 79 | |
| 80 | /** \brief Punt traffic to the host |
| 81 | @param client_index - opaque cookie to identify the sender |
| 82 | @param context - sender context, to match reply w/ request |
| 83 | @param is_add - add punt if non-zero, else delete |
Pavel Kotucek | e88865d | 2018-11-28 07:42:11 +0100 | [diff] [blame] | 84 | @param punt - punt definition, only UDP (0x11) is supported |
Neale Ranns | b8d4481 | 2017-11-10 06:53:54 -0800 | [diff] [blame] | 85 | */ |
Pavel Kotucek | e88865d | 2018-11-28 07:42:11 +0100 | [diff] [blame] | 86 | autoreply define set_punt { |
Neale Ranns | b8d4481 | 2017-11-10 06:53:54 -0800 | [diff] [blame] | 87 | u32 client_index; |
| 88 | u32 context; |
Jakub Grajciar | f72ad93 | 2019-10-09 14:15:56 +0200 | [diff] [blame] | 89 | bool is_add; |
Pavel Kotucek | e88865d | 2018-11-28 07:42:11 +0100 | [diff] [blame] | 90 | vl_api_punt_t punt; |
| 91 | }; |
| 92 | |
Neale Ranns | b8d4481 | 2017-11-10 06:53:54 -0800 | [diff] [blame] | 93 | /** \brief Punt traffic to the host via socket |
| 94 | @param client_index - opaque cookie to identify the sender |
| 95 | @param context - sender context, to match reply w/ request |
| 96 | @param header_version - expected meta data header version (currently 1) |
Pavel Kotucek | e88865d | 2018-11-28 07:42:11 +0100 | [diff] [blame] | 97 | @param punt - punt definition |
Neale Ranns | b8d4481 | 2017-11-10 06:53:54 -0800 | [diff] [blame] | 98 | */ |
| 99 | define punt_socket_register { |
| 100 | u32 client_index; |
| 101 | u32 context; |
| 102 | u32 header_version; |
Pavel Kotucek | e88865d | 2018-11-28 07:42:11 +0100 | [diff] [blame] | 103 | vl_api_punt_t punt; |
Jakub Grajciar | f72ad93 | 2019-10-09 14:15:56 +0200 | [diff] [blame] | 104 | string pathname[108]; /* Linux sun_path defined to be 108 bytes, see unix(7) */ |
Neale Ranns | b8d4481 | 2017-11-10 06:53:54 -0800 | [diff] [blame] | 105 | }; |
| 106 | |
| 107 | define punt_socket_register_reply |
| 108 | { |
Pavel Kotucek | e88865d | 2018-11-28 07:42:11 +0100 | [diff] [blame] | 109 | u32 context; |
| 110 | i32 retval; |
Jakub Grajciar | f72ad93 | 2019-10-09 14:15:56 +0200 | [diff] [blame] | 111 | string pathname[108]; |
Pavel Kotucek | e88865d | 2018-11-28 07:42:11 +0100 | [diff] [blame] | 112 | }; |
| 113 | |
| 114 | define punt_socket_dump |
| 115 | { |
| 116 | u32 client_index; |
| 117 | u32 context; |
Neale Ranns | 50f0ac0 | 2019-05-15 02:13:37 -0700 | [diff] [blame] | 118 | vl_api_punt_type_t type; |
Pavel Kotucek | e88865d | 2018-11-28 07:42:11 +0100 | [diff] [blame] | 119 | }; |
| 120 | |
| 121 | define punt_socket_details |
| 122 | { |
| 123 | u32 context; |
| 124 | vl_api_punt_t punt; |
Jakub Grajciar | f72ad93 | 2019-10-09 14:15:56 +0200 | [diff] [blame] | 125 | string pathname[108]; |
Neale Ranns | b8d4481 | 2017-11-10 06:53:54 -0800 | [diff] [blame] | 126 | }; |
| 127 | |
| 128 | autoreply define punt_socket_deregister { |
| 129 | u32 client_index; |
| 130 | u32 context; |
Pavel Kotucek | e88865d | 2018-11-28 07:42:11 +0100 | [diff] [blame] | 131 | vl_api_punt_t punt; |
Neale Ranns | b8d4481 | 2017-11-10 06:53:54 -0800 | [diff] [blame] | 132 | }; |
| 133 | |
Neale Ranns | 719beb7 | 2019-07-10 07:10:25 +0000 | [diff] [blame] | 134 | typedef punt_reason |
| 135 | { |
| 136 | u32 id; |
Ole Troan | e5ff5a3 | 2019-08-23 22:55:18 +0200 | [diff] [blame] | 137 | string name[]; |
Neale Ranns | 719beb7 | 2019-07-10 07:10:25 +0000 | [diff] [blame] | 138 | }; |
| 139 | |
Paul Vinciguerra | f158944 | 2019-10-17 21:08:17 -0400 | [diff] [blame] | 140 | /** \brief Dump all or one of the exception punt reasons |
Neale Ranns | 719beb7 | 2019-07-10 07:10:25 +0000 | [diff] [blame] | 141 | * @param - If the string is not set punt dump all reasons |
| 142 | * else dump only the one specified |
Neale Ranns | 50f0ac0 | 2019-05-15 02:13:37 -0700 | [diff] [blame] | 143 | */ |
| 144 | define punt_reason_dump |
| 145 | { |
| 146 | u32 client_index; |
| 147 | u32 context; |
Neale Ranns | 719beb7 | 2019-07-10 07:10:25 +0000 | [diff] [blame] | 148 | vl_api_punt_reason_t reason; |
Neale Ranns | 50f0ac0 | 2019-05-15 02:13:37 -0700 | [diff] [blame] | 149 | }; |
| 150 | |
| 151 | define punt_reason_details |
| 152 | { |
| 153 | u32 context; |
| 154 | vl_api_punt_reason_t reason; |
| 155 | }; |
| 156 | |
Neale Ranns | b8d4481 | 2017-11-10 06:53:54 -0800 | [diff] [blame] | 157 | /* |
| 158 | * Local Variables: |
| 159 | * eval: (c-set-style "gnu") |
| 160 | * End: |
| 161 | */ |