rpc: add 'all announcements' callback function

This will be useful for the network status window and similar usecases.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
3 files changed, 14 insertions(+), 5 deletions(-)

M hlog/contest/ui.c
M rpc/announce-track.c
M rpc/include/hlog-rpc/announce-sub.h
M hlog/contest/ui.c +5 -3
@@ 860,7 860,9 @@ int contest_init(struct contest_params *
 		goto err_template;
 	}
 
-	ret = announce_connect(NULL, handle_location_notification,
+	ret = announce_connect(NULL,
+			       NULL,
+			       handle_location_notification,
 			       handle_rig_notification);
 	if (ret)
 		goto err_free;

          
@@ 883,7 885,7 @@ int contest_init(struct contest_params *
 
 err_ann:
 	/* disconnect from announcements - a little racy, but good enough */
-	announce_connect(NULL, NULL, NULL);
+	announce_connect(NULL, NULL, NULL, NULL);
 
 err_free:
 	qso_putref(contact);

          
@@ 903,7 905,7 @@ void contest_cleanup(void)
 	periodic_disarm(&info_periodic);
 
 	/* disconnect from announcements - a little racy, but good enough */
-	announce_connect(NULL, NULL, NULL);
+	announce_connect(NULL, NULL, NULL, NULL);
 
 	qso_putref(contest_params->template);
 	qso_putref(contact);

          
M rpc/announce-track.c +7 -1
@@ 81,6 81,7 @@ static LOCK_CLASS(instances_lc);
 static LOCK_CLASS(instance_lc);
 
 static struct {
+	void (*all)(const struct instance_info *);
 	void (*qso)(enum announce_qso_msg_type, const struct instance_info *,
 		    const struct xuuid *);
 	void (*loc)(enum announce_loc_msg_type, const struct instance_info *);

          
@@ 167,6 168,9 @@ static void invoke_callback(struct insta
 			/* nothing for now */
 			break;
 	}
+
+	if (notify.all)
+		notify.all(&inst->info);
 }
 
 static void announce_track_loc_msg(struct instance *inst,

          
@@ 402,7 406,8 @@ void announce_track_cleanup(void)
 	MXDESTROY(&instances_lock);
 }
 
-int announce_connect(void (*qso)(enum announce_qso_msg_type,
+int announce_connect(void (*all)(const struct instance_info *),
+		     void (*qso)(enum announce_qso_msg_type,
 				 const struct instance_info *,
 				 const struct xuuid *),
 		     void (*loc)(enum announce_loc_msg_type,

          
@@ 410,6 415,7 @@ int announce_connect(void (*qso)(enum an
 		     void (*rig)(enum announce_rig_msg_type,
 				 const struct instance_info *))
 {
+	notify.all = all;
 	notify.qso = qso;
 	notify.loc = loc;
 	notify.rig = rig;

          
M rpc/include/hlog-rpc/announce-sub.h +2 -1
@@ 57,7 57,8 @@ struct instance_info {
 	} rig;
 };
 
-extern int announce_connect(void (*qso)(enum announce_qso_msg_type,
+extern int announce_connect(void (*all)(const struct instance_info *),
+			    void (*qso)(enum announce_qso_msg_type,
 					const struct instance_info *,
 					const struct xuuid *),
 			    void (*loc)(enum announce_loc_msg_type,