abstract class Record extends AnyRef
A Record instance represents an IPFIX data record. Each record contains a set of values which are described by the record's Template.
Each IPFIX data type can be mapped to its Java data type as in the table below:
- IPFIX data type ⟶ Scala data type
octetArray⟶ Seq[Byte]1unsigned8⟶Intunsigned16⟶Intunsigned32⟶Longunsigned64⟶Long2signed8⟶Intsigned16⟶Intsigned32⟶Intsigned64⟶Longfloat32⟶Floatfloat64⟶Doubleboolean⟶BooleanmacAddress⟶Seq[Byte]1,3string⟶StringdateTimeSeconds⟶InstantdateTimeMilliseconds⟶InstantdateTimeMicroseconds⟶InstantdateTimeNanoseconds⟶Instantipv4Address⟶IPv4Addressipv6Address⟶IPv6AddressbasicList⟶BasicListsubTemplateList⟶SubTemplateListsubTemplateMultiList⟶SubTemplateMultiList
1 The Seq[Byte] returned for octetArray or macAddress is a read-only view on
the underlying record data. If you want to save the data without keeping the full record data
from being garbage collected, you should copy the Seq.
2 Long is signed, so an unsigned64 with its high bit set will appear as negative.
3 The Seq[Byte] returned for a macAddress will always be of length 6.
A record's fields are described by a Template, which may be retrieved from the record using the #template value. Using the data from the template, the user can cast the record's objects to the appropriate Java type.
Alternatively, a record's values can be retrieved in a typed manner using either a FieldExtractor, or a Fillable object. A FieldExtractor acts as a reference to a particular field in a record regardless of the current template of the record. A Fillable object is an object which contains fields that have been marked with the IPFIXExtract annotation. A record's fill() method can be used to "fill in" the object's fields from the record.
- See also
- Alphabetic
- By Inheritance
- Record
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
Abstract Value Members
- abstract def apply(idx: Int): Any
The value of the field in this record at the given field position within the Template.
The value of the field in this record at the given field position within the Template.
- Exceptions thrown
java.lang.IndexOutOfBoundsExceptionif the index is out of range.
- abstract def detach(): Record
Modifies the current record so that it carries as little data as necessary to exist by itself.
Modifies the current record so that it carries as little data as necessary to exist by itself. More specifically, it detaches itself from as much of its parent Message's data as possible. If non-complete subsets of
Records are going to be kept in memory, they should be detached so they don't carry the memory of any discardedRecords by association to their parentMessages.- returns
the record itself (not a new record)
- abstract def exportTime: Option[Instant]
Gets the export time of the Message that generated this record as an Option.
- abstract def message: Option[Message]
Returns the Message object from which the Record was read as an Option or scala.None if the Record was not read from a Message.
- abstract def observationDomain: Option[Int]
Returns the observation domain of the Message that generated this record as an Option or None if the record represents a list element or was not read from a Message.
- abstract def octetLength: Int
Gets the number of octets required to write the record to a stream.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def allBasicListElements(): Set[InfoElement]
Gets a Set containing the
InfoElementused by any basic list on the record and by the record's ListElements. - final def allTemplates(): Set[Template]
Gets a Set containing the
Templateused by the record and theTemplates used by any ListElements in the record. - def apply(ie: InfoElement): Any
The value of the first occurrence of the specified Information Element in this Record.
The value of the first occurrence of the specified Information Element in this Record.
- Since
1.3.1
- Exceptions thrown
java.lang.IndexOutOfBoundsExceptionif this Record's Template does not contain that Information Element.
- def apply(spec: FieldSpec): Any
The value of the field within this record matching the given specification.
The value of the field within this record matching the given specification.
- Since
1.3.1
- Exceptions thrown
java.lang.IndexOutOfBoundsExceptionif the Template does not contain the FieldSpec.
- final def apply[T](extractor: FieldExtractor[T]): Option[T]
Gets the value within the record for the field referenced by the extractor as an Option.
Gets the value within the record for the field referenced by the extractor as an Option.
- T
The result type of the extractor.
- extractor
A field extractor.
- returns
The value for the referenced field, or scala.None if the extractor does not match a field in this record.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def fields: Iterator[Field]
Returns an Iterator where iteration yields a Field.
- final def fill(obj: Fillable): Unit
Fills the fields of
objthat are marked with the IPFIXExtract annotation from this record.Fills the fields of
objthat are marked with the IPFIXExtract annotation from this record.- obj
the object to fill
- See also
IPFIXExtract
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def formatted: String
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final lazy val size: Int
Gets the number of fields in the record.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final val template: Template
- def toBuffer(outbuf: ByteBuffer, session: Session): ByteBuffer
Appends this Record to a buffer for writing to an IPFIX stream.
Appends this Record to a buffer for writing to an IPFIX stream. The function uses the template IDs in
sessionif the Record contains SubTemplateLists or a SubTemplateMultiList. Assumes the Template(s) used by the Record have already been added to the Session and appeneded to the buffer. - def toString(): String
- Definition Classes
- Record → AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
This is documentation for Mothra, a collection of Scala and Spark library functions for working with Internet-related data. Some modules contain APIs of general use to Scala programmers. Some modules make those tools more useful on Spark data-processing systems.
Please see the documentation for the individual packages for more details on their use.
Scala Packages
These packages are useful in Scala code without involving Spark:
org.cert.netsa.data
This package, which is collected as the
netsa-datalibrary, provides types for working with various kinds of information:org.cert.netsa.data.net- types for working with network dataorg.cert.netsa.data.time- types for working with time dataorg.cert.netsa.data.unsigned- types for working with unsigned integral valuesorg.cert.netsa.io.ipfix
The
netsa-io-ipfixlibrary provides tools for reading and writing IETF IPFIX data from various connections and files.org.cert.netsa.io.silk
To read and write CERT NetSA SiLK file formats and configuration files, use the
netsa-io-silklibrary.org.cert.netsa.util
The "junk drawer" of
netsa-utilso far provides only two features: First, a method for equipping Scala Iterators with exception handling. And second, a way to query the versions of NetSA libraries present in a JVM at runtime.Spark Packages
These packages require the use of Apache Spark:
org.cert.netsa.mothra.datasources
Spark datasources for CERT file types. This package contains utility features which add methods to Apache Spark DataFrameReader objects, allowing IPFIX and SiLK flows to be opened using simple
spark.read...calls.The
mothra-datasourceslibrary contains both IPFIX and SiLK functionality, whilemothra-datasources-ipfixandmothra-datasources-silkcontain only what's needed for the named datasource.org.cert.netsa.mothra.analysis
A grab-bag of analysis helper functions and example analyses.
org.cert.netsa.mothra.functions
This single Scala object provides Spark SQL functions for working with network data. It is the entirety of the
mothra-functionslibrary.