Annotation of embedaddon/quagga/bgpd/bgp_advertise.h, revision 1.1

1.1     ! misho       1: /* BGP advertisement and adjacency
        !             2:    Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
        !             3: 
        !             4: This file is part of GNU Zebra.
        !             5: 
        !             6: GNU Zebra is free software; you can redistribute it and/or modify it
        !             7: under the terms of the GNU General Public License as published by the
        !             8: Free Software Foundation; either version 2, or (at your option) any
        !             9: later version.
        !            10: 
        !            11: GNU Zebra is distributed in the hope that it will be useful, but
        !            12: WITHOUT ANY WARRANTY; without even the implied warranty of
        !            13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
        !            14: General Public License for more details.
        !            15: 
        !            16: You should have received a copy of the GNU General Public License
        !            17: along with GNU Zebra; see the file COPYING.  If not, write to the Free
        !            18: Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
        !            19: 02111-1307, USA.  */
        !            20: 
        !            21: #ifndef _QUAGGA_BGP_ADVERTISE_H
        !            22: #define _QUAGGA_BGP_ADVERTISE_H
        !            23: 
        !            24: /* BGP advertise FIFO.  */
        !            25: struct bgp_advertise_fifo
        !            26: {
        !            27:   struct bgp_advertise *next;
        !            28:   struct bgp_advertise *prev;
        !            29: };
        !            30: 
        !            31: /* BGP advertise attribute.  */
        !            32: struct bgp_advertise_attr
        !            33: {
        !            34:   /* Head of advertisement pointer. */
        !            35:   struct bgp_advertise *adv;
        !            36: 
        !            37:   /* Reference counter.  */
        !            38:   unsigned long refcnt;
        !            39: 
        !            40:   /* Attribute pointer to be announced.  */
        !            41:   struct attr *attr;
        !            42: };
        !            43: 
        !            44: struct bgp_advertise
        !            45: {
        !            46:   /* FIFO for advertisement.  */
        !            47:   struct bgp_advertise_fifo fifo;
        !            48: 
        !            49:   /* Link list for same attribute advertise.  */
        !            50:   struct bgp_advertise *next;
        !            51:   struct bgp_advertise *prev;
        !            52: 
        !            53:   /* Prefix information.  */
        !            54:   struct bgp_node *rn;
        !            55: 
        !            56:   /* Reference pointer.  */
        !            57:   struct bgp_adj_out *adj;
        !            58: 
        !            59:   /* Advertisement attribute.  */
        !            60:   struct bgp_advertise_attr *baa;
        !            61: 
        !            62:   /* BGP info.  */
        !            63:   struct bgp_info *binfo;
        !            64: };
        !            65: 
        !            66: /* BGP adjacency out.  */
        !            67: struct bgp_adj_out
        !            68: {
        !            69:   /* Lined list pointer.  */
        !            70:   struct bgp_adj_out *next;
        !            71:   struct bgp_adj_out *prev;
        !            72: 
        !            73:   /* Advertised peer.  */
        !            74:   struct peer *peer;
        !            75: 
        !            76:   /* Advertised attribute.  */
        !            77:   struct attr *attr;
        !            78: 
        !            79:   /* Advertisement information.  */
        !            80:   struct bgp_advertise *adv;
        !            81: };
        !            82: 
        !            83: /* BGP adjacency in. */
        !            84: struct bgp_adj_in
        !            85: {
        !            86:   /* Linked list pointer.  */
        !            87:   struct bgp_adj_in *next;
        !            88:   struct bgp_adj_in *prev;
        !            89: 
        !            90:   /* Received peer.  */
        !            91:   struct peer *peer;
        !            92: 
        !            93:   /* Received attribute.  */
        !            94:   struct attr *attr;
        !            95: };
        !            96: 
        !            97: /* BGP advertisement list.  */
        !            98: struct bgp_synchronize
        !            99: {
        !           100:   struct bgp_advertise_fifo update;
        !           101:   struct bgp_advertise_fifo withdraw;
        !           102:   struct bgp_advertise_fifo withdraw_low;
        !           103: };
        !           104: 
        !           105: /* BGP adjacency linked list.  */
        !           106: #define BGP_INFO_ADD(N,A,TYPE)                        \
        !           107:   do {                                                \
        !           108:     (A)->prev = NULL;                                 \
        !           109:     (A)->next = (N)->TYPE;                            \
        !           110:     if ((N)->TYPE)                                    \
        !           111:       (N)->TYPE->prev = (A);                          \
        !           112:     (N)->TYPE = (A);                                  \
        !           113:   } while (0)
        !           114: 
        !           115: #define BGP_INFO_DEL(N,A,TYPE)                        \
        !           116:   do {                                                \
        !           117:     if ((A)->next)                                    \
        !           118:       (A)->next->prev = (A)->prev;                    \
        !           119:     if ((A)->prev)                                    \
        !           120:       (A)->prev->next = (A)->next;                    \
        !           121:     else                                              \
        !           122:       (N)->TYPE = (A)->next;                          \
        !           123:   } while (0)
        !           124: 
        !           125: #define BGP_ADJ_IN_ADD(N,A)    BGP_INFO_ADD(N,A,adj_in)
        !           126: #define BGP_ADJ_IN_DEL(N,A)    BGP_INFO_DEL(N,A,adj_in)
        !           127: #define BGP_ADJ_OUT_ADD(N,A)   BGP_INFO_ADD(N,A,adj_out)
        !           128: #define BGP_ADJ_OUT_DEL(N,A)   BGP_INFO_DEL(N,A,adj_out)
        !           129: 
        !           130: /* Prototypes.  */
        !           131: extern void bgp_adj_out_set (struct bgp_node *, struct peer *, struct prefix *,
        !           132:                      struct attr *, afi_t, safi_t, struct bgp_info *);
        !           133: extern void bgp_adj_out_unset (struct bgp_node *, struct peer *, struct prefix *,
        !           134:                        afi_t, safi_t);
        !           135: extern void bgp_adj_out_remove (struct bgp_node *, struct bgp_adj_out *, 
        !           136:                         struct peer *, afi_t, safi_t);
        !           137: extern int bgp_adj_out_lookup (struct peer *, struct prefix *, afi_t, safi_t,
        !           138:                        struct bgp_node *);
        !           139: 
        !           140: extern void bgp_adj_in_set (struct bgp_node *, struct peer *, struct attr *);
        !           141: extern void bgp_adj_in_unset (struct bgp_node *, struct peer *);
        !           142: extern void bgp_adj_in_remove (struct bgp_node *, struct bgp_adj_in *);
        !           143: 
        !           144: extern struct bgp_advertise *
        !           145: bgp_advertise_clean (struct peer *, struct bgp_adj_out *, afi_t, safi_t);
        !           146: 
        !           147: extern void bgp_sync_init (struct peer *);
        !           148: extern void bgp_sync_delete (struct peer *);
        !           149: 
        !           150: #endif /* _QUAGGA_BGP_ADVERTISE_H */

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