bankd: Log worker number; Add formal state + state transition function

Change-Id: Ib18e3ad79657e9423a1c1ac75438abcd2e4fdbbd
diff --git a/src/bankd.h b/src/bankd.h
index eabf132..bf976d0 100644
--- a/src/bankd.h
+++ b/src/bankd.h
@@ -64,6 +64,21 @@
 /* thread-safe removal of a bank<->client map */
 void bankd_slotmap_del(struct bankd *bankd, struct bankd_slot_mapping *map);
 
+enum bankd_worker_state {
+	/* just started*/
+	BW_ST_INIT,
+	/* blocking in the accept() call on the server socket fd */
+	BW_ST_ACCEPTING,
+	/* TCP established, but peer not yet identified itself */
+	BW_ST_CONN_WAIT_ID,
+	/* TCP established, client has identified itself, no mapping */
+	BW_ST_CONN_CLIENT,
+	/* TCP established, client has identified itself, mapping exists */
+	BW_ST_CONN_CLIENT_MAPPED,
+	/* TCP established, client identified, mapping exists, card opened */
+	BW_ST_CONN_CLIENT_MAPPED_CARD,
+};
+
 
 /* bankd worker instance; one per card/slot, includes thread */
 struct bankd_worker {
@@ -72,6 +87,11 @@
 	/* back-pointer to bankd */
 	struct bankd *bankd;
 
+	/* thread number */
+	unsigned int num;
+	/* worker thread state */
+	enum bankd_worker_state state;
+
 	/* slot number we are representing */
 	struct bank_slot slot;