#include <stdint.h>

#define PEER_ID_LEN 6

struct Peer {
  char *peer_name;
  const char *peer_id;
  uint64_t last_online;
  uint8_t tags;
  struct Peer *next;
};

struct Storage {
  struct Peer *peers;
  char *peerids;
  int peerid_len;
  int peerid_cap;
};

struct Storage *storage_init();
int storage_save_peer(struct Storage *st, const struct Peer *peer);
struct Peer *storage_read_peer(struct Storage *st, const char *pid);
struct Peer *storage_read_tag(struct Storage *st, struct Peer *p, int id);
char *peer2json(struct Peer *p);
