summaryrefslogtreecommitdiff
path: root/nest/protocol.h
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-01-12 14:06:49 +0100
committerMaria Matejka <mq@ucw.cz>2022-02-03 10:30:33 +0100
commitb6c9263543060141d79e205e1b3408099ad1afc4 (patch)
treebada190f4106905ebfd638a1777c8fb255c0e9f9 /nest/protocol.h
parentb5155d5cea6af783619144ca49648ad743cf4e38 (diff)
Interfaces and neighbor notifications do properly enter protocol loops
Diffstat (limited to 'nest/protocol.h')
-rw-r--r--nest/protocol.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/nest/protocol.h b/nest/protocol.h
index f07bb4df..a4b6152b 100644
--- a/nest/protocol.h
+++ b/nest/protocol.h
@@ -268,6 +268,18 @@ struct proto *proto_iterate_named(struct symbol *sym, struct protocol *proto, st
#define PROTO_WALK_CMD(sym,pr,p) for(struct proto *p = NULL; p = proto_iterate_named(sym, pr, p); )
+#define PROTO_ENTER_FROM_MAIN(p) ({ \
+ ASSERT_DIE(birdloop_inside(&main_birdloop)); \
+ struct birdloop *_loop = (p)->loop; \
+ if (_loop != &main_birdloop) birdloop_enter(_loop); \
+ _loop; \
+ })
+
+#define PROTO_LEAVE_FROM_MAIN(loop) ({ if (loop != &main_birdloop) birdloop_leave(loop); })
+
+#define PROTO_LOCKED_FROM_MAIN(p) for (struct birdloop *_proto_loop = PROTO_ENTER_FROM_MAIN(p); _proto_loop; PROTO_LEAVE_FROM_MAIN(_proto_loop), (_proto_loop = NULL))
+
+
#define CMD_RELOAD 0
#define CMD_RELOAD_IN 1
#define CMD_RELOAD_OUT 2