Squashed 'third_party/rawrtc/re/' content from commit f3163ce8b

Change-Id: I6a235e6ac0f03269d951026f9d195da05c40fdab
git-subtree-dir: third_party/rawrtc/re
git-subtree-split: f3163ce8b526a13b35ef71ce4dd6f43585064d8a
diff --git a/include/re_tmr.h b/include/re_tmr.h
new file mode 100644
index 0000000..b399fb1
--- /dev/null
+++ b/include/re_tmr.h
@@ -0,0 +1,46 @@
+/**
+ * @file re_tmr.h  Interface to timer implementation
+ *
+ * Copyright (C) 2010 Creytiv.com
+ */
+
+
+/**
+ * Defines the timeout handler
+ *
+ * @param arg Handler argument
+ */
+typedef void (tmr_h)(void *arg);
+
+/** Defines a timer */
+struct tmr {
+	struct le le;       /**< Linked list element */
+	tmr_h *th;          /**< Timeout handler     */
+	void *arg;          /**< Handler argument    */
+	uint64_t jfs;       /**< Jiffies for timeout */
+};
+
+
+void     tmr_poll(struct list *tmrl);
+uint64_t tmr_jiffies(void);
+uint64_t tmr_next_timeout(struct list *tmrl);
+void     tmr_debug(void);
+int      tmr_status(struct re_printf *pf, void *unused);
+
+void     tmr_init(struct tmr *tmr);
+void     tmr_start(struct tmr *tmr, uint64_t delay, tmr_h *th, void *arg);
+void     tmr_cancel(struct tmr *tmr);
+uint64_t tmr_get_expire(const struct tmr *tmr);
+
+
+/**
+ * Check if the timer is running
+ *
+ * @param tmr Timer to check
+ *
+ * @return true if running, false if not running
+ */
+static inline bool tmr_isrunning(const struct tmr *tmr)
+{
+	return tmr ? NULL != tmr->th : false;
+}