net-spider-rpl-0.4.1.5: NetSpider data model and utility for RPL networks
MaintainerToshio Ito <debug.ito@gmail.com>
Safe HaskellNone
LanguageHaskell2010

NetSpider.RPL.ContikiNG

Description

This module exports utility functions to read and parse log files from Contiki-NG applications.

Contiki-NG is a tiny operation system for wireless network devices. It supports RPL.

Synopsis

Parser functions

parseFile Source #

Arguments

:: Parser Timestamp

Parser for log prefix

-> FilePath

File to read

-> IO ([FoundNodeDIO], [FoundNodeDAO]) 

Read and parse a log file from a Contiki-NG application to make FoundNodeDIO and FoundNodeDAO. This function may output warning and error messages to STDERR.

Currently this parser function supports logs from "rpl-lite" module only.

It assumes that each line of log file has prefix, and that the prefix contains timestamp information. You have to pass the parser for the prefix to this function. For example, if you read a log file generated by Cooja simulator, use pCoojaLogHead' parser.

One FoundNodeDIO object is parsed from one block of log lines from the rpl module. On the other hand, one or more FoundNodeDAO objects are parsed from one block of log lines from the rpl module. The FoundNodeDAO objects generated from the same log block share the same timestamp.

parseFileHandle Source #

Arguments

:: Parser Timestamp

Parser for log prefix

-> Handle

File handle to read

-> IO ([FoundNodeDIO], [FoundNodeDAO]) 

Same as parseFile but for a Handle.

Since: 0.2.2.0

parseFileHandleM Source #

Arguments

:: (MonadIO m, MonadThrow m, MonadLogger m) 
=> Parser Timestamp

Parser for log prefix

-> Handle

File handle to read

-> m ([FoundNodeDIO], [FoundNodeDAO]) 

Same as parseFileHandle, but in a generic monad.

Since: 0.3.0.0

parseStream Source #

Arguments

:: (MonadThrow m, MonadLogger m) 
=> Parser Timestamp

Parser for log prefix

-> ConduitT Line (Either FoundNodeDIO FoundNodeDAO) m () 

Same as parseFile but as an conduit.

Since: 0.3.0.0

Parser components

Parsers for line stream

parserFoundNodeDIO Source #

Arguments

:: MonadLogger m 
=> Parser Timestamp

Text parser for log head.

-> ConduitParser Line m FoundNodeDIO 

Parse stream of log lines for a FoundNodeDIO.

Since: 0.3.0.0

parserFoundNodeDAO Source #

Arguments

:: MonadLogger m 
=> Parser Timestamp

Text parser for log head.

-> ConduitParser Line m [FoundNodeDAO] 

Parse stream of log lines for a FoundNodeDAO.

Since: 0.3.0.0

type Line = Text Source #

One line text.

Since: 0.2.3.0

Parser for text

pCoojaLogHead :: Parser (Timestamp, Int) Source #

Parse the head of Cooja log line, and return the timestamp and node ID.

pCoojaLogHead' :: Parser Timestamp Source #

Same as pCoojaLogHead, but it returns the timestamp only.

pSyslogHead Source #

Arguments

:: Integer

year

-> Maybe TimeZone

optional time zone.

-> Parser Timestamp 

Parser for head of syslog line with its default format. "Mmm dd hh:mm:ss HOSTNAME TAG: ".

Because the format does not contain year, you have to pass it to this function.