Allow the transport to specify the maximum segment length.

This commit is contained in:
akwizgran
2012-01-20 23:06:51 +00:00
parent 13eff752da
commit 3a77ba9aaf
34 changed files with 195 additions and 39 deletions

View File

@@ -14,12 +14,12 @@ class OutgoingAuthenticationLayerImpl implements OutgoingAuthenticationLayer {
private final OutgoingErrorCorrectionLayer out;
private final Mac mac;
private final int maxFrameLength;
OutgoingAuthenticationLayerImpl(OutgoingErrorCorrectionLayer out, Mac mac,
ErasableKey macKey) {
this.out = out;
this.mac = mac;
// Initialise the MAC
try {
mac.init(macKey);
} catch(InvalidKeyException badKey) {
@@ -28,6 +28,7 @@ class OutgoingAuthenticationLayerImpl implements OutgoingAuthenticationLayer {
macKey.erase();
if(mac.getMacLength() != MAC_LENGTH)
throw new IllegalArgumentException();
maxFrameLength = out.getMaxFrameLength();
}
public void writeFrame(Frame f) throws IOException {
@@ -49,4 +50,8 @@ class OutgoingAuthenticationLayerImpl implements OutgoingAuthenticationLayer {
public long getRemainingCapacity() {
return out.getRemainingCapacity();
}
public int getMaxFrameLength() {
return maxFrameLength;
}
}