1 /* 2 * The olsr.org Optimized Link-State Routing daemon (olsrd) 3 * 4 * (c) by the OLSR project 5 * 6 * See our Git repository to find out who worked on this file 7 * and thus is a copyright holder on it. 8 * 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 15 * * Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * * Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in 19 * the documentation and/or other materials provided with the 20 * distribution. 21 * * Neither the name of olsr.org, olsrd nor the names of its 22 * contributors may be used to endorse or promote products derived 23 * from this software without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 28 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 29 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 30 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 31 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 33 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 * POSSIBILITY OF SUCH DAMAGE. 37 * 38 * Visit http://www.olsr.org for more information. 39 * 40 * If you find this software useful feel free to make a donation 41 * to the project. For more information see the website or contact 42 * the copyright holders. 43 * 44 */ 45 46 /* ------------------------------------------------------------------------- 47 * File : packet.h 48 * Description : header file for packet.c 49 * ------------------------------------------------------------------------- */ 50 51 #ifndef _LIB_QUAGGA_PACKET_H_ 52 #define _LIB_QUAGGA_PACKET_H_ 53 54 /* Zebra packet size */ 55 #define ZEBRA_MAX_PACKET_SIZ 4096 56 57 /* Zebra header marker */ 58 #ifndef ZEBRA_HEADER_MARKER 59 #define ZEBRA_HEADER_MARKER 255 60 #endif /* ZEBRA_HEADER_MARKER */ 61 62 /* Zebra message types */ 63 #define ZEBRA_IPV4_ROUTE_ADD 7 64 #define ZEBRA_IPV4_ROUTE_DELETE 8 65 #define ZEBRA_IPV6_ROUTE_ADD 9 66 #define ZEBRA_IPV6_ROUTE_DELETE 10 67 #define ZEBRA_REDISTRIBUTE_ADD 11 68 #define ZEBRA_REDISTRIBUTE_DELETE 12 69 #define ZEBRA_HELLO 23 70 71 /* Zebra nexthop flags */ 72 #define ZEBRA_NEXTHOP_IFINDEX 1 73 #define ZEBRA_NEXTHOP_IPV4 3 74 #define ZEBRA_NEXTHOP_IPV6 6 75 76 /* Zebra message flags */ 77 #define ZAPI_MESSAGE_NEXTHOP 0x01 78 #define ZAPI_MESSAGE_IFINDEX 0x02 79 #define ZAPI_MESSAGE_DISTANCE 0x04 80 #define ZAPI_MESSAGE_METRIC 0x08 81 82 /* Subsequent Address Family Identifier */ 83 #define SAFI_UNICAST 1 84 85 /* Zebra flags */ 86 #define ZEBRA_FLAG_SELECTED 0x10 87 88 struct zroute { 89 unsigned char type; 90 unsigned char flags; 91 unsigned char message; 92 uint16_t safi; 93 unsigned char prefixlen; 94 union olsr_ip_addr prefix; 95 unsigned char nexthop_num; 96 union olsr_ip_addr *nexthop; 97 unsigned char ifindex_num; 98 uint32_t *ifindex; 99 uint32_t metric; 100 uint8_t distance; 101 }; 102 103 unsigned char *zpacket_route(uint16_t, struct zroute *); 104 unsigned char *zpacket_redistribute(uint16_t, unsigned char); 105 106 #endif /* _LIB_QUAGGA_PACKET_H_ */ 107 108 /* 109 * Local Variables: 110 * c-basic-offset: 2 111 * indent-tabs-mode: nil 112 * End: 113 */ 114