Package org.klomp.snark
Class ExtensionHandler
java.lang.Object
org.klomp.snark.ExtensionHandler
abstract class ExtensionHandler extends Object
REF: BEP 10 Extension Protocol
- Since:
- 0.8.2
- Author:
- zzz
-
Field Summary
Fields Modifier and Type Field Description static intID_COMMENTstatic intID_DHTstatic intID_HANDSHAKEstatic intID_METADATAstatic intID_PEXstatic StringTYPE_COMMENTstatic StringTYPE_DHTnot using the option bit since the compact format is differentstatic StringTYPE_METADATAstatic StringTYPE_PEXnot ut_pex since the compact format is different -
Constructor Summary
Constructors Constructor Description ExtensionHandler() -
Method Summary
Modifier and Type Method Description static byte[]getHandshake(int metasize, boolean pexAndMetadata, boolean dht, boolean uploadOnly, boolean comment)static voidhandleMessage(Peer peer, PeerListener listener, int id, byte[] bs)static voidlocked_sendComments(Peer peer, int num, CommentSet comments)Send comments Caller must sync on commentsstatic voidsendCommentReq(Peer peer, int num)Send comment requeststatic voidsendDHT(Peer peer, int qport, int rport)Send the DHT port numbersstatic voidsendPEX(Peer peer, List<Peer> pList)added.f and dropped unsupported
-
Field Details
-
ID_HANDSHAKE
public static final int ID_HANDSHAKE- See Also:
- Constant Field Values
-
ID_METADATA
public static final int ID_METADATA- See Also:
- Constant Field Values
-
TYPE_METADATA
- See Also:
- Constant Field Values
-
ID_PEX
public static final int ID_PEX- See Also:
- Constant Field Values
-
TYPE_PEX
not ut_pex since the compact format is different- See Also:
- Constant Field Values
-
ID_DHT
public static final int ID_DHT- See Also:
- Constant Field Values
-
TYPE_DHT
not using the option bit since the compact format is different- See Also:
- Constant Field Values
-
ID_COMMENT
public static final int ID_COMMENT- Since:
- 0.9.31
- See Also:
- Constant Field Values
-
TYPE_COMMENT
- Since:
- 0.9.31
- See Also:
- Constant Field Values
-
-
Constructor Details
-
ExtensionHandler
ExtensionHandler()
-
-
Method Details
-
getHandshake
public static byte[] getHandshake(int metasize, boolean pexAndMetadata, boolean dht, boolean uploadOnly, boolean comment)- Parameters:
metasize- -1 if unknownpexAndMetadata- advertise these capabilitiesdht- advertise DHT capabilitycomment- advertise ut_comment capability- Returns:
- bencoded outgoing handshake message
-
handleMessage
-
sendPEX
added.f and dropped unsupported- Parameters:
pList- non-null- Since:
- 0.8.4
-
sendDHT
Send the DHT port numbers- Since:
- DHT
-
sendCommentReq
Send comment request- Since:
- 0.9.31
-
locked_sendComments
Send comments Caller must sync on comments- Parameters:
num- max to sendcomments- non-null- Since:
- 0.9.31
-