1 /*
2  * Created on 20-Dec-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.instancemanager;
21 
22 import java.net.InetAddress;
23 import java.net.InetSocketAddress;
24 import java.util.regex.PatternSyntaxException;
25 
26 
27 public interface
28 AZInstanceManager
29 {
30 	public static final int	AT_TCP				= 1;
31 	public static final int	AT_UDP				= 2;
32 	public static final int	AT_UDP_NON_DATA		= 3;
33 
34 	public void
initialize()35 	initialize();
36 
37 	public boolean
isInitialized()38 	isInitialized();
39 
40 	public AZInstance
getMyInstance()41 	getMyInstance();
42 
43 	public int
getOtherInstanceCount( boolean block_if_needed )44 	getOtherInstanceCount(
45 		boolean	block_if_needed );
46 
47 	public AZInstance[]
getOtherInstances()48 	getOtherInstances();
49 
50 	public void
updateNow()51 	updateNow();
52 
53 	public AZInstanceTracked[]
track( byte[] hash, AZInstanceTracked.TrackTarget target )54 	track(
55 		byte[]								hash,
56 		AZInstanceTracked.TrackTarget		target );
57 
58 	public InetSocketAddress
getLANAddress( InetSocketAddress external_address, int address_type )59 	getLANAddress(
60 		InetSocketAddress	external_address,
61 		int					address_type );
62 
63 	public InetSocketAddress
getExternalAddress( InetSocketAddress lan_address, int address_type )64 	getExternalAddress(
65 		InetSocketAddress	lan_address,
66 		int					address_type );
67 
68 	public boolean
isLANAddress( InetAddress address )69 	isLANAddress(
70 		InetAddress			address );
71 
72 	public boolean
isExternalAddress( InetAddress address )73 	isExternalAddress(
74 		InetAddress			address );
75 
76 	public boolean
addLANSubnet( String subnet )77 	addLANSubnet(
78 		String				subnet )
79 
80 		throws PatternSyntaxException;
81 
82 	public boolean
getIncludeWellKnownLANs()83 	getIncludeWellKnownLANs();
84 
85 	public void
setIncludeWellKnownLANs( boolean include )86 	setIncludeWellKnownLANs(
87 		boolean		include );
88 
89 	public long
getClockSkew()90 	getClockSkew();
91 
92 	public boolean
addInstance( InetAddress explicit_address )93 	addInstance(
94 		InetAddress			explicit_address );
95 
96 	public void
addListener( AZInstanceManagerListener l )97 	addListener(
98 		AZInstanceManagerListener	l );
99 
100 	public void
removeListener( AZInstanceManagerListener l )101 	removeListener(
102 		AZInstanceManagerListener	l );
103 }
104