Class SMB2CreateContext

java.lang.Object
com.hierynomus.mssmb2.messages.create.SMB2CreateContext

public class SMB2CreateContext extends Object
Generic, lease-agnostic SMB2_CREATE_CONTEXT TLV container ([MS-SMB2] 2.2.13.2).

This is the connective tissue every create context (lease, durable handle, query-on-disk-id, ...) rides on. It treats name and data as opaque byte arrays; higher layers (e.g. the RqLs lease context) encode their typed payload into data.

  • Constructor Details

    • SMB2CreateContext

      public SMB2CreateContext(byte[] name, byte[] data)
  • Method Details

    • getName

      public byte[] getName()
    • getData

      public byte[] getData()
    • writeAll

      public static int writeAll(SMBBuffer buffer, List<SMB2CreateContext> contexts)
      Serializes a chained list of create contexts at the buffer's current write position. Handles the 16-byte header, 8-byte name/data alignment, inter-context 8-byte alignment and Next-offset backfill (Next = 0 on the last context, with no trailing pad).
      Returns:
      the total number of bytes written (0 for a null/empty list).
    • readAll

      public static List<SMB2CreateContext> readAll(SMBBuffer buffer, int offset, int length) throws Buffer.BufferException
      Parses a chained list of create contexts starting at absolute buffer position offset, bounded by length bytes. The Next chain is authoritative (Next == 0 terminates); contexts are returned in encounter order. Seeks by the per-context NameOffset/DataOffset so any server ordering/padding is tolerated.
      Throws:
      Buffer.BufferException