diff options
Diffstat (limited to 'src/org/gnunet/transport/Transport.java')
-rw-r--r-- | src/org/gnunet/transport/Transport.java | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/src/org/gnunet/transport/Transport.java b/src/org/gnunet/transport/Transport.java new file mode 100644 index 0000000..f79c340 --- /dev/null +++ b/src/org/gnunet/transport/Transport.java | |||
@@ -0,0 +1,103 @@ | |||
1 | package org.gnunet.transport; | ||
2 | |||
3 | import org.gnunet.hello.HelloMessage; | ||
4 | import org.gnunet.util.*; | ||
5 | |||
6 | /** | ||
7 | * ... | ||
8 | * | ||
9 | * @author Florian Dold | ||
10 | */ | ||
11 | public class Transport { | ||
12 | |||
13 | public Transport(Configuration cfg) { | ||
14 | |||
15 | } | ||
16 | |||
17 | /** | ||
18 | * Ask the transport service to establish a connection to | ||
19 | * the given peer. | ||
20 | * | ||
21 | * @param target who we should try to connect to | ||
22 | * @param cb callback to be called when request was transmitted to transport | ||
23 | * service | ||
24 | * @return a GNUNET_TRANSPORT_TryConnectHandle handle or | ||
25 | * NULL on failure (cb will not be called) | ||
26 | */ | ||
27 | Cancelable tryConnect(PeerIdentity target, TryConnectCallback cb) { | ||
28 | throw new UnsupportedOperationException(); | ||
29 | } | ||
30 | |||
31 | |||
32 | /** | ||
33 | * Obtain the HELLO message for this peer. | ||
34 | * | ||
35 | * @param rec function to call with the HELLO, sender will be our peer | ||
36 | * identity; message and sender will be NULL on timeout | ||
37 | * (handshake with transport service pending/failed). | ||
38 | * cost estimate will be 0. | ||
39 | * @return handle to cancel the operation | ||
40 | */ | ||
41 | Cancelable getHello(HelloUpdateCallback rec) { | ||
42 | throw new UnsupportedOperationException(); | ||
43 | } | ||
44 | |||
45 | /** | ||
46 | * Offer the transport service the HELLO of another peer. Note that | ||
47 | * the transport service may just ignore this message if the HELLO is | ||
48 | * malformed or useless due to our local configuration. | ||
49 | * | ||
50 | * @param hello the hello message | ||
51 | * @param cont continuation to call when HELLO has been sent, | ||
52 | * tc reason GNUNET_SCHEDULER_REASON_TIMEOUT for fail | ||
53 | * tc reasong GNUNET_SCHEDULER_REASON_READ_READY for success | ||
54 | * @return a GNUNET_TRANSPORT_OfferHelloHandle handle or NULL on failure, | ||
55 | * in case of failure cont will not be called | ||
56 | */ | ||
57 | |||
58 | Cancelable offerHello(HelloMessage hello, | ||
59 | Scheduler.Task cont) { | ||
60 | throw new UnsupportedOperationException(); | ||
61 | } | ||
62 | |||
63 | /** | ||
64 | * Install a blacklist callback. The service will be queried for all | ||
65 | * existing connections as well as any fresh connections to check if | ||
66 | * they are permitted. If the blacklisting callback is unregistered, | ||
67 | * all hosts that were denied in the past will automatically be | ||
68 | * whitelisted again. Cancelling the blacklist handle is also the | ||
69 | * only way to re-enable connections from peers that were previously | ||
70 | * blacklisted. | ||
71 | * | ||
72 | * @param cfg configuration to use | ||
73 | * @param cb callback to invoke to check if connections are allowed | ||
74 | * @return NULL on error, otherwise handle for cancellation | ||
75 | */ | ||
76 | static Cancelable blacklist(Configuration cfg, | ||
77 | BlacklistCallback cb) { | ||
78 | throw new UnsupportedOperationException(); | ||
79 | } | ||
80 | |||
81 | /** | ||
82 | * Return all the known addresses for a specific peer or all peers. | ||
83 | * Returns continuously all address if one_shot is set to GNUNET_NO | ||
84 | * <p/> | ||
85 | * CHANGE: Returns the address(es) that we are currently using for this | ||
86 | * peer. Upon completion, the 'AddressLookUpCallback' is called one more | ||
87 | * time with 'NULL' for the address and the peer. After this, the operation must no | ||
88 | * longer be explicitly canceled. | ||
89 | * | ||
90 | * @param cfg configuration to use | ||
91 | * @param peer peer identity to look up the addresses of, CHANGE: allow NULL for all (connected) peers | ||
92 | * @param one_shot GNUNET_YES to return the current state and then end (with NULL+NULL), | ||
93 | * GNUNET_NO to monitor the set of addresses used (continuously, must be explicitly canceled) | ||
94 | * @param timeout how long is the lookup allowed to take at most (irrelevant if one_shot is set to GNUNET_NO) | ||
95 | * @param peer_address_callback function to call with the results | ||
96 | */ | ||
97 | Cancelable | ||
98 | peer_get_active_addresses(Configuration cfg, PeerIdentity peer, int one_shot, | ||
99 | RelativeTime timeout, PeerIterateCallback peer_address_callback) { | ||
100 | throw new UnsupportedOperationException(); | ||
101 | } | ||
102 | } | ||
103 | |||