java.lang.Object
net.i2p.data.i2cp.I2CPMessageImpl
net.i2p.data.i2cp.CreateLeaseSetMessage
net.i2p.data.i2cp.CreateLeaseSet2Message
- All Implemented Interfaces:
I2CPMessage
Like CreateLeaseSetMessage, but supports both old and new LeaseSet types, including LS2, Meta, and Encrypted. Revocation keys are not present. Multiple public/private encryption keys are possible.
For LS2: Same as CreateLeaseSetMessage, but has a netdb type before the LeaseSet. PrivateKeys are serialized after the LeaseSet, not before, so we can infer the types from the LeaseSet.
For Meta LS: PrivateKeys are not present.
Field Summary
Modifier and TypeFieldDescriptionprivate List<PrivateKey> The private keys, when the lease set is built from more than one.static final intNOTE: Preliminary format was type 40 in 0.9.38.Fields inherited from class CreateLeaseSetMessage
_leaseSet, _privateKey, _sessionIdModifier and TypeFieldDescriptionprotected LeaseSetThe lease set.protected PrivateKeyThe private key.protected SessionIdThe session ID.Constructor Summary
ConstructorsMethod Summary
Public MethodsModifier and TypeMethodDescriptionvoidaddPrivateKey(PrivateKey key) Add a private key.protected voiddoReadMessage(InputStream in, int size) Read the message body from the input stream.protected byte[]Write the message body to the output stream.This returns all the keys.intgetType()Returns this message's I2CP type number.toString()Returns a string representation of this message.Methods inherited from class CreateLeaseSetMessage
getLeaseSet, getPrivateKey, getSessionId, getSigningPrivateKey, sessionId, setLeaseSet, setPrivateKey, setSessionId, setSigningPrivateKeyModifier and TypeMethodDescriptionLease set being created.ElGamal encryption key.Session identifier for this message.Signing private key for the lease set.Return the SessionId for this message.voidsetLeaseSet(LeaseSet leaseSet) Lease set being created.voidsetPrivateKey(PrivateKey privateKey) ElGamal encryption key.voidSession identifier for this message.voidSigning private key for the lease set.Methods inherited from class I2CPMessageImpl
readBytes, readMessage, readMessage, writeBytes, writeMessageModifier and TypeMethodDescriptionvoidreadBytes(InputStream in) Read the message from the stream, wrapping I2CPMessageException inDataFormatException.voidValidate the type and size of the message, and then read the message into the data structures.voidreadMessage(InputStream in, int length, int type) Read the body into the data structures.voidwriteBytes(OutputStream out) Write the message to the stream, wrapping I2CPMessageException in DataFormatException.voidwriteMessage(OutputStream out) Write out the full message to the stream, including the 4 byte size and 1 byte type header.
Field Details
MESSAGE_TYPE
public static final int MESSAGE_TYPENOTE: Preliminary format was type 40 in 0.9.38. Format changed as of 0.9.39, changed type to 41.- See Also:
_privateKeys
The private keys, when the lease set is built from more than one.
Constructor Details
CreateLeaseSet2Message
public CreateLeaseSet2Message()CreateLeaseSet2Message.
Method Details
getPrivateKeys
This returns all the keys. getPrivateKey() returns the first one.- Returns:
- not a copy, do not modify, null if none
addPrivateKey
Add a private key.- Parameters:
key- the key to add; the first becomes the primary key and later ones accumulate into the list
doReadMessage
Read the message body from the input stream.- Overrides:
doReadMessagein classCreateLeaseSetMessage- Parameters:
in- positioned just past the 4 byte size and 1 byte type headersize- how many payload bytes remain to be read- Throws:
I2CPMessageException- if the message format is invalidIOException- if there's an error reading from the stream
doWriteMessage
Write the message body to the output stream.- Overrides:
doWriteMessagein classCreateLeaseSetMessage- Returns:
- byte array
- Throws:
I2CPMessageException- if the message cannot be writtenIOException- if there's an error writing to the stream
getType
public int getType()Returns this message's I2CP type number.- Specified by:
getTypein interfaceI2CPMessage- Overrides:
getTypein classCreateLeaseSetMessage- Returns:
- the I2CP message type ID,
MESSAGE_TYPE
toString
Returns a string representation of this message.- Overrides:
toStringin classCreateLeaseSetMessage