abstract class ExtensionHandler extends Object
Modifier and Type | Field | Description |
---|---|---|
static int |
ID_COMMENT |
|
static int |
ID_DHT |
|
static int |
ID_HANDSHAKE |
|
static int |
ID_METADATA |
|
static int |
ID_PEX |
|
static String |
TYPE_COMMENT |
|
static String |
TYPE_DHT |
not using the option bit since the compact format is different
|
static String |
TYPE_METADATA |
|
static String |
TYPE_PEX |
not ut_pex since the compact format is different
|
Constructor | Description |
---|---|
ExtensionHandler() |
Modifier and Type | Method | Description |
---|---|---|
static byte[] |
getHandshake(int metasize,
boolean pexAndMetadata,
boolean dht,
boolean uploadOnly,
boolean comment) |
|
static void |
handleMessage(Peer peer,
PeerListener listener,
int id,
byte[] bs) |
|
static void |
locked_sendComments(Peer peer,
int num,
CommentSet comments) |
Send comments
Caller must sync on comments
|
static void |
sendCommentReq(Peer peer,
int num) |
Send comment request
|
static void |
sendDHT(Peer peer,
int qport,
int rport) |
Send the DHT port numbers
|
static void |
sendPEX(Peer peer,
List<Peer> pList) |
added.f and dropped unsupported
|
public static final int ID_HANDSHAKE
public static final int ID_METADATA
public static final String TYPE_METADATA
public static final int ID_PEX
public static final String TYPE_PEX
public static final int ID_DHT
public static final String TYPE_DHT
public static final int ID_COMMENT
public static final String TYPE_COMMENT
public static byte[] getHandshake(int metasize, boolean pexAndMetadata, boolean dht, boolean uploadOnly, boolean comment)
metasize
- -1 if unknownpexAndMetadata
- advertise these capabilitiesdht
- advertise DHT capabilitycomment
- advertise ut_comment capabilitypublic static void handleMessage(Peer peer, PeerListener listener, int id, byte[] bs)
public static void sendPEX(Peer peer, List<Peer> pList)
pList
- non-nullpublic static void sendDHT(Peer peer, int qport, int rport)
public static void sendCommentReq(Peer peer, int num)
public static void locked_sendComments(Peer peer, int num, CommentSet comments)
num
- max to sendcomments
- non-null