]> git.scottworley.com Git - tattlekey/blobdiff - client/press.h
client: xcalloc
[tattlekey] / client / press.h
index b13f9a8e65b0b38e0053cd647110f851fd097bd7..69789e0984100a522f79f456ac1122a40d56c7aa 100644 (file)
@@ -10,13 +10,24 @@ typedef struct {
   u8_t send_count;
 } press_t;
 
   u8_t send_count;
 } press_t;
 
-bool next_send_less_than(void *user_data, pheap_node_id_t a, pheap_node_id_t b);
+typedef struct {
+  press_t *presses;
+  pheap_t *sleeps_heap;
+} press_pile_t;
+
+press_pile_t *create_press_pile();
 
 
-void create_press(press_t *presses, pheap_t *sleeps_heap, uint32_t timestamp,
-                  u16_t seq);
+/* Adds this press to the pile.
+ * Copies the contents of `press`. */
+void add_press(press_pile_t *pp, press_t *press);
 
 /* When do we next need to send something (in seconds since boot)?
  * Returns -1 if there's nothing pending. */
 
 /* When do we next need to send something (in seconds since boot)?
  * Returns -1 if there's nothing pending. */
-int32_t next_scheduled_send(press_t *presses, pheap_t *sleeps_heap);
+int32_t next_scheduled_send(press_pile_t *pp);
+
+/* Find a press ready for resend at or before `now`.
+ * Move it out of the press-pile `pp` and into into `press`.
+ * Or return false if there is no press due for re-send. */
+bool get_press_due_for_resend(press_pile_t *pp, uint32_t now, press_t *press);
 
 #endif
 
 #endif