diff options
Diffstat (limited to 'core/friend_requests.h')
-rw-r--r-- | core/friend_requests.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/core/friend_requests.h b/core/friend_requests.h new file mode 100644 index 00000000..a3de46c8 --- /dev/null +++ b/core/friend_requests.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* friend_requests.h | ||
2 | * | ||
3 | * Handle friend requests. | ||
4 | * | ||
5 | */ | ||
6 | |||
7 | |||
8 | #ifndef FRIEND_REQUESTS_H | ||
9 | #define FRIEND_REQUESTS_H | ||
10 | |||
11 | |||
12 | #include "DHT.h" | ||
13 | #include "net_crypto.h" | ||
14 | |||
15 | |||
16 | /* Try to send a friendrequest to peer with public_key | ||
17 | data is the data in the request and length is the length. */ | ||
18 | int send_friendrequest(uint8_t * public_key, uint8_t * data, uint32_t length); | ||
19 | |||
20 | |||
21 | /* set the function that will be executed when a friend request for us is received. | ||
22 | function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) */ | ||
23 | void callback_friendrequest(void (*function)(uint8_t *, uint8_t *, uint16_t)); | ||
24 | |||
25 | /* if we receive a packet we call this function so it can be handled. | ||
26 | return 0 if packet is handled correctly. | ||
27 | return 1 if it didn't handle the packet or if the packet was shit. */ | ||
28 | int friendreq_handlepacket(uint8_t * packet, uint32_t length, IP_Port source); | ||
29 | |||
30 | |||
31 | |||
32 | |||
33 | |||
34 | #endif \ No newline at end of file | ||