FD.io VPP  v16.09
Vector Packet Processing
packet.h
Go to the documentation of this file.
1 #ifndef included_vnet_mpls_packet_h
2 #define included_vnet_mpls_packet_h
3 
4 /*
5  * MPLS packet format
6  *
7  * Copyright (c) 2012 Cisco and/or its affiliates.
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at:
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 typedef struct {
22  /* Label: top 20 bits [in network byte order] */
23  /* Experimental: 3 bits ... */
24  /* S (bottom of label stack): 1 bit */
25  /* TTL: 8 bits */
28 
29 static inline u32 vnet_mpls_uc_get_label (u32 label_exp_s_ttl)
30 {
31  return (label_exp_s_ttl>>12);
32 }
33 
34 static inline u32 vnet_mpls_uc_get_exp (u32 label_exp_s_ttl)
35 {
36  return ((label_exp_s_ttl>>9) & 0x7);
37 }
38 
39 static inline u32 vnet_mpls_uc_get_s (u32 label_exp_s_ttl)
40 {
41  return ((label_exp_s_ttl>>8) & 0x1);
42 }
43 
44 static inline u32 vnet_mpls_uc_get_ttl (u32 label_exp_s_ttl)
45 {
46  return (label_exp_s_ttl & 0xff);
47 }
48 
49 #endif /* included_vnet_mpls_packet_h */
static u32 vnet_mpls_uc_get_label(u32 label_exp_s_ttl)
Definition: packet.h:29
static u32 vnet_mpls_uc_get_s(u32 label_exp_s_ttl)
Definition: packet.h:39
static u32 vnet_mpls_uc_get_exp(u32 label_exp_s_ttl)
Definition: packet.h:34
static u32 vnet_mpls_uc_get_ttl(u32 label_exp_s_ttl)
Definition: packet.h:44
unsigned int u32
Definition: types.h:88