#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <sys/resource.h>
#include <sys/uio.h>
#include <sys/wait.h>
typedef struct target {
struct target_ops *ops;
+ unsigned ref;
char *desc;
} target;
typedef struct source {
struct source *next, *prev;
struct source_ops *ops;
+ unsigned ref;
+ unsigned f;
+#define SF_ACTIVE 1u
char *desc;
} source;
+
/* --- Forwarding source operations --- */
typedef struct source_ops {
void (*attach)(source */*s*/, scanner */*sc*/, target */*t*/);
+ /* --- @shutdown@ --- *
+ *
+ * Arguments: @source *s@ = pointer to source
+ *
+ * Returns: ---
+ *
+ * Use: Deactivates the source so that it won't produce any more
+ * endpoints.
+ */
+
+ void (*shutdown)(source */*s*/);
+
/* --- @destroy@ --- *
*
* Arguments: @source *s@ = pointer to source
extern void endpt_join(endpt */*a*/, endpt */*b*/, const char */*desc*/);
+/* --- @target_inc@ --- *
+ *
+ * Arguments: @target *t@ = pointer to a source
+ *
+ * Returns: ---
+ *
+ * Use: Increments a target's refcount.
+ */
+
+extern void target_inc(target */*t*/);
+
+/* --- @target_dec@ --- *
+ *
+ * Arguments: @target *t@ = pointer to a target
+ *
+ * Returns: ---
+ *
+ * Use: Decrements a target's refcount, destroying it if necessary.
+ */
+
+extern void target_dec(target */*t*/);
+
/* --- @source_add@ --- *
*
* Arguments: @source *s@ = pointer to a source
extern void source_remove(source */*s*/);
+/* --- @source_inc@ --- *
+ *
+ * Arguments: @source *s@ = pointer to a source
+ *
+ * Returns: ---
+ *
+ * Use: Increments a source's refcount.
+ */
+
+extern void source_inc(source */*s*/);
+
+/* --- @source_dec@ --- *
+ *
+ * Arguments: @source *s@ = pointer to a source
+ *
+ * Returns: ---
+ *
+ * Use: Decrements a source's refcount, destroying it if necessary.
+ */
+
+extern void source_dec(source */*s*/);
+
/* --- @source_killall@ --- *
*
* Arguments: ---