summaryrefslogtreecommitdiff
path: root/pbrd/pbr_event.h
blob: 2d895d969413a135dfc7310de437bd6a89f31a93 (plain)
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
129
130
131
132
133
134
135
136
137
/*
 * PBR-event Header
 * Copyright (C) 2018 Cumulus Networks, Inc.
 *               Donald Sharp
 *
 * This file is part of FRR.
 *
 * FRR 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.
 *
 * FRR 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 this program; see the file COPYING; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 */
#ifndef __PBR_EVENT_H__
#define __PBR_EVENT_H__

enum pbr_events {
	/*
	 * A NHG has been added to the system, handle it
	 */
	PBR_NHG_NEW,

	/*
	 * A NHG has been modified( added a new nexthop )
	 */
	PBR_NHG_ADD_NEXTHOP,

	/*
	 * A NHG has been modified( deleted a nexthop )
	 */
	PBR_NHG_DEL_NEXTHOP,

	/*
	 * A NHG has been deleted from the system
	 */
	PBR_NHG_DELETE,

	/*
	 * A individual nexthop has been added
	 */
	PBR_MAP_NEXTHOP_ADD,

	/*
	 * A individual nexthop has been deleted
	 */
	PBR_MAP_NEXTHOP_DELETE,

	/*
	 * A nexthop group has been added to a pbr-map
	 */
	PBR_MAP_NHG_ADD,

	/*
	 * A nexthop group has been deleted from a pbr-map
	 */
	PBR_MAP_NHG_DELETE,

	/*
	 * A new pbr-map has been created
	 */
	PBR_MAP_ADD,

	/*
	 * The pbr-map has been modified in some fashion
	 */
	PBR_MAP_MODIFY,

	/*
	 * The pbr-map has been deleted from the system
	 */
	PBR_MAP_DELETE,

	/*
	 * Start the sequence of events to install/remove the policy
	 * from being installed
	 */
	PBR_MAP_INSTALL,

	/*
	 * We believe we have gotten enough information to actually
	 * install the rule portion, since the nexthops are installed
	 */
	PBR_MAP_POLICY_INSTALL,

	/*
	 * Callbacks for a Nexthop in a nexthop group has been
	 * changed in some fashion
	 */
	PBR_NH_CHANGED,

	/*
	 * Callback for when a policy has been applied to an interface
	 */
	PBR_POLICY_CHANGED,

	/*
	 * Callback for when a interface has been issued a no
	 * policy command
	 */
	PBR_POLICY_DELETED,
};

struct pbr_event {
	enum pbr_events event;

	char name[100];
	union g_addr addr;
	uint32_t seqno;
};

/*
 * Return a event structure that can be filled in and enqueued.
 * Assume this memory is owned by the event subsystem.
 */
extern struct pbr_event *pbr_event_new(enum pbr_events ev, const char *name);

/*
 * Free the associated pbr_event item
 */
extern void pbr_event_free(struct pbr_event **pbre);

/*
 * Enqueue an event for later processing
 */
void pbr_event_enqueue(struct pbr_event *pbre);

extern void pbr_event_init(void);
extern void pbr_event_stop(void);
#endif