sealed class Session extends StrictLogging
A session contains information about a single IPFIX session, from a single observation Domain. Specifically, a session takes care of handling the template library that maps template IDs to templates, and it keeps track of message sequence numbers.
The Session class's contructor is not accessible. Instead these classes must be used: The StreamSession is used when reading data from a file or from a TCP stream. The DatagramSession is used when reading data over UDP.
- See also
The companion object for additional details.
- Alphabetic
- By Inheritance
- Session
- StrictLogging
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Session(group: SessionGroup, id: Int)
Auxiliary constructor
Auxiliary constructor
Creates a new session from the given session group and observation domain ID. The new session creates a new information model that inherits from the SessionGroup's information model.
- group
the session group that owns the session
- id
the observation domain ID
- Attributes
- 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 add(template: Template, tid: Int): Option[Template]
Adds a Template to this Session using
tid
as the templateId and replacing the Template that previously used that ID, if any.Adds a Template to this Session using
tid
as the templateId and replacing the Template that previously used that ID, if any. If a Template is replaced, it is returned.To add
template
only if it is not already present, usegetOrAdd
.If
template.size
is 0, withdraws and returns the Template whose ID istid
. The Template if not withdrawn if this is a DatagramSession.- Exceptions thrown
Session.TemplateInterferenceException
when a template is replaced that may not be replaced, by policy.java.lang.RuntimeException
when the Template's session is not this session.
- def addTemplateMetadata(metadata: TemplateMetadata): Unit
Updates the metadata for a particular template in this Session.
Updates the metadata for a particular template in this Session. Ignores
metadata
if its template ID is invalid. - final def apply(template: Template): Int
The ID used by
template
within this Session.The ID used by
template
within this Session.- Since
1.3.1
- Exceptions thrown
NoTemplateException
if the Session does not know about that Template.- See also
- final def apply(tid: Int): Template
The Template from the template library with this template ID.
The Template from the template library with this template ID.
- Since
1.3.1
- Exceptions thrown
NoTemplateException
if the Session does not have a Template with that ID.- See also
- 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
- var expectedSequence: Long
The sequence number that is expected for the next message in this session.
The sequence number that is expected for the next message in this session.
It is value a value between 0 and 2^32-1, or -1 if no message has yet been observed in this session.
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def findUnusedId(): Option[Int]
Find a template ID not currently being used by this session.
Find a template ID not currently being used by this session. Returns None when the Session has no available IDs. (Not necessarily deterministic.)
- returns
a currently unused template ID
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def getId(template: Template): Option[Int]
Gets the ID for the Template within this session as an Option.
- def getOrAdd(template: Template, tid: Option[Int] = None): Int
Returns the ID for
template
in this Session, addingtemplate
to this Session if it does not exist.Returns the ID for
template
in this Session, addingtemplate
to this Session if it does not exist.If
template
must be added to the Session, an arbitrary ID is used whentid
isNone
. Iftid
is notNone
, that ID is used if possible; otherwise an arbitrary ID is used. Use theadd
method iftemplate
must use a particular ID.Takes no action and returns 0 if
template.size
is 0.- template
The Template to get or add
- tid
An optional ID for
template
if it does not exist in the Session- returns
The ID of
template
in this Session
- def getPersistentSession(): Session
Returns a read-only copy of this session that will not change.
Returns a read-only copy of this session that will not change.
- returns
the persistent session
- final def getTemplate(tid: Int): Option[Template]
Gets a Template from the template library based on the template ID as an Option.
Gets a Template from the template library based on the template ID as an Option.
- tid
the template ID
- returns
The template associated with the template ID, or
None
- def getTemplateMetadata(tid: Int): Option[TemplateMetadata]
Gets the metadata for the Template whose ID is
tid
as an Option. - def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final var idGetTmpl: TrieMap[Int, Template]
Maps a templateId to a Template.
Maps a templateId to a Template. "protected" since ReadOnlySession needs access
- Attributes
- protected
- final val infoModel: InfoModel
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def iterator: Iterator[Template]
Returns an Iterator over the Templates in the Session.
- val logger: Logger
- Attributes
- protected
- Definition Classes
- StrictLogging
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def noteMessage(m: Message): Unit
Check for missing or out of sequence records.
Check for missing or out of sequence records. If found, invoke any SequenceCallback objects that have been registered and log a message. A log message is not written if no SequenceCallback objects have been registered.
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final val observationDomain: Int
- def register(callback: SequenceCallback): Unit
Registers a new sequence callback with this session.
Registers a new sequence callback with this session. A session can have any number of callbacks registered to it. Each registered callback will be called whenever a message arrives with an unexpected sequence number.
- callback
the sequence number callback
- def register(callback: Iterable[TemplateCallback]): Unit
Registers multiple templates callbacks with this session.
- def register(callback: TemplateCallback): Unit
Registers a new template callback with this session.
Registers a new template callback with this session. A session can have any number of callbacks registered to it. Each registered callback will be called whenever a template is added or removed from the session template library.
- callback
the template callback
- def remove(template: Template): Option[Template]
Removes a template from this session.
Removes a template from this session.
- template
The template to remove
- returns
the template that was removed, or
None
if none
- def remove(tid: Int): Option[Template]
Removes a template from this session.
Removes a template from this session.
- tid
the template ID of the template to remove
- returns
the template that was removed, or
None
if none
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final var templateMetadata: TrieMap[Int, TemplateMetadata]
Maps a templateId to its metadata
Maps a templateId to its metadata
- Attributes
- protected
- final var tmplGetId: TrieMap[Template, Int]
Maps a Template to its templateId in this Session.
Maps a Template to its templateId in this Session.
- Attributes
- protected
- def toString(): String
- Definition Classes
- AnyRef → Any
- final val transport: AnyRef
- 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()
- def withdraw(t: Template, tid: Int): Option[Template]
Internal function that removes a template when a withdrawal template is received on the input stream.
Internal function that removes a template when a withdrawal template is received on the input stream. That is, when add() is called with a withdrawal template.
- Attributes
- protected
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.