summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-05-27 10:06:26 +0200
committerLars-Dominik Braun <lars@6xq.net>2015-05-27 10:06:26 +0200
commitfb41d17b4dcc55c13106de015fcc1ee03ed49688 (patch)
treecc1c8e6f512410c9978e76945dc1e5cb18ee939d
parentc77a8040f8c0e2cf796c7dc2dbc1433f91538899 (diff)
downloadcomatose-fb41d17b4dcc55c13106de015fcc1ee03ed49688.tar.gz
comatose-fb41d17b4dcc55c13106de015fcc1ee03ed49688.tar.bz2
comatose-fb41d17b4dcc55c13106de015fcc1ee03ed49688.zip
Add list of features to output
-rw-r--r--Main.hs27
-rw-r--r--data/db.yaml45
2 files changed, 63 insertions, 9 deletions
diff --git a/Main.hs b/Main.hs
index 4ee68ac..010dba7 100644
--- a/Main.hs
+++ b/Main.hs
@@ -4,7 +4,7 @@ import Control.Applicative
import Control.Monad
import Data.Monoid
import Data.Yaml
-import Data.List (nub, sort, sortBy)
+import Data.List (nub, sort, sortBy, isPrefixOf)
import Data.Function (on)
import Data.Maybe (catMaybes)
import qualified Data.Text as T
@@ -98,6 +98,16 @@ protoPublications db p = map (findPublication db) (pref p)
-- |Find all referenced features’ names
referencedFeatures db = nub $ sort $ concat $ map (M.keys . pfeatures) $ M.elems $ dalgos db
+filterMap filterF mapF xs = map mapF $ filter filterF xs
+
+-- |Get all features at `level`, starting with 0
+getFeaturesByLevel db level = M.filterWithKey (\k v -> countDots k == level) $ dfeatures db
+ where
+ countDots = length . filter ((==) '.')
+
+-- |Get features by `base` feature
+getFeaturesByBase db base = M.filterWithKey (\k v -> (base ++ ".") `isPrefixOf` k) $ dfeatures db
+
-- |Read protocol and bib database from file
readDb :: String -> IO Database
readDb f = do
@@ -246,6 +256,20 @@ introduction db =
toHtml lastyear
"."
+-- |List of protocol features
+features :: Database -> Html ()
+features db =
+ section_ [id_ "features"] $ do
+ h2_ "Features"
+ p_ "This section presents so-called “features” that are assigned to each protocol."
+ forM_ (M.toList $ getFeaturesByLevel db 0) $ \(baseident, basefeature) -> do
+ let featureanchor = "feature-" ++ baseident in do
+ h3_ [id_ $ T.pack featureanchor] $ a_ [href_ $ T.pack $ '#':featureanchor] $ toHtml $ fname basefeature
+ maybe mempty (p_ . toHtml) $ fdescription basefeature
+ dl_ $ forM_ (M.toList $ getFeaturesByBase db baseident) $ \(ident, feature) -> do
+ dt_ $ toHtml $ fname feature
+ maybe mempty (dd_ . toHtml) $ fdescription feature
+
-- | The list of protocols
protocols :: Database -> Html ()
protocols db = section_ [id_ "protocols"] $ do
@@ -278,6 +302,7 @@ page db attrib = doctypehtml_ $ do
div_ [class_ "page-header"] $ do
h1_ "comatose"
introduction db
+ features db
protocols db
references (sortBy (compare `on` lookup "year" . E.fields) attrib)
extjs "script.js"
diff --git a/data/db.yaml b/data/db.yaml
index 3f0a1c2..02ca1c9 100644
--- a/data/db.yaml
+++ b/data/db.yaml
@@ -7,25 +7,41 @@
features:
access:
name: Channel access
+ description: Basic method for channel access
access.random:
name: Random
+ description: >
+ Stations access the medium in a random, uncoordinated fashion.
access.token-passing:
name: Token-passing
access.polling:
name: Polling
+ description: >
+ Base or master station polls slaves, granting them acces to the
+ medium.
access.reservation:
name: Dynamic reservation
+ description: >
+ Stations request transmission resources
access.schedule:
name: Static schedule
+ description: >
+ Scheduled access to the medium.
+ radio:
+ name: Radio
+ description: Features of the radio hardware.
radio.carriersense:
name: Carrier sense
topology:
name: Topology
+ description: The network’s topology.
topology.singlehop:
name: Single-Hop
- description: MAC relies on upper layers to transmit packet to out-of-range stations
+ description: >
+ MAC relies on upper layers to transmit packet to out-of-range
+ stations
topology.multihop:
name: Multi-Hop
description: MAC transports data through multiple hops
@@ -38,7 +54,9 @@ features:
description: Star
application:
- name: Intended applications
+ name: Applications
+ description: >
+ Target applications the protocol was designed for or explored with.
application.wsn:
name: Wireless Sensor Network
application.vanet:
@@ -51,7 +69,8 @@ features:
time:
name: Time model
time.discrete:
- name: Discrete, synchronized
+ name: Discrete
+ description: Discrete and synchronized
time.continuous:
name: Continuous
@@ -63,7 +82,7 @@ features:
name: Low-power listening/preamble sampling
reliability:
- name: Reliability machanisms
+ name: Reliability
# unreliable is default
reliability.retransmission:
name: Retransmission
@@ -75,11 +94,15 @@ features:
name: Error correcting codes
realtime:
- name: Real-time features
+ name: Real-time
realtime.guaranteed:
name: Guaranteed
+ description: Latency is guaranteed or bounded.
realtime.probabilistic:
name: Probabilistic
+ description: >
+ Protocol was designed with latency in mind and tries to reduce it,
+ but an upper bound cannot be guaranteed.
channels:
name: Channel usage
@@ -106,18 +129,24 @@ features:
deployment:
name: Deployment
+ description: >
+ How and when stations or the whole network is deployed.
deployment.static:
name: Static
- description: Nodes at fixed/planned positions
+ description: >
+ The network is mostly static. Stations are deployed at
+ fixed posititons.
deployment.adhoc:
name: Ad-hoc
- description:
+ description: >
+ Supports joining and leaving of stations in an ad-hoc fashion.
+ Stations move around.
# XXX figure out where to put these
other:
name: Other features
other.qos:
- name: QoS
+ name: Quality of Service
# Algorithms/Protocols
# ====================