1 /* 2 * Created on 12-Jan-2005 3 * Created by Paul Gardner 4 * Copyright (C) Azureus Software, Inc, All Rights Reserved. 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 */ 19 20 package com.aelitis.azureus.core.dht.transport; 21 22 /** 23 * @author parg 24 * 25 */ 26 27 import java.util.*; 28 import java.io.*; 29 import java.net.InetSocketAddress; 30 31 import com.aelitis.azureus.core.dht.netcoords.DHTNetworkPosition; 32 33 public interface 34 DHTTransportContact 35 { 36 public static final int RANDOM_ID_TYPE1 = 1; 37 public static final int RANDOM_ID_TYPE2 = 2; 38 39 public int getMaxFailForLiveCount()40 getMaxFailForLiveCount(); 41 42 public int getMaxFailForUnknownCount()43 getMaxFailForUnknownCount(); 44 45 public int getInstanceID()46 getInstanceID(); 47 48 public byte[] getID()49 getID(); 50 51 public byte getProtocolVersion()52 getProtocolVersion(); 53 54 public long getClockSkew()55 getClockSkew(); 56 57 public int getRandomIDType()58 getRandomIDType(); 59 60 public void setRandomID( int id )61 setRandomID( 62 int id ); 63 64 public int getRandomID()65 getRandomID(); 66 67 public void setRandomID2( byte[] id )68 setRandomID2( 69 byte[] id ); 70 71 public byte[] getRandomID2()72 getRandomID2(); 73 74 public String getName()75 getName(); 76 77 public byte[] getBloomKey()78 getBloomKey(); 79 80 public InetSocketAddress getAddress()81 getAddress(); 82 83 public InetSocketAddress getTransportAddress()84 getTransportAddress(); 85 86 public InetSocketAddress getExternalAddress()87 getExternalAddress(); 88 89 public boolean isAlive( long timeout )90 isAlive( 91 long timeout ); 92 93 public void isAlive( DHTTransportReplyHandler handler, long timeout )94 isAlive( 95 DHTTransportReplyHandler handler, 96 long timeout ); 97 98 public boolean isValid()99 isValid(); 100 101 public boolean isSleeping()102 isSleeping(); 103 104 public void sendPing( DHTTransportReplyHandler handler )105 sendPing( 106 DHTTransportReplyHandler handler ); 107 108 public void sendImmediatePing( DHTTransportReplyHandler handler, long timeout )109 sendImmediatePing( 110 DHTTransportReplyHandler handler, 111 long timeout ); 112 113 public void sendStats( DHTTransportReplyHandler handler )114 sendStats( 115 DHTTransportReplyHandler handler ); 116 117 public void sendStore( DHTTransportReplyHandler handler, byte[][] keys, DHTTransportValue[][] value_sets, boolean immediate )118 sendStore( 119 DHTTransportReplyHandler handler, 120 byte[][] keys, 121 DHTTransportValue[][] value_sets, 122 boolean immediate ); 123 124 public void sendQueryStore( DHTTransportReplyHandler handler, int header_length, List<Object[]> key_details )125 sendQueryStore( 126 DHTTransportReplyHandler handler, 127 int header_length, 128 List<Object[]> key_details ); 129 130 public void sendFindNode( DHTTransportReplyHandler handler, byte[] id, short flags )131 sendFindNode( 132 DHTTransportReplyHandler handler, 133 byte[] id, 134 short flags ); 135 136 public void sendFindValue( DHTTransportReplyHandler handler, byte[] key, int max_values, short flags )137 sendFindValue( 138 DHTTransportReplyHandler handler, 139 byte[] key, 140 int max_values, 141 short flags ); 142 143 public void sendKeyBlock( DHTTransportReplyHandler handler, byte[] key_block_request, byte[] key_block_signature )144 sendKeyBlock( 145 DHTTransportReplyHandler handler, 146 byte[] key_block_request, 147 byte[] key_block_signature ); 148 149 public DHTTransportFullStats getStats()150 getStats(); 151 152 public void exportContact( DataOutputStream os )153 exportContact( 154 DataOutputStream os ) 155 156 throws IOException, DHTTransportException; 157 158 public Map<String, Object> exportContactToMap()159 exportContactToMap(); 160 161 public void remove()162 remove(); 163 164 public void createNetworkPositions( boolean is_local )165 createNetworkPositions( 166 boolean is_local ); 167 168 public DHTNetworkPosition[] getNetworkPositions()169 getNetworkPositions(); 170 171 public DHTNetworkPosition getNetworkPosition( byte position_type )172 getNetworkPosition( 173 byte position_type ); 174 175 public DHTTransport getTransport()176 getTransport(); 177 178 public String getString()179 getString(); 180 } 181