Annotation of embedaddon/quagga/babeld/babeld.h, revision 1.1.1.1

1.1       misho       1: /*  
                      2:  *  This file is free software: you may copy, redistribute and/or modify it  
                      3:  *  under the terms of the GNU General Public License as published by the  
                      4:  *  Free Software Foundation, either version 2 of the License, or (at your  
                      5:  *  option) any later version.  
                      6:  *  
                      7:  *  This file is distributed in the hope that it will be useful, but  
                      8:  *  WITHOUT ANY WARRANTY; without even the implied warranty of  
                      9:  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  
                     10:  *  General Public License for more details.  
                     11:  *  
                     12:  *  You should have received a copy of the GNU General Public License  
                     13:  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.  
                     14:  *  
                     15:  * This file incorporates work covered by the following copyright and  
                     16:  * permission notice:  
                     17:  *  
                     18: Copyright (c) 2007, 2008 by Juliusz Chroboczek
                     19: Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
                     20: 
                     21: Permission is hereby granted, free of charge, to any person obtaining a copy
                     22: of this software and associated documentation files (the "Software"), to deal
                     23: in the Software without restriction, including without limitation the rights
                     24: to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
                     25: copies of the Software, and to permit persons to whom the Software is
                     26: furnished to do so, subject to the following conditions:
                     27: 
                     28: The above copyright notice and this permission notice shall be included in
                     29: all copies or substantial portions of the Software.
                     30: 
                     31: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
                     32: IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
                     33: FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
                     34: AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
                     35: LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
                     36: OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
                     37: THE SOFTWARE.
                     38: */
                     39: 
                     40: #ifndef BABEL_BABELD_H
                     41: #define BABEL_BABELD_H
                     42: 
                     43: #include <zebra.h>
                     44: #include "vty.h"
                     45: 
                     46: #define INFINITY ((unsigned short)(~0))
                     47: 
                     48: #ifndef RTPROT_BABEL
                     49: #define RTPROT_BABEL 42
                     50: #endif
                     51: 
                     52: #define RTPROT_BABEL_LOCAL -2
                     53: 
                     54: #undef MAX
                     55: #undef MIN
                     56: 
                     57: #define MAX(x,y) ((x)<=(y)?(y):(x))
                     58: #define MIN(x,y) ((x)<=(y)?(x):(y))
                     59: 
                     60: #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
                     61: /* nothing */
                     62: #elif defined(__GNUC__)
                     63: #define inline __inline
                     64: #if  (__GNUC__ >= 3)
                     65: #define restrict __restrict
                     66: #else
                     67: #define restrict /**/
                     68: #endif
                     69: #else
                     70: #define inline /**/
                     71: #define restrict /**/
                     72: #endif
                     73: 
                     74: #if defined(__GNUC__) && (__GNUC__ >= 3)
                     75: #define ATTRIBUTE(x) __attribute__ (x)
                     76: #define LIKELY(_x) __builtin_expect(!!(_x), 1)
                     77: #define UNLIKELY(_x) __builtin_expect(!!(_x), 0)
                     78: #else
                     79: #define ATTRIBUTE(x) /**/
                     80: #define LIKELY(_x) !!(_x)
                     81: #define UNLIKELY(_x) !!(_x)
                     82: #endif
                     83: 
                     84: #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
                     85: #define COLD __attribute__ ((cold))
                     86: #else
                     87: #define COLD /**/
                     88: #endif
                     89: 
                     90: #ifndef IF_NAMESIZE
                     91: #include <sys/socket.h>
                     92: #include <net/if.h>
                     93: #endif
                     94: 
                     95: #ifdef HAVE_VALGRIND
                     96: #include <valgrind/memcheck.h>
                     97: #else
                     98: #ifndef VALGRIND_MAKE_MEM_UNDEFINED
                     99: #define VALGRIND_MAKE_MEM_UNDEFINED(a, b) do {} while(0)
                    100: #endif
                    101: #ifndef VALGRIND_CHECK_MEM_IS_DEFINED
                    102: #define VALGRIND_CHECK_MEM_IS_DEFINED(a, b) do {} while(0)
                    103: #endif
                    104: #endif
                    105: 
                    106: 
                    107: #define BABEL_VTY_PORT 2609
                    108: #define BABEL_DEFAULT_CONFIG "babeld.conf"
                    109: #define BABEL_VERSION "0.1 for quagga"
                    110: 
                    111: /* Values in milliseconds */
                    112: #define BABEL_DEFAULT_HELLO_INTERVAL 4000
                    113: #define BABEL_DEFAULT_UPDATE_INTERVAL 16000
                    114: #define BABEL_DEFAULT_RESEND_DELAY 2000
                    115: 
                    116: 
                    117: /* Babel socket. */
                    118: extern int protocol_socket;
                    119: 
                    120: /* Babel structure. */
                    121: struct babel
                    122: {
                    123:     /* Babel threads. */
                    124:     struct thread *t_read;    /* on Babel protocol's socket */
                    125:     struct thread *t_update;  /* timers */
                    126: };
                    127: 
                    128: 
                    129: extern void babeld_quagga_init(void);
                    130: extern int input_filter(const unsigned char *id,
                    131:                         const unsigned char *prefix, unsigned short plen,
                    132:                         const unsigned char *neigh, unsigned int ifindex);
                    133: extern int output_filter(const unsigned char *id, const unsigned char *prefix,
                    134:                          unsigned short plen, unsigned int ifindex);
                    135: extern int redistribute_filter(const unsigned char *prefix, unsigned short plen,
                    136:                                unsigned int ifindex, int proto);
                    137: extern int resize_receive_buffer(int size);
                    138: extern void schedule_neighbours_check(int msecs, int override);
                    139: 
                    140: 
                    141: #endif /* BABEL_BABELD_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>