1 /* sonar, Copyright (c) 1998-2008 Jamie Zawinski and Stephen Martin
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
12 #ifndef __SONAR_XSCREENSAVER_H__
13 #define __SONAR_XSCREENSAVER_H__
15 typedef struct sonar_sensor_data sonar_sensor_data;
16 typedef struct sonar_bogie sonar_bogie;
20 char *name; /* bogie name, e.g., host name */
21 char *desc; /* second line of text, e.g., ping time */
22 double r; /* distance, 0 - 1.0 */
23 double th; /* heading, 0 - 2 pi */
24 double ttl; /* time to live, 0 - 2 pi */
25 sonar_bogie *next; /* next one in the list */
28 struct sonar_sensor_data {
31 /* Called frequently (every time the sweep moves).
32 Returns a list of new bogies to be added to the display list
33 once the sweep comes around to their position.
35 sonar_bogie *(*scan_cb) (sonar_sensor_data *);
37 /* Called when a bogie is freed, to free bogie->closure */
38 void (*free_bogie_cb) (sonar_sensor_data *, void *closure);
40 /* Called at exit, to free ssd->closure */
41 void (*free_data_cb) (sonar_sensor_data *, void *closure);
44 /* frees bogie and its contents, including calling the free_bogie_cb. */
45 extern void free_bogie (sonar_sensor_data *ssd, sonar_bogie *b);
47 /* makes a copy of the bogie, not including the 'closure' data. */
48 extern sonar_bogie *copy_bogie (sonar_sensor_data *ssd, const sonar_bogie *b);
51 /* Set up and return sensor state for ICMP pings. */
52 extern sonar_sensor_data *init_ping (Display *dpy,
56 Bool resolve_p, Bool times_p,
59 /* Set up and return sensor state for the simulation. */
60 extern sonar_sensor_data *init_simulation (Display *dpy,
62 const char *team_a_name,
63 const char *team_b_name,
68 #endif /* __SONAR_XSCREENSAVER_H__ */