2d3c95c8887231da2ba34c2fd425bfcfeaba2187
[vpp.git] / plugins / plugins / vcgn / spp_ctx.h
1 /*
2  *------------------------------------------------------------------
3  * spp_ctx.h - packet / context definitions
4  *
5  * Copyright (c) 2007-2014 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19
20 #ifndef __SPP_CTX_H__
21 #define __SPP_CTX_H__
22
23 /* Packet header / data */
24
25 /* Any change to spp_ctx_t structure should be updated in vnet/buffer.h
26  * as well.
27  */
28 typedef struct _spp_ctx {
29 #ifdef TOBE_PORTED
30         /* Following fields are required to handle multibuffer */
31         u32   num_buffers; /* Number of buffers part of packet */
32         vlib_buffer_t *next_ctx_this_packet;
33
34         /* Following is used by non-UDP protocols */
35 #define SPP_CTX_FEATURE_DATA_SIZE 16
36
37         u8 feature_data[SPP_CTX_FEATURE_DATA_SIZE];
38 #endif
39
40     union { /* Roddick specific */
41         u32 roddick_info;
42         struct __tx_pkt_info  { /* Used by PI to PI communication for TX */
43             u32 uidb_index:16;       /* uidb_index to transmit */
44             u32  packet_type:2;   /* 1-IPv4, 2-Ipv6, - 0,3 - Unused */
45             u32  ipv4_defrag:1;    /* 0 - Normal, 1 - update first
46                                     * segment size
47                                     * (set by 6rd defrag node)
48                                     */
49
50             u32  dst_ip_port_idx:4;/* Index to dst_ip_port_table */
51             u32  from_node:4;
52             u32  calc_chksum:1;
53             u32  reserved:4;
54         } tx;
55         struct __rx_pkt_info { /* Used by PD / PI communication */
56             u32 uidb_index:16;    /* uidb_index received in packet */
57             u32  packet_type:2;   /* 1-IPv4, 2-Ipv6, - 0,3 - Unused */
58             u32  icmp_type:1;     /* 0-ICMP query type, 1-ICMP error type */
59             u32  protocol_type:2; /* 1-TCP, 2-UDP, 3-ICMP, 0 - Unused */
60             u32  ipv4_defrag:1;    /* 0 - Normal, 1 - update first
61                                     * segment size
62                                     * (set by 6rd defrag node)
63                                     */
64
65             u32  direction:1;     /* 0-Outside, 1-Inside */
66             u32  frag:1;          /*IP fragment-1, Otherwise-0*/
67             u32  option:1;        /* 0-No IP option (v4) present, non-fragHdr
68                                    * option hdr present (v6)
69                                    */
70             u32  df_bit:1;        /* IPv4 DF bit copied here */
71             u32  reserved1:6;
72         } rx;
73     } ru;
74 } spp_ctx_t;
75
76 #endif