]>
Commit | Line | Data |
---|---|---|
7f57883e DS |
1 | /* |
2 | * EIGRP Macros Definition. | |
3 | * Copyright (C) 2013-2014 | |
4 | * Authors: | |
5 | * Donnie Savage | |
6 | * Jan Janovic | |
7 | * Matej Perina | |
8 | * Peter Orsag | |
9 | * Peter Paluch | |
10 | * | |
11 | * This file is part of GNU Zebra. | |
12 | * | |
13 | * GNU Zebra is free software; you can redistribute it and/or modify it | |
14 | * under the terms of the GNU General Public License as published by the | |
15 | * Free Software Foundation; either version 2, or (at your option) any | |
16 | * later version. | |
17 | * | |
18 | * GNU Zebra is distributed in the hope that it will be useful, but | |
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
21 | * General Public License for more details. | |
22 | * | |
896014f4 DL |
23 | * You should have received a copy of the GNU General Public License along |
24 | * with this program; see the file COPYING; if not, write to the Free Software | |
25 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
7f57883e DS |
26 | */ |
27 | ||
28 | #ifndef _ZEBRA_EIGRP_MACROS_H_ | |
29 | #define _ZEBRA_EIGRP_MACROS_H_ | |
30 | ||
31 | #define DECLARE_IF_PARAM(T, P) T P; u_char P##__config:1 | |
32 | #define IF_EIGRP_IF_INFO(I) ((struct eigrp_if_info *)((I)->info)) | |
33 | #define IF_OIFS(I) (IF_EIGRP_IF_INFO (I)->eifs) | |
34 | #define IF_OIFS_PARAMS(I) (IF_EIGRP_IF_INFO (I)->params) | |
35 | ||
36 | #define SET_IF_PARAM(S, P) ((S)->P##__config) = 1 | |
37 | #define IF_DEF_PARAMS(I) (IF_EIGRP_IF_INFO (I)->def_params) | |
38 | ||
39 | #define UNSET_IF_PARAM(S, P) ((S)->P##__config) = 0 | |
40 | ||
41 | #define EIGRP_IF_PARAM_CONFIGURED(S, P) ((S) && (S)->P##__config) | |
42 | #define EIGRP_IF_PARAM(O, P) \ | |
43 | (EIGRP_IF_PARAM_CONFIGURED ((O)->params, P)?\ | |
44 | (O)->params->P:IF_DEF_PARAMS((O)->ifp)->P) | |
45 | ||
46 | #define EIGRP_IF_PASSIVE_STATUS(O) \ | |
47 | (EIGRP_IF_PARAM_CONFIGURED((O)->params, passive_interface) ? \ | |
48 | (O)->params->passive_interface : \ | |
49 | (EIGRP_IF_PARAM_CONFIGURED(IF_DEF_PARAMS((O)->ifp), passive_interface) ? \ | |
50 | IF_DEF_PARAMS((O)->ifp)->passive_interface : \ | |
51 | (O)->eigrp->passive_interface_default)) | |
52 | ||
53 | //------------------------------------------------------------------------------------------------------------------------------------ | |
54 | ||
55 | #define EIGRP_IF_STRING_MAXLEN 40 | |
56 | #define IF_NAME(I) eigrp_if_name_string ((I)) | |
57 | ||
58 | //------------------------------------------------------------------------------------------------------------------------------------ | |
59 | ||
60 | /*Macros for EIGRP interface multicast membership*/ | |
61 | #define EI_MEMBER_FLAG(M) (1 << (M)) | |
62 | #define EI_MEMBER_COUNT(O,M) (IF_EIGRP_IF_INFO(ei->ifp)->membership_counts[(M)]) | |
63 | #define EI_MEMBER_CHECK(O,M) \ | |
64 | (CHECK_FLAG((O)->multicast_memberships, EI_MEMBER_FLAG(M))) | |
65 | #define EI_MEMBER_JOINED(O,M) \ | |
66 | do { \ | |
67 | SET_FLAG ((O)->multicast_memberships, EI_MEMBER_FLAG(M)); \ | |
68 | IF_EIGRP_IF_INFO((O)->ifp)->membership_counts[(M)]++; \ | |
69 | } while (0) | |
70 | #define EI_MEMBER_LEFT(O,M) \ | |
71 | do { \ | |
72 | UNSET_FLAG ((O)->multicast_memberships, EI_MEMBER_FLAG(M)); \ | |
73 | IF_EIGRP_IF_INFO((O)->ifp)->membership_counts[(M)]--; \ | |
74 | } while (0) | |
75 | ||
76 | //----------------------------------------------------------------------------------------------------------------------------------- | |
77 | /* Topology Macros */ | |
78 | ||
79 | ||
80 | /* FSM macros*/ | |
81 | #define EIGRP_FSM_EVENT_SCHEDULE(I,E) \ | |
82 | thread_add_event (master, eigrp_fsm_event, (I), (E)) | |
83 | ||
84 | #endif /* _ZEBRA_EIGRP_MACROS_H_ */ |