forked from I2P_Developers/i2p.i2p
SSU2: Stub out path challenge/response
This commit is contained in:
@ -2825,6 +2825,14 @@ class EstablishmentManager {
|
||||
public void gotTermination(int reason, long count) {
|
||||
throw new IllegalStateException("Bad block in HP");
|
||||
}
|
||||
|
||||
public void gotPathChallenge(byte[] data) {
|
||||
throw new IllegalStateException("Bad block in HP");
|
||||
}
|
||||
|
||||
public void gotPathResponse(byte[] data) {
|
||||
throw new IllegalStateException("Bad block in HP");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -420,6 +420,14 @@ class InboundEstablishState2 extends InboundEstablishState implements SSU2Payloa
|
||||
_transport.getEstablisher().receiveSessionDestroy(_remoteHostId);
|
||||
}
|
||||
|
||||
public void gotPathChallenge(byte[] data) {
|
||||
throw new IllegalStateException("Bad block in handshake");
|
||||
}
|
||||
|
||||
public void gotPathResponse(byte[] data) {
|
||||
throw new IllegalStateException("Bad block in handshake");
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// end payload callbacks
|
||||
/////////////////////////////////////////////////////////
|
||||
|
@ -348,6 +348,14 @@ class OutboundEstablishState2 extends OutboundEstablishState implements SSU2Payl
|
||||
_transport.getEstablisher().receiveSessionDestroy(_remoteHostId, this);
|
||||
}
|
||||
|
||||
public void gotPathChallenge(byte[] data) {
|
||||
// won't be called, SSU2Payload will throw
|
||||
}
|
||||
|
||||
public void gotPathResponse(byte[] data) {
|
||||
// won't be called, SSU2Payload will throw
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// end payload callbacks
|
||||
/////////////////////////////////////////////////////////
|
||||
|
@ -637,6 +637,14 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback
|
||||
_transport.getEstablisher().receiveSessionDestroy(_remoteHostId, this);
|
||||
}
|
||||
|
||||
public void gotPathChallenge(byte[] data) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void gotPathResponse(byte[] data) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// end payload callbacks
|
||||
/////////////////////////////////////////////////////////
|
||||
|
@ -1837,6 +1837,9 @@ class PeerTestManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is only for out-of-session messages 5-7,
|
||||
* where most blocks are not allowed.
|
||||
*
|
||||
* @since 0.9.54
|
||||
*/
|
||||
private class PTCallback implements SSU2Payload.PayloadCallback {
|
||||
@ -1920,5 +1923,13 @@ class PeerTestManager {
|
||||
public void gotTermination(int reason, long count) {
|
||||
throw new IllegalStateException("Bad block in PT");
|
||||
}
|
||||
|
||||
public void gotPathChallenge(byte[] data) {
|
||||
throw new IllegalStateException("Bad block in PT");
|
||||
}
|
||||
|
||||
public void gotPathResponse(byte[] data) {
|
||||
throw new IllegalStateException("Bad block in PT");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,6 +124,16 @@ class SSU2Payload {
|
||||
* @param lastReceived in theory could wrap around to negative, but very unlikely
|
||||
*/
|
||||
public void gotTermination(int reason, long lastReceived);
|
||||
|
||||
/**
|
||||
* @since 0.9.55
|
||||
*/
|
||||
public void gotPathChallenge(byte[] data);
|
||||
|
||||
/**
|
||||
* @since 0.9.55
|
||||
*/
|
||||
public void gotPathResponse(byte[] data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -352,6 +362,22 @@ class SSU2Payload {
|
||||
gotTermination = true;
|
||||
break;
|
||||
|
||||
case BLOCK_PATHCHALLENGE:
|
||||
if (isHandshake)
|
||||
throw new IOException("Illegal block in handshake: " + type);
|
||||
byte[] cdata = new byte[len];
|
||||
System.arraycopy(payload, i, cdata, 0, len);
|
||||
cb.gotPathChallenge(cdata);
|
||||
break;
|
||||
|
||||
case BLOCK_PATHRESP:
|
||||
if (isHandshake)
|
||||
throw new IOException("Illegal block in handshake: " + type);
|
||||
byte[] rdata = new byte[len];
|
||||
System.arraycopy(payload, i, rdata, 0, len);
|
||||
cb.gotPathResponse(rdata);
|
||||
break;
|
||||
|
||||
case BLOCK_PADDING:
|
||||
gotPadding = true;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user