libdht
peers.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 naturalpolice
3  * SPDX-License-Identifier: MIT
4  *
5  * Licensed under the MIT License (see LICENSE).
6  */
7 
16 #ifndef DHT_PEERS_H_
17 #define DHT_PEERS_H_
18 
19 #include <stdlib.h>
20 
33 typedef void (*get_peers_callback)(const unsigned char info_hash[20],
34  const struct sockaddr_storage *peers,
35  size_t count,
36  void *opaque);
37 
54 int dht_get_peers(struct dht_node *node, const unsigned char info_hash[20],
55  get_peers_callback callback, void *opaque,
56  dht_search_t *handle);
57 
83 int dht_announce_peer(struct dht_node *node, const unsigned char info_hash[20],
84  int port, get_peers_callback callback, void *opaque,
85  dht_search_t *handle);
86 
87 #endif /* DHT_PEERS_H_ */
DHT node object.
Definition: node.h:140
int dht_announce_peer(struct dht_node *node, const unsigned char info_hash[20], int port, get_peers_callback callback, void *opaque, dht_search_t *handle)
Announce peer for an infohash.
struct search * dht_search_t
Search handle.
Definition: node.h:165
int dht_get_peers(struct dht_node *node, const unsigned char info_hash[20], get_peers_callback callback, void *opaque, dht_search_t *handle)
Search the DHT for peers for an infohash.
void(* get_peers_callback)(const unsigned char info_hash[20], const struct sockaddr_storage *peers, size_t count, void *opaque)
Peer search complete callback.
Definition: peers.h:33