]>
git.proxmox.com Git - mirror_frr.git/blob - eigrpd/eigrp_macros.h
2 * EIGRP Macros Definition.
3 * Copyright (C) 2013-2014
11 * This file is part of GNU Zebra.
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
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.
23 * You should have received a copy of the GNU General Public License
24 * along with GNU Zebra; see the file COPYING. If not, write to the Free
25 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
29 #ifndef _ZEBRA_EIGRP_MACROS_H_
30 #define _ZEBRA_EIGRP_MACROS_H_
32 #define DECLARE_IF_PARAM(T, P) T P; u_char P##__config:1
33 #define IF_EIGRP_IF_INFO(I) ((struct eigrp_if_info *)((I)->info))
34 #define IF_OIFS(I) (IF_EIGRP_IF_INFO (I)->eifs)
35 #define IF_OIFS_PARAMS(I) (IF_EIGRP_IF_INFO (I)->params)
37 #define SET_IF_PARAM(S, P) ((S)->P##__config) = 1
38 #define IF_DEF_PARAMS(I) (IF_EIGRP_IF_INFO (I)->def_params)
40 #define UNSET_IF_PARAM(S, P) ((S)->P##__config) = 0
42 #define EIGRP_IF_PARAM_CONFIGURED(S, P) ((S) && (S)->P##__config)
43 #define EIGRP_IF_PARAM(O, P) \
44 (EIGRP_IF_PARAM_CONFIGURED ((O)->params, P)?\
45 (O)->params->P:IF_DEF_PARAMS((O)->ifp)->P)
47 #define EIGRP_IF_PASSIVE_STATUS(O) \
48 (EIGRP_IF_PARAM_CONFIGURED((O)->params, passive_interface) ? \
49 (O)->params->passive_interface : \
50 (EIGRP_IF_PARAM_CONFIGURED(IF_DEF_PARAMS((O)->ifp), passive_interface) ? \
51 IF_DEF_PARAMS((O)->ifp)->passive_interface : \
52 (O)->eigrp->passive_interface_default))
54 //------------------------------------------------------------------------------------------------------------------------------------
56 #define EIGRP_IF_STRING_MAXLEN 40
57 #define IF_NAME(I) eigrp_if_name_string ((I))
59 //------------------------------------------------------------------------------------------------------------------------------------
61 /*Macros for EIGRP interface multicast membership*/
62 #define EI_MEMBER_FLAG(M) (1 << (M))
63 #define EI_MEMBER_COUNT(O,M) (IF_EIGRP_IF_INFO(ei->ifp)->membership_counts[(M)])
64 #define EI_MEMBER_CHECK(O,M) \
65 (CHECK_FLAG((O)->multicast_memberships, EI_MEMBER_FLAG(M)))
66 #define EI_MEMBER_JOINED(O,M) \
68 SET_FLAG ((O)->multicast_memberships, EI_MEMBER_FLAG(M)); \
69 IF_EIGRP_IF_INFO((O)->ifp)->membership_counts[(M)]++; \
71 #define EI_MEMBER_LEFT(O,M) \
73 UNSET_FLAG ((O)->multicast_memberships, EI_MEMBER_FLAG(M)); \
74 IF_EIGRP_IF_INFO((O)->ifp)->membership_counts[(M)]--; \
77 //-----------------------------------------------------------------------------------------------------------------------------------
82 #define EIGRP_FSM_EVENT_SCHEDULE(I,E) \
83 thread_add_event (master, eigrp_fsm_event, (I), (E))
85 #endif /* _ZEBRA_EIGRP_MACROS_H_ */