final class Template extends AnyRef
An IPFIX template that describes the data in a Record.
A template is composed of a sequence of information elements with associated lengths. (The IEFieldSpecifier class bundles the InfoElement and length into a single object.) An element's length in the template may be different than the "natural" length (reduced length encoding), and an element that supports variable-length values may have a fixed size.
If a template has a non-zero scope, the template is an Options Template.
When a Template is added to a Session it is given a unique ID within that Session. A Template may be added to multiple Sessions; there is not necessarily a relationship among the IDs given to a Template in the different Sessions.
- Since
1.3.1 The description is set and fixed at Template creation.
- Alphabetic
- By Inheritance
- Template
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
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
- def apply(idx: Int): InfoElement
Returns the
InfoElement
at positionidx
. - final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def contains(infoElement: InfoElement): Boolean
Returns true if this Template contains the given InfoElement.
Returns true if this Template contains the given InfoElement.
- Since
1.3.1
- def contains(spec: FieldSpec): Boolean
Returns true if this Template contains an element that matches the given field specifier.
Returns true if this Template contains an element that matches the given field specifier.
- Since
1.3.1
- def containsAny(ieIterable: Iterable[InfoElement]): Boolean
Returns true if this Template contains *any* of the InfoElements in
ieIterable
.Returns true if this Template contains *any* of the InfoElements in
ieIterable
.- Since
1.3.1
- lazy val containsList: Boolean
Indicates whether the template contains at least one structured data element (that is, a BasicList, SubTemplateList, or SubTemplateMultiList).
- lazy val containsVarlen: Boolean
Indicates whether the template contains at least one variable-length element.
- val description: Option[String]
- def elementLength(idx: Int): Int
Returns the length of the element at position
idx
as specified by the IEFieldSpecifier. - final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(other: Any): Boolean
Determines whether two templates are equal.
Determines whether two templates are equal. To be equal, two templates must have the same scope, the same set of elements, the same element order, and all elements must have the same length.
- Definition Classes
- Template → AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hasSameElements(that: Template): Boolean
Determines if two templates have the same set of elements in the same order with the same lengths.
Determines if two templates have the same set of elements in the same order with the same lengths. This method is similar to
equals()
but it does not consider the scope. - def hashCode(): Int
- Definition Classes
- Template → AnyRef → Any
- def indexOf(infoElement: InfoElement): Int
Returns the position of the first occurrence of the given information element in this Template or returns -1 if the element is not found.
- def indexOf(infoElement: InfoElement, from: Int): Int
Returns the position of the given information element in this template occurring at or after
from
or returns -1 if the element is not found. - def indexOf(spec: FieldSpec): Int
Returns the position of the InfoElement in this Template that matches the given field specifier or returns -1 if the element is not found.
- lazy val isInfoElementMetadataTemplate: Boolean
Returns true if this Template is an information element meta-data template.
Returns true if this Template is an information element meta-data template.
An information element meta-data template is used to by records to provide the name, ID, data-type, units, semantics, and range of an information element that is not part of the standard information model. Specifically, the method tests whether the elements
informationElementId
andinformationElementName
are present. - final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- lazy val isMetadataTemplate: Boolean
Returns true if this Template is a meta-data template.
Returns true if this Template is a meta-data template.
A meta-data template is used to by records that describe an information element or a template.
- lazy val isOptionsTemplate: Boolean
Returns true if this Template is an options template.
Returns true if this Template is an options template.
An options template is one whose scope is non-zero.
- lazy val isTemplateMetadataTemplate: Boolean
Returns true if this Template is a template meta-data template.
Returns true if this Template is a template meta-data template.
A template meta-data template is used to by records to provide a name and an optional description to a template. Specifically, the method tests whether the elements
templateId
andtemplateName
are present. - lazy val isWithdrawalTemplate: Boolean
Returns true if this Template is a withdrawal template.
Returns true if this Template is a withdrawal template.
A withdrawal template is one that contains no elements.
- def iterator: Iterator[(InfoElement, Int)]
Returns an iterator over the elements in the Template.
Returns an iterator over the elements in the Template. Each iteration returns a Tuple2 containing an InfoElement and its length in this Template.
- val minimumLength: Int
Gives the number of octets required to hold the shortest record described by this Template.
- val name: Option[String]
- 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()
- def octetLength: Int
Returns the number of octets required to write this template definition to an IPFIX stream.
Returns the number of octets required to write this template definition to an IPFIX stream.
- See also
minimumLength
for the mininum length of a record that uses this template.
- val scope: Int
- val size: Int
Returns the number of elements in this Template.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toBuffer(outbuf: ByteBuffer, session: Session): ByteBuffer
Appends the Template to a buffer for writing to an IPFIX stream.
Appends the Template to a buffer for writing to an IPFIX stream. Adds the Template to the Session if necessary.
- Exceptions thrown
java.nio.BufferOverflowException
if there is not enough room in the buffer for the Template. Because the method makes multiple writes to the buffer, the buffer's position is unknown if an error is thrown.
- def toString(expandIEs: Boolean): String
Returns a String describing this Template.
Returns a String describing this Template. If
expandIEs
isfalse
, includes only the name and element length for each IE in the Template (liketoString()
). IfexpandIEs
istrue
, includes a complete description of each IE (including its type, ID, etc). - def toString(): String
- Definition Classes
- Template → 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-data
library, 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-ipfix
library 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-silk
library.org.cert.netsa.util
The "junk drawer" of
netsa-util
so far provides only two features: First, a method for equipping Scala scala.collection.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-datasources
library contains both IPFIX and SiLK functionality, whilemothra-datasources-ipfix
andmothra-datasources-silk
contain 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-functions
library.