13c602fabSXin LI /* 21de50e9fSSam Leffler * Copyright (C) 2001 WIDE Project. All rights reserved. 31de50e9fSSam Leffler * 41de50e9fSSam Leffler * Redistribution and use in source and binary forms, with or without 51de50e9fSSam Leffler * modification, are permitted provided that the following conditions 61de50e9fSSam Leffler * are met: 71de50e9fSSam Leffler * 1. Redistributions of source code must retain the above copyright 81de50e9fSSam Leffler * notice, this list of conditions and the following disclaimer. 91de50e9fSSam Leffler * 2. Redistributions in binary form must reproduce the above copyright 101de50e9fSSam Leffler * notice, this list of conditions and the following disclaimer in the 111de50e9fSSam Leffler * documentation and/or other materials provided with the distribution. 121de50e9fSSam Leffler * 3. Neither the name of the project nor the names of its contributors 131de50e9fSSam Leffler * may be used to endorse or promote products derived from this software 141de50e9fSSam Leffler * without specific prior written permission. 151de50e9fSSam Leffler * 161de50e9fSSam Leffler * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 171de50e9fSSam Leffler * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 181de50e9fSSam Leffler * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 191de50e9fSSam Leffler * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 201de50e9fSSam Leffler * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 211de50e9fSSam Leffler * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 221de50e9fSSam Leffler * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 231de50e9fSSam Leffler * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 241de50e9fSSam Leffler * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 251de50e9fSSam Leffler * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 261de50e9fSSam Leffler * SUCH DAMAGE. 271de50e9fSSam Leffler */ 281de50e9fSSam Leffler 291de50e9fSSam Leffler #define LABEL_MASK 0xfffff000 301de50e9fSSam Leffler #define LABEL_SHIFT 12 31*ee67461eSJoseph Mingrone #define TC_MASK 0x00000e00 32*ee67461eSJoseph Mingrone #define TC_SHIFT 9 331de50e9fSSam Leffler #define STACK_MASK 0x00000100 341de50e9fSSam Leffler #define STACK_SHIFT 8 351de50e9fSSam Leffler #define TTL_MASK 0x000000ff 361de50e9fSSam Leffler #define TTL_SHIFT 0 371de50e9fSSam Leffler 381de50e9fSSam Leffler #define MPLS_LABEL(x) (((x) & LABEL_MASK) >> LABEL_SHIFT) 39*ee67461eSJoseph Mingrone #define MPLS_TC(x) (((x) & TC_MASK) >> TC_SHIFT) 401de50e9fSSam Leffler #define MPLS_STACK(x) (((x) & STACK_MASK) >> STACK_SHIFT) 411de50e9fSSam Leffler #define MPLS_TTL(x) (((x) & TTL_MASK) >> TTL_SHIFT) 42