Annotation Interface FieldOutput


@Retention(RUNTIME) @Target(FIELD) public @interface FieldOutput
Indicates that the tagged java field is to be included when constructing a variable length Ghidra structure data type.

Using this annotation on a field indicates that the containing Ghidra structure has variable length fields, and the containing class must implement the StructureReader interface to allow deserialization of instances of the containing class.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Specifies the name of a Ghidra DataType that will be used for this field when creating a Ghidra structure.
    Overrides the default logic used to add the marked field to the structure.
    Specifies a method that will return a Ghidra DataType that should be used for this field when creating a Ghidra structure.
    boolean
    Marks this field as variable length, which will cause the Ghidra structure containing this field to have a "_NN" name suffix that specifies the length of this instance.
    int
    Optional offset for the marked field to be added at.
    int
    Optional ordinal of the marked field in the structure that will be created.
  • Element Details

    • fieldOutputFunc

      Class<? extends FieldOutputFunction> fieldOutputFunc
      Overrides the default logic used to add the marked field to the structure.
      Returns:
      FieldOutputFunction class that implements custom logic
      Default:
      ghidra.app.util.bin.format.golang.structmapping.FieldOutputFunction.class
    • ordinal

      int ordinal
      Optional ordinal of the marked field in the structure that will be created.

      If unset, the order of the marked fields in the java class would be preserved.

      Returns:
      integer field ordinal, or if unset, the native java field order
      Default:
      -1
    • offset

      int offset
      Optional offset for the marked field to be added at.

      If the structure under construction is smaller than the specified offset, padding will be added to the structure. If the structure is already larger than the specified offset, an error will occur.

      Returns:
      integer offset for the marked field, or if unset, the next location in the structure will be used
      Default:
      -1
    • dataTypeName

      String dataTypeName
      Specifies the name of a Ghidra DataType that will be used for this field when creating a Ghidra structure.

      If unset, the type of the java field will be consulted to pick a Ghidra DataType for the structure field.

      Returns:
      name of the data type to use for this field, or if unset, the java field's type will be used to pick the data type
      Default:
      ""
    • isVariableLength

      boolean isVariableLength
      Marks this field as variable length, which will cause the Ghidra structure containing this field to have a "_NN" name suffix that specifies the length of this instance.
      Returns:
      boolean true if the marked field's length varies between instances of the same structure, false if it is a fixed length field
      Default:
      false
    • getter

      String getter
      Specifies a method that will return a Ghidra DataType that should be used for this field when creating a Ghidra structure.
      Returns:
      optional name of getter method that will return a Ghidra DataType
      Default:
      ""