]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_ism.h
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / ospfd / ospf_ism.h
index fa8e6d70f67f8adf0110d4fe6e7646a928830816..5ae99ab32070b2d87b0c944b6d62fb4aafb0f828 100644 (file)
  * 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.
+ * 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 _ZEBRA_OSPF_ISM_H
 #define ISM_InterfaceDown                 7
 #define OSPF_ISM_EVENT_MAX                8
 
-#define OSPF_ISM_WRITE_ON(O)                                                  \
-      do                                                                      \
-        {                                                                     \
-          if (oi->on_write_q == 0)                                            \
-           {                                                                 \
-              listnode_add ((O)->oi_write_q, oi);                             \
-             oi->on_write_q = 1;                                             \
-           }                                                                 \
-         if ((O)->t_write == NULL)                                           \
-           (O)->t_write =                                                    \
-             thread_add_write (master, ospf_write, (O), (O)->fd);            \
-        } while (0)
-     
+#define OSPF_ISM_WRITE_ON(O)                                                   \
+       do {                                                                   \
+               if (oi->on_write_q == 0) {                                     \
+                       listnode_add((O)->oi_write_q, oi);                     \
+                       oi->on_write_q = 1;                                    \
+               }                                                              \
+               thread_add_write(master, ospf_write, (O), (O)->fd,             \
+                                &(O)->t_write);                               \
+       } while (0)
+
 /* Macro for OSPF ISM timer turn on. */
-#define OSPF_ISM_TIMER_ON(T,F,V) \
-  do { \
-    if (!(T)) \
-      (T) = thread_add_timer (master, (F), oi, (V)); \
-  } while (0)
-#define OSPF_ISM_TIMER_MSEC_ON(T,F,V) \
-  do { \
-    if (!(T)) \
-      (T) = thread_add_timer_msec (master, (F), oi, (V)); \
-  } while (0)
+#define OSPF_ISM_TIMER_ON(T, F, V) thread_add_timer(master, (F), oi, (V), &(T))
+
+#define OSPF_ISM_TIMER_MSEC_ON(T, F, V)                                        \
+       thread_add_timer_msec(master, (F), oi, (V), &(T))
 
 /* convenience macro to set hello timer correctly, according to
  * whether fast-hello is set or not
  */
-#define OSPF_HELLO_TIMER_ON(O) \
-  do { \
-    if (OSPF_IF_PARAM ((O), fast_hello)) \
-        OSPF_ISM_TIMER_MSEC_ON ((O)->t_hello, ospf_hello_timer, \
-                                1000 / OSPF_IF_PARAM ((O), fast_hello)); \
-    else \
-        OSPF_ISM_TIMER_ON ((O)->t_hello, ospf_hello_timer, \
-                                OSPF_IF_PARAM ((O), v_hello)); \
-  } while (0)
+#define OSPF_HELLO_TIMER_ON(O)                                                 \
+       do {                                                                   \
+               if (OSPF_IF_PARAM((O), fast_hello))                            \
+                       OSPF_ISM_TIMER_MSEC_ON(                                \
+                               (O)->t_hello, ospf_hello_timer,                \
+                               1000 / OSPF_IF_PARAM((O), fast_hello));        \
+               else                                                           \
+                       OSPF_ISM_TIMER_ON((O)->t_hello, ospf_hello_timer,      \
+                                         OSPF_IF_PARAM((O), v_hello));        \
+       } while (0)
 
 /* Macro for OSPF ISM timer turn off. */
-#define OSPF_ISM_TIMER_OFF(X) \
-  do { \
-    if (X) \
-      { \
-       thread_cancel (X); \
-       (X) = NULL; \
-      } \
-  } while (0)
+#define OSPF_ISM_TIMER_OFF(X)                                                  \
+       do {                                                                   \
+               if (X) {                                                       \
+                       thread_cancel(X);                                      \
+                       (X) = NULL;                                            \
+               }                                                              \
+       } while (0)
 
 /* Macro for OSPF schedule event. */
-#define OSPF_ISM_EVENT_SCHEDULE(I,E) \
-      thread_add_event (master, ospf_ism_event, (I), (E))
+#define OSPF_ISM_EVENT_SCHEDULE(I, E)                                          \
+       thread_add_event(master, ospf_ism_event, (I), (E), NULL)
 
 /* Macro for OSPF execute event. */
-#define OSPF_ISM_EVENT_EXECUTE(I,E) \
-      thread_execute (master, ospf_ism_event, (I), (E))
+#define OSPF_ISM_EVENT_EXECUTE(I, E)                                           \
+       thread_execute(master, ospf_ism_event, (I), (E))
 
 /* Prototypes. */
-extern int ospf_ism_event (struct thread *);
-extern void ism_change_status (struct ospf_interface *, int);
-extern int ospf_hello_timer (struct thread *thread);
+extern int ospf_ism_event(struct thread *);
+extern void ism_change_status(struct ospf_interface *, int);
+extern int ospf_hello_timer(struct thread *thread);
 
 DECLARE_HOOK(ospf_ism_change,
-               (struct ospf_interface *oi, int state, int oldstate),
-               (oi, state, oldstate))
+            (struct ospf_interface * oi, int state, int oldstate),
+            (oi, state, oldstate))
 
 #endif /* _ZEBRA_OSPF_ISM_H */