summaryrefslogtreecommitdiff
path: root/core/net_crypto.h
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-07-22 14:52:42 -0400
committerirungentoo <irungentoo@gmail.com>2013-07-22 14:52:42 -0400
commit55361eac6f12fb2b2aaec427129aae65f5eb5e6b (patch)
tree41107d3aaa5edd4bc7e24951390ed676f00e8b2c /core/net_crypto.h
parentb368a6b4b898e2d2fa558931f724f2d204de6335 (diff)
Modified the way friend requests worked.
Added routing of friend requests.
Diffstat (limited to 'core/net_crypto.h')
-rw-r--r--core/net_crypto.h26
1 files changed, 11 insertions, 15 deletions
diff --git a/core/net_crypto.h b/core/net_crypto.h
index 0bf21f60..5a282002 100644
--- a/core/net_crypto.h
+++ b/core/net_crypto.h
@@ -62,24 +62,20 @@ int read_cryptpacket(int crypt_connection_id, uint8_t * data);
62 return 1 if data was put into the queue */ 62 return 1 if data was put into the queue */
63int write_cryptpacket(int crypt_connection_id, uint8_t * data, uint32_t length); 63int write_cryptpacket(int crypt_connection_id, uint8_t * data, uint32_t length);
64 64
65/* send a friend request to peer with public_key and ip_port. 65/* create a request to peer with public_key.
66 Data represents the data we send with the friends request. 66 packet must be an array of MAX_DATA_SIZE big.
67 Data represents the data we send with the request with length being the length of the data.
68 request_id is the id of the request (32 = friend request, 254 = ping request)
67 returns -1 on failure 69 returns -1 on failure
68 returns a positive friend request id that can be used later to see if it was sent correctly on success. */ 70 returns the length of the created packet on success */
69int send_friendrequest(uint8_t * public_key, IP_Port ip_port, uint8_t * data, uint32_t length); 71int create_request(uint8_t * packet, uint8_t * public_key, uint8_t * data, uint32_t length, uint8_t request_id);
70 72
71 73
72/* return -1 if failure 74/* puts the senders public key in the request in public_key, the data from the request
73 return 0 if connection is still trying to send the request. 75 in data if a friend or ping request was sent to us and returns the length of the data.
74 return 1 if sent correctly 76 packet is the request packet and length is its length
75 return 2 if connection timed out */ 77 return -1 if not valid request. */
76int check_friendrequest(int friend_request); 78int handle_request(uint8_t * public_key, uint8_t * data, uint8_t * packet, uint16_t length);
77
78
79/* puts the public key of the friend if public_key, the data from the request
80 in data if a friend request was sent to us and returns the length of the data.
81 return -1 if no valid friend requests. */
82int handle_friendrequest(uint8_t * public_key, uint8_t * data);
83 79
84 80
85/* Start a secure connection with other peer who has public_key and ip_port 81/* Start a secure connection with other peer who has public_key and ip_port