#ifndef LC6_COMMON_H #define LC6_COMMON_H #include #include #include "../inc/libchat6.h" #include "../inc/lc6_helpers.h" #ifdef LC6_DEBUG #define malloc(x) lc6helpers_malloc(x, __FILE__, __func__, __LINE__) #define realloc(x,y) lc6helpers_realloc(x, y, __FILE__, __func__, __LINE__) #define free(x) lc6helpers_free(x, __FILE__, __func__, __LINE__) #endif typedef struct LC6_NODE { unsigned char *pub_key; unsigned char *priv_key; } LC6_NODE; typedef struct LC6_USER { struct LC6_USER *prev; struct LC6_USER *next; unsigned char nickname[256]; unsigned char pub_key[32]; unsigned char priv_key[32]; uint8_t status; } LC6_USER; typedef struct LC6_FRIEND { struct LC6_FRIEND *prev; struct LC6_FRIEND *next; unsigned char nickname[256]; unsigned char pub_key[32]; uint8_t status; } LC6_FRIEND; #define LC6_CONFIG_BOOTSTRAP "bootstrap.bin" #define LC6_CONFIG_USER "user.bin" #define LC6_CONFIG_FRIEND "friends.bin" #define LC6_CONFIG_MAXLEN 50 typedef struct LC6_BOOTSTRAP { struct LC6_BOOTSTRAP *prev; struct LC6_BOOTSTRAP *next; uint64_t last_contact; uint8_t af; union addr { uint32_t inet; unsigned char inet6[16]; } addr; } LC6_BOOTSTRAP; typedef struct LC6_CTX { char path[MAXPATHLEN-LC6_CONFIG_MAXLEN]; LC6_USER *user; LC6_USER *node; LC6_FRIEND *friend; LC6_BOOTSTRAP *bootstrap; } LC6_CTX; #endif