Some small cleanups.

TODO: remove old todos that have been done.
This commit is contained in:
irungentoo 2014-01-01 22:24:09 -05:00
parent 97b9a9cf04
commit ec429b7fee
3 changed files with 18 additions and 9 deletions

View File

@ -153,7 +153,6 @@ void getaddress(Messenger *m, uint8_t *address)
* Add a friend.
* Set the data that will be sent along with friend request.
* Address is the address of the friend (returned by getaddress of the friend you wish to add) it must be FRIEND_ADDRESS_SIZE bytes.
* TODO: add checksum.
* data is the data and length is the length.
*
* return the friend number if success.
@ -1604,7 +1603,6 @@ static void check_friend_request_timed_out(Messenger *m, uint32_t i, uint64_t t)
/* TODO: Make this function not suck. */
void do_friends(Messenger *m)
{
/* TODO: Add incoming connections and some other stuff. */
uint32_t i;
int len;
uint8_t temp[MAX_DATA_SIZE];

View File

@ -27,14 +27,14 @@
#define MAX_ONION_SIZE MAX_DATA_SIZE
#define RETURN_1 (crypto_secretbox_NONCEBYTES + sizeof(IP_Port) + crypto_secretbox_MACBYTES)
#define RETURN_2 (crypto_secretbox_NONCEBYTES + sizeof(IP_Port) + crypto_secretbox_MACBYTES + RETURN_1)
#define RETURN_3 (crypto_secretbox_NONCEBYTES + sizeof(IP_Port) + crypto_secretbox_MACBYTES + RETURN_2)
#define RETURN_1 ONION_RETURN_1
#define RETURN_2 ONION_RETURN_2
#define RETURN_3 ONION_RETURN_3
#define SEND_BASE (crypto_box_PUBLICKEYBYTES + sizeof(IP_Port) + crypto_box_MACBYTES)
#define SEND_3 (crypto_box_NONCEBYTES + SEND_BASE + RETURN_2)
#define SEND_2 (crypto_box_NONCEBYTES + SEND_BASE*2 + RETURN_1)
#define SEND_1 (crypto_box_NONCEBYTES + SEND_BASE*3)
#define SEND_BASE ONION_SEND_BASE
#define SEND_3 ONION_SEND_3
#define SEND_2 ONION_SEND_2
#define SEND_1 ONION_SEND_1
/* Create and send a onion packet.
*
@ -318,6 +318,7 @@ static int handle_recv_1(void *object, IP_Port source, uint8_t *packet, uint32_t
}
Onion *new_onion(DHT *dht)
{
if (dht == NULL)

View File

@ -28,6 +28,16 @@ typedef struct {
uint8_t secret_symmetric_key[crypto_secretbox_KEYBYTES];
} Onion;
#define ONION_RETURN_1 (crypto_secretbox_NONCEBYTES + sizeof(IP_Port) + crypto_secretbox_MACBYTES)
#define ONION_RETURN_2 (crypto_secretbox_NONCEBYTES + sizeof(IP_Port) + crypto_secretbox_MACBYTES + ONION_RETURN_1)
#define ONION_RETURN_3 (crypto_secretbox_NONCEBYTES + sizeof(IP_Port) + crypto_secretbox_MACBYTES + ONION_RETURN_2)
#define ONION_SEND_BASE (crypto_box_PUBLICKEYBYTES + sizeof(IP_Port) + crypto_box_MACBYTES)
#define ONION_SEND_3 (crypto_box_NONCEBYTES + ONION_SEND_BASE + ONION_RETURN_2)
#define ONION_SEND_2 (crypto_box_NONCEBYTES + ONION_SEND_BASE*2 + ONION_RETURN_1)
#define ONION_SEND_1 (crypto_box_NONCEBYTES + ONION_SEND_BASE*3)
/* Create and send a onion packet.
*
* nodes is a list of 4 nodes, the packet will route through nodes 0, 1, 2 and the data