+/* FIXME: find a better value */
+#define NUMBER_RANDOM_WALK 20
+
+
+/******************* The db structure and related functions *******************/
+
+/**
+ * Entry in #friends_peermap.
+ */
+struct FriendInfo;
+
+/**
+ *
+ */
+struct FingerTable;
+
+/**
+ * Information we keep per trail.
+ */
+struct Trail
+{
+
+ /**
+ * Identifier of the trail with the predecessor.
+ */
+ struct GNUNET_HashCode pred_id;
+
+ /**
+ * Identifier of the trail with the successor.
+ */
+ struct GNUNET_HashCode succ_id;
+
+ /**
+ * When does this trail expire.
+ */
+ struct GNUNET_TIME_Absolute expiration_time;
+
+ /**
+ * MDLL entry in the list of all trails with the same predecessor.
+ */
+ struct Trail *prev_succ;
+
+ /**
+ * MDLL entry in the list of all trails with the same predecessor.
+ */
+ struct Trail *next_succ;
+
+ /**
+ * MDLL entry in the list of all trails with the same predecessor.
+ */
+ struct Trail *prev_pred;
+
+ /**
+ * MDLL entry in the list of all trails with the same predecessor.
+ */
+ struct Trail *next_pred;
+
+ /**
+ * Our predecessor in the trail, NULL if we are initiator (?).
+ */
+ struct FriendInfo *pred;
+
+ /**
+ * Our successor in the trail, NULL if we are the last peer.
+ */
+ struct FriendInfo *succ;
+
+ /**
+ * Location of this trail in the heap.
+ */
+ struct GNUNET_CONTAINER_HeapNode *hn;
+
+ /**
+ * If this peer started the to create a Finger (and thus @e pred is
+ * NULL), this is the finger table of the finger we are trying to
+ * intialize.
+ */
+ struct FingerTable *ft;
+
+ /**
+ * If this peer started the trail to create a Finger (and thus @e
+ * pred is NULL), this is the offset of the finger we are trying to
+ * intialize in the unsorted array.
+ */
+ unsigned int finger_off;
+
+};
+
+
+/**
+ * Entry in #friends_peermap.
+ */
+struct FriendInfo
+{
+ /**
+ * Friend Identity
+ */
+ const struct GNUNET_PeerIdentity *id;
+
+ /**
+ *
+ */
+ struct Trail *pred_head;
+
+ /**
+ *
+ */
+ struct Trail *pred_tail;
+
+ /**
+ *
+ */
+ struct Trail *succ_head;
+
+ /**
+ *
+ */
+ struct Trail *succ_tail;
+
+ /**
+ * Core handle for sending messages to this friend.
+ */
+ struct GNUNET_MQ_Handle *mq;
+
+};
+
+
+/**
+ *
+ */
+struct Finger
+{
+ /**
+ *
+ */
+ struct Trail *trail;
+
+ /**
+ *
+ */
+ struct FingerTable *ft;
+
+ /**
+ *
+ */
+ struct GNUNET_HashCode destination;
+
+ /**
+ * #GNUNET_YES if a response has been received. Otherwise #GNUNET_NO.
+ */
+ int valid;
+};
+
+
+struct FingerTable
+{
+ /**
+ * Array of our fingers, unsorted.
+ */
+ struct Finger **fingers;
+
+ /**
+ * Size of the finger array.
+ */
+ unsigned int finger_array_size;
+
+ /**
+ * Number of valid entries in @e fingers
+ */
+ unsigned int number_valid_fingers;
+
+ /**
+ * Which offset in @e fingers will we redo next.
+ */
+ unsigned int walk_offset;
+
+ /**
+ * Is the finger array sorted?
+ */
+ int is_sorted;
+
+};
+
+
+/*********************** end of the db structure part ***********************/