1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/* BGP ROUTE-REFRESH and ORF handling -- header
* Copyright (C) Chris Hall (GMCH), Highwayman
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2, or (at your
* option) any later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Zebra; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _QUAGGA_BGP_ROUTE_REFRESH_H
#define _QUAGGA_BGP_ROUTE_REFRESH_H
#include "lib/misc.h"
#include "bgpd/bgp_common.h"
#include "lib/prefix.h"
#include "lib/plist.h"
/*==============================================================================
* Structures to hold ROUTE-REFRESH and ORF
*/
typedef struct orf_prefix* orf_prefix ; /* see lib/plist.h */
typedef struct bgp_orf_unknown_entry* bgp_orf_unknown_entry ;
struct bgp_orf_unknown_entry
{
bgp_size_t length ;
uint8_t data[] ;
} ;
typedef struct bgp_orf_entry* bgp_orf_entry ;
struct bgp_orf_entry
{
uint8_t orf_type ; /* BGP_ORF_T_xxx -- _rfc version ! */
bgp_form_t form ; /* bgp_form_none/_rfc/_pre */
bool unknown ; /* ignore everything other than the */
/* unknown data part */
bool remove_all ; /* rest is ignored if this is set */
bool remove ; /* otherwise: add */
bool deny ; /* otherwise: permit */
union { /* must be last... */
struct orf_prefix orf_prefix ;
struct bgp_orf_unknown_entry orf_unknown ; /*... flexible array. */
} body ;
} ;
/* (The typedef is required to stop Eclipse (3.4.2 with CDT 5.0) whining
* about first argument of offsetof().)
*/
typedef struct bgp_orf_entry bgp_orf_entry_t ;
enum
{
bgp_orf_unknown_min_l = sizeof(struct bgp_orf_entry)
- offsetof(bgp_orf_entry_t, body.orf_unknown.data)
} ;
typedef struct bgp_route_refresh* bgp_route_refresh ;
struct bgp_route_refresh
{
iAFI_t afi ; /* NB: Internet AFI/SAFI */
iSAFI_t safi ;
vector_t entries ; /* empty => simple ROUTE-REFRESH */
bool defer ; /* otherwise: immediate */
/* These support the output of ROUTE-REFRESH messages.
*
* These are zeroised when the bgp_route_refresh stucture is created.
*/
unsigned next ; /* next entry to process */
uint8_t last_orf_type ; /* type of last ORF entry processed */
} ;
/*==============================================================================
* Prototypes
*/
extern bgp_route_refresh
bgp_route_refresh_new(iAFI_t afi, iSAFI_t safi, unsigned count) ;
extern void
bgp_route_refresh_free(bgp_route_refresh rr) ;
extern void
bgp_route_refresh_set_orf_defer(bgp_route_refresh rr, bool defer) ;
extern bgp_orf_entry
bgp_orf_add(bgp_route_refresh rr, uint8_t orf_type, bgp_form_t form,
bool remove, bool deny) ;
extern void
bgp_orf_add_remove_all(bgp_route_refresh rr, uint8_t orf_type, bgp_form_t form);
extern void
bgp_orf_add_unknown(bgp_route_refresh rr, uint8_t orf_type, bgp_size_t length,
const void* entries) ;
Inline unsigned
bgp_orf_get_count(bgp_route_refresh rr)
{
return vector_end(rr->entries) ;
} ;
Inline bgp_orf_entry
bgp_orf_get_entry(bgp_route_refresh rr, unsigned index)
{
return vector_get_item(rr->entries, index) ;
} ;
#endif /* _QUAGGA_BGP_ROUTE_REFRESH_H */
|