]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - para.h
Revamp status item handling.
[paraslash.git] / para.h
diff --git a/para.h b/para.h
index fcc24746be9b18d5460292b42504898106131689..995bfb9d396d089d7d163f794c4c91ff3e61f614 100644 (file)
--- a/para.h
+++ b/para.h
@@ -181,9 +181,11 @@ extern const char *status_item_list[];
 /** Loop over each status item. */
 #define FOR_EACH_STATUS_ITEM(i) for (i = 0; i < NUM_STAT_ITEMS; i++)
 int stat_item_valid(const char *item);
-int stat_line_valid(const char *);
-void stat_client_write(const char *msg, int itemnum);
-int stat_client_add(int fd, long unsigned mask);
+void stat_client_write_item(int item_num);
+int stat_client_add(int fd, uint64_t mask, int parser_friendly);
+int for_each_stat_item(char *item_buf, size_t num_bytes,
+       int (*item_handler)(int, char *));
+void clear_and_dump_items(void);
 
 __printf_2_3 void para_log(int, const char*, ...);
 
@@ -230,7 +232,8 @@ static inline long int para_random(unsigned max)
 }
 
 /** Round up x to a multiple of y */
-#define ROUND_UP(x, y) (((x) + ((y) - 1) / (y)) * (y))
+#define ROUND_UP(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
+
 
 /** Get the size of an array */
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
@@ -249,3 +252,8 @@ static inline long int para_random(unsigned max)
  * horribly for characters which have their most significant bit set.
  */
 #define para_isspace(c) isspace((int)(unsigned char)(c))
+
+/** Data that indicates an eof-condition for a fec-encoded stream. */
+#define FEC_EOF_PACKET "\xec\x0d\xcc\xfe\0\0\0\0" \
+       "\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0"
+#define FEC_EOF_PACKET_LEN 32