Package com.biglybt.plugin.net.buddy
Class BuddyPluginNetwork
java.lang.Object
com.biglybt.plugin.net.buddy.BuddyPluginNetwork
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
protected static interface
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BuddyPluginAZ2
static final int
private static final int
private static final int
private List
<BuddyPluginBuddy> private Map
<String, BuddyPluginBuddy> private static final int
private static final int
private static final int
private static final int
private boolean
private boolean
private final String
private List
<BuddyPluginBuddy> private CryptoHandler
static final int
private static final int
private GenericMessageRegistration
static final int
private Set
<BuddyPluginBuddy> private List
<BuddyPluginBuddy> private AESemaphore
private AEThread2
private static final int
private static final int
static final int
private final BuddyPlugin
private final PluginInterface
private Random
private boolean
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
private static final int
private static final int
private SESecurityManager
protected static final int
private static final int
private static final int
static final int
static final int
static final int
static final int
protected static final int
private final String
private static final int
protected static final boolean
private BloomFilter
private static final int
private long
private static final int
static final int
static final int
static final int
private static final int
private static final int
private BloomFilter
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BuddyPluginNetwork
(PluginInterface _plugin_interface, BuddyPlugin _plugin, String _target_network) -
Method Summary
Modifier and TypeMethodDescriptionprotected BuddyPluginBuddy
protected void
protected void
protected void
protected void
checkMaxMessageSize
(int size) void
checkMessagePending
(int tick_count) protected void
protected void
protected void
protected String
decodeString
(byte[] bytes) protected BuddyPlugin.CryptoResult
decrypt
(BuddyPluginBuddy buddy, byte[] content, String forName) protected void
protected BuddyPlugin.CryptoResult
encrypt
(BuddyPluginBuddy buddy, byte[] payload) protected void
fireAdded
(BuddyPluginBuddy buddy) protected void
protected void
fireRemoved
(BuddyPluginBuddy buddy) protected void
fireYGM
(BuddyPluginBuddy[] from_buddies) protected List
<BuddyPluginBuddy> Returns authorised buddies onlyprotected File
protected int
protected BuddyPluginNetwork.DDBDetails
getDDBDetails
(String net) String[]
protected MagnetPlugin
protected GenericMessageRegistration
int
boolean
protected BuddyPlugin
protected SESecurityManager
protected GenericMessageConnection
getSTSConnection
(GenericMessageConnection connection, String reason, SEPublicKeyLocator locator) protected InputStream
handleUPRSS
(AZPluginConnection connection, BuddyPluginBuddy buddy, String tag_or_category) protected InputStream
handleUPTorrent
(AZPluginConnection connection, BuddyPluginBuddy buddy, String tag_or_category, byte[] hash) boolean
protected void
protected void
log
(BuddyPluginBuddy buddy, String str) protected void
log
(BuddyPluginBuddy buddy, String str, Throwable e) protected void
logMessage
(BuddyPluginBuddy buddy, String str) protected void
logMessage
(BuddyPluginBuddy buddy, String str, Throwable e) protected void
protected void
protected Map
processInternalRequest
(BuddyPluginBuddy from_buddy, Map request) protected Map
protected Map
readConfigFile
(File name) protected void
protected void
protected void
removeBuddy
(BuddyPluginBuddy buddy) protected void
protected Map
requestReceived
(BuddyPluginBuddy from_buddy, int subsystem, Map content) protected void
protected void
protected void
saveConfig
(boolean force) protected void
setClassicEnabledInternal
(boolean enabled) protected void
protected void
setMessagePending
(BuddyPluginBuddy buddy, BuddyPluginNetwork.operationListener _listener) byte[]
sign
(byte[] payload) protected byte[]
signAndInsert
(Map plain_stuff, String reason) protected boolean
protected boolean
stringsEqual
(String s1, String s2) protected boolean
tooManyUnauthConnections
(String originator) protected void
protected void
protected void
updateIP()
protected void
protected void
updateNickName
(String new_nick) protected void
updateOnlineStatus
(int new_status) protected boolean
verify
(byte[] pk, byte[] payload, byte[] signature) protected boolean
verify
(BuddyPluginBuddy buddy, byte[] payload, byte[] signature) boolean
protected Map
verifyAndExtract
(byte[] signed_stuff, byte[] public_key) boolean
verifyPublicKey
(String key) protected void
writeConfig
(Map map) protected boolean
writeConfigFile
(File name, Map data)
-
Field Details
-
VERSION_INITIAL
public static final int VERSION_INITIAL- See Also:
-
VERSION_CHAT
public static final int VERSION_CHAT- See Also:
-
VERSION_CURRENT
public static final int VERSION_CURRENT- See Also:
-
MT_V3_CHAT
public static final int MT_V3_CHAT- See Also:
-
MAX_MESSAGE_SIZE
public static final int MAX_MESSAGE_SIZE- See Also:
-
SUBSYSTEM_INTERNAL
public static final int SUBSYSTEM_INTERNAL- See Also:
-
SUBSYSTEM_AZ2
public static final int SUBSYSTEM_AZ2- See Also:
-
SUBSYSTEM_AZ3
public static final int SUBSYSTEM_AZ3- See Also:
-
SUBSYSTEM_MSG_TYPE_BASE
protected static final int SUBSYSTEM_MSG_TYPE_BASE- See Also:
-
RT_INTERNAL_REQUEST_PING
protected static final int RT_INTERNAL_REQUEST_PING- See Also:
-
RT_INTERNAL_REPLY_PING
protected static final int RT_INTERNAL_REPLY_PING- See Also:
-
RT_INTERNAL_REQUEST_CLOSE
protected static final int RT_INTERNAL_REQUEST_CLOSE- See Also:
-
RT_INTERNAL_REPLY_CLOSE
protected static final int RT_INTERNAL_REPLY_CLOSE- See Also:
-
RT_INTERNAL_FRAGMENT
protected static final int RT_INTERNAL_FRAGMENT- See Also:
-
TRACE
protected static final boolean TRACE- See Also:
-
MAX_UNAUTH_BUDDIES
private static final int MAX_UNAUTH_BUDDIES- See Also:
-
BUDDY_STATUS_CHECK_PERIOD_MIN
private static final int BUDDY_STATUS_CHECK_PERIOD_MIN- See Also:
-
BUDDY_STATUS_CHECK_PERIOD_INC
private static final int BUDDY_STATUS_CHECK_PERIOD_INC- See Also:
-
TIMER_PERIOD
private static final int TIMER_PERIOD- See Also:
-
STATUS_REPUBLISH_PERIOD
protected static final int STATUS_REPUBLISH_PERIOD- See Also:
-
STATUS_REPUBLISH_PERIOD_WHEN_DIVERSIFIED
private static final int STATUS_REPUBLISH_PERIOD_WHEN_DIVERSIFIED- See Also:
-
STATUS_REPUBLISH_TICKS
private static final int STATUS_REPUBLISH_TICKS- See Also:
-
CHECK_YGM_PERIOD
private static final int CHECK_YGM_PERIOD- See Also:
-
CHECK_YGM_TICKS
private static final int CHECK_YGM_TICKS- See Also:
-
YGM_BLOOM_LIFE_PERIOD
private static final int YGM_BLOOM_LIFE_PERIOD- See Also:
-
YGM_BLOOM_LIFE_TICKS
private static final int YGM_BLOOM_LIFE_TICKS- See Also:
-
SAVE_CONFIG_PERIOD
private static final int SAVE_CONFIG_PERIOD- See Also:
-
SAVE_CONFIG_TICKS
private static final int SAVE_CONFIG_TICKS- See Also:
-
PERSISTENT_MSG_RETRY_PERIOD
public static final int PERSISTENT_MSG_RETRY_PERIOD- See Also:
-
PERSISTENT_MSG_CHECK_PERIOD
private static final int PERSISTENT_MSG_CHECK_PERIOD- See Also:
-
PERSISTENT_MSG_CHECK_TICKS
private static final int PERSISTENT_MSG_CHECK_TICKS- See Also:
-
UNAUTH_BLOOM_RECREATE
private static final int UNAUTH_BLOOM_RECREATE- See Also:
-
UNAUTH_BLOOM_CHUNK
private static final int UNAUTH_BLOOM_CHUNK- See Also:
-
BLOOM_CHECK_PERIOD
private static final int BLOOM_CHECK_PERIOD- See Also:
-
BLOOM_CHECK_TICKS
private static final int BLOOM_CHECK_TICKS- See Also:
-
STREAM_CRYPTO
public static final int STREAM_CRYPTO- See Also:
-
BLOCK_CRYPTO
public static final int BLOCK_CRYPTO- See Also:
-
plugin_interface
-
plugin
-
target_network
-
config_file_name
-
ready_to_publish
private boolean ready_to_publish -
ddb_details
-
unauth_bloom
-
unauth_bloom_create_time
private long unauth_bloom_create_time -
ygm_unauth_bloom
-
request_listeners
-
buddies
-
connected_at_close
-
buddies_map
-
sec_man
-
ecc_handler
-
msg_registration
-
config_dirty
private boolean config_dirty -
random
-
az2_handler
-
pd_preinit
-
pd_queue
-
pd_queue_sem
-
pd_thread
-
closing
private volatile boolean closing
-
-
Constructor Details
-
BuddyPluginNetwork
protected BuddyPluginNetwork(PluginInterface _plugin_interface, BuddyPlugin _plugin, String _target_network)
-
-
Method Details
-
getPlugin
-
getTargetNetwork
-
isPublicNetwork
public boolean isPublicNetwork() -
getDDBNetworks
-
checkAvailable
- Throws:
BuddyPluginException
-
getPeersAreLANLocal
public boolean getPeersAreLANLocal() -
startup
-
reconnect
protected void reconnect() -
setClassicEnabledInternal
protected void setClassicEnabledInternal(boolean enabled) -
getOnlineStatus
public int getOnlineStatus() -
getProfileInfo
-
fireAdded
-
fireRemoved
-
fireDetailsChanged
-
registerMessageHandler
protected void registerMessageHandler() -
getSTSConnection
protected GenericMessageConnection getSTSConnection(GenericMessageConnection connection, String reason, SEPublicKeyLocator locator) throws Exception - Throws:
Exception
-
tooManyUnauthConnections
-
checkUnauthBloom
protected void checkUnauthBloom() -
checkMaxMessageSize
- Throws:
BuddyPluginException
-
checkPersistentDispatch
protected void checkPersistentDispatch() -
persistentDispatchInit
protected void persistentDispatchInit() -
persistentDispatchPending
-
processInternalRequest
protected Map processInternalRequest(BuddyPluginBuddy from_buddy, Map request) throws BuddyPluginException - Throws:
BuddyPluginException
-
updateListenPorts
protected void updateListenPorts() -
updateIP
protected void updateIP() -
updateNickName
-
updateOnlineStatus
protected void updateOnlineStatus(int new_status) -
stringsEqual
-
getDDBDetails
-
getCurrentStatusSeq
-
closedown
protected void closedown() -
setConfigDirty
protected void setConfigDirty() -
loadConfig
protected void loadConfig() -
decodeString
-
saveConfig
protected void saveConfig() -
saveConfig
protected void saveConfig(boolean force) -
addBuddy
-
addBuddy
protected BuddyPluginBuddy addBuddy(String key, int subsystem, boolean authorised, boolean for_peek) -
peekBuddy
-
removeBuddy
-
readConfig
-
writeConfig
-
deleteConfig
protected void deleteConfig() -
readConfigFile
-
writeConfigFile
-
getBuddyConfigDir
-
getAZ2Handler
-
getPublicKey
-
verifyPublicKey
-
checkBuddiesAndRepublish
protected void checkBuddiesAndRepublish() -
updateBuddys
protected void updateBuddys() -
updateBuddyStatus
-
verifyAndExtract
- Throws:
BuddyPluginException
-
signAndInsert
- Throws:
BuddyPluginException
-
verify
- Throws:
BuddyPluginException
-
verify
protected boolean verify(BuddyPluginBuddy buddy, byte[] payload, byte[] signature) throws BuddyPluginException - Throws:
BuddyPluginException
-
verify
- Throws:
BuddyPluginException
-
sign
- Throws:
BuddyPluginException
-
encrypt
protected BuddyPlugin.CryptoResult encrypt(BuddyPluginBuddy buddy, byte[] payload) throws BuddyPluginException - Throws:
BuddyPluginException
-
encrypt
public BuddyPlugin.CryptoResult encrypt(String pk, byte[] payload, String forWho) throws BuddyPluginException - Throws:
BuddyPluginException
-
decrypt
protected BuddyPlugin.CryptoResult decrypt(BuddyPluginBuddy buddy, byte[] content, String forName) throws BuddyPluginException - Throws:
BuddyPluginException
-
decrypt
public BuddyPlugin.CryptoResult decrypt(String public_key, byte[] content) throws BuddyPluginException - Throws:
BuddyPluginException
-
setMessagePending
protected void setMessagePending(BuddyPluginBuddy buddy, BuddyPluginNetwork.operationListener _listener) throws BuddyPluginException - Throws:
BuddyPluginException
-
checkMessagePending
public void checkMessagePending(int tick_count) -
getBuddyFromPublicKey
-
getPluginInterface
-
getSecurityManager
-
getMessageRegistration
-
getBuddies
Returns authorised buddies only -
getAllBuddies
-
requestReceived
protected Map requestReceived(BuddyPluginBuddy from_buddy, int subsystem, Map content) throws BuddyPluginException - Throws:
BuddyPluginException
-
fireYGM
-
rethrow
- Throws:
BuddyPluginException
-
handleUPRSS
protected InputStream handleUPRSS(AZPluginConnection connection, BuddyPluginBuddy buddy, String tag_or_category) throws IPCException - Throws:
IPCException
-
handleUPTorrent
protected InputStream handleUPTorrent(AZPluginConnection connection, BuddyPluginBuddy buddy, String tag_or_category, byte[] hash) throws IPCException - Throws:
IPCException
-
getMagnetPlugin
-
addRequestListener
-
removeRequestListener
-
logMessage
-
logMessage
-
log
-
log
-