public I2NPHeader16(I2NPMessage msg) : this(msg, GenerateMessageId()) { #if DEBUG DebugCheckMessageCreation(MessageRef); #endif }
public I2NPHeader5(I2NPMessage msg) : base(msg.Header5Buf) { MessageRef = msg; MessageType = msg.MessageType; Expiration = I2PDate.DefaultI2NPExpiration(); #if DEBUG DebugCheckMessageCreation(MessageRef); #endif }
protected static void DebugCheckMessageCreation( I2NPMessage msg ) { if ( msg.Header16AndPayloadBuf == null ) { throw new NotImplementedException( "I2NPHeader16: '" + msg.GetType().Name + "' failed to set up a memory buffer for Header16!" ); } if ( !object.ReferenceEquals( msg.Payload.BaseArray, msg.Header16AndPayloadBuf.BaseArray ) || msg.Payload.BaseArrayOffset != 16 + msg.Header16AndPayloadBuf.BaseArrayOffset ) { throw new NotImplementedException( "I2NPHeader16: '" + msg.GetType().Name + "' created wrong size of buffer for Header16!" ); } }
public I2NPHeader16(I2NPMessage msg, uint messageid) : base(msg.Header16Buf) { MessageRef = msg; MessageType = msg.MessageType; Expiration = I2PDate.DefaultI2NPExpiration(); MessageId = messageid; PayloadLength = (ushort)msg.Payload.Length; var s = I2PHashSHA256.GetHash(msg.Payload); PayloadChecksum = s[0]; #if DEBUG DebugCheckMessageCreation(MessageRef); #endif }
public static BufLen ToBufLen(I2NPMessage msg) { var hdr = new I2NPHeader5(msg); return(new BufLen(hdr.ToByteArray())); }
public static void Write(BufRefStream dest, I2NPMessage msg) { var inst = new I2NPHeader16(msg); inst.Write(dest); }
public static void Write(List <byte> dest, I2NPMessage msg) { var inst = new I2NPHeader16(msg); inst.Write(dest); }