Punt: socket register for exception dispatched/punted packets based on reason
[vpp.git] / src / vnet / ip / punt.api
1 /*
2  * Copyright (c) 2015-2019 Cisco and/or its affiliates.
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
16 option version = "2.1.0";
17 import "vnet/ip/ip_types.api";
18
19 /** \brief The types of packets to be punted
20 */
21 enum punt_type
22 {
23     /* L4 (UDP) packets */
24     PUNT_API_TYPE_L4,
25     /* Exception packets handled by the VLIB punt infra */
26     PUNT_API_TYPE_EXCEPTION,
27 };
28
29 /** \brief Punt L4 traffic definition
30     @param af - Address Family, IPv4 or IPV6
31     @param protocol - L4 protocol to be punted
32     @param port - TCP/UDP port to be punted
33 */
34 typedef punt_l4
35 {
36     vl_api_address_family_t af;
37     vl_api_ip_proto_t protocol;
38     u16 port;
39 };
40
41 /** \brief The ID of the punt exception reason
42            Dump all the reasons to obtain this
43 */
44 typedef punt_exception
45 {
46     u32 id;
47 };
48
49 /** \brief Union of the different punt packet descriptions
50 */
51 union punt_union
52 {
53     vl_api_punt_exception_t exception;
54     vl_api_punt_l4_t l4;
55 };
56
57 /** \brief Full description of which packets are requested to be punted
58     @param type - Which packet type
59     @param punt - Description corresponding to the type
60 */
61 typedef punt
62 {
63     vl_api_punt_type_t type;
64     vl_api_punt_union_t punt; 
65 };
66
67 /** \brief Punt traffic to the host
68     @param client_index - opaque cookie to identify the sender
69     @param context - sender context, to match reply w/ request
70     @param is_add - add punt if non-zero, else delete
71     @param punt - punt definition, only UDP (0x11) is supported
72 */
73 autoreply define set_punt {
74     u32 client_index;
75     u32 context;
76     u8 is_add;
77     vl_api_punt_t punt;
78 };
79
80 /** \brief Punt traffic to the host via socket
81     @param client_index - opaque cookie to identify the sender
82     @param context - sender context, to match reply w/ request
83     @param header_version - expected meta data header version (currently 1)
84     @param punt - punt definition
85 */
86 define punt_socket_register {
87     u32 client_index;
88     u32 context;
89     u32 header_version;
90     vl_api_punt_t punt;
91     u8 pathname[108]; /* Linux sun_path defined to be 108 bytes, see unix(7) */
92 };
93
94 define punt_socket_register_reply
95 {
96     u32 context;
97     i32 retval;
98     u8 pathname[64];
99 };
100
101 define punt_socket_dump
102 {
103     u32 client_index;
104     u32 context;
105     vl_api_punt_type_t type;
106 };
107
108 define punt_socket_details
109 {
110     u32 context;
111     vl_api_punt_t punt;
112     u8 pathname[108];
113 };
114
115 autoreply define punt_socket_deregister {
116     u32 client_index;
117     u32 context;
118     vl_api_punt_t punt;
119 };
120
121 /** \brief Dump all of the excpetion punt reasons
122 */
123 define punt_reason_dump
124 {
125     u32 client_index;
126     u32 context;
127 };
128
129 typedef punt_reason
130 {
131     u32 id;
132     string name;
133 };
134
135 define punt_reason_details
136 {
137     u32 context;
138     vl_api_punt_reason_t reason;
139 };
140
141 /*
142  * Local Variables:
143  * eval: (c-set-style "gnu")
144  * End:
145  */