-
Notifications
You must be signed in to change notification settings - Fork 2k
Model for the network stack
authmillenon edited this page Nov 2, 2014
·
11 revisions
A preliminary class diagram can be found in at here:
https://drive.google.com/file/d/0Bw4T8Mqih7-oc2FpN01pMmVPQ0E/view
(can be opened at with the web application draw.io
(partly modeled as sequence diagrams at https://drive.google.com/file/d/0Bw4T8Mqih7-oa3VYeFpWMW9zeHM/view?usp=sharing)
- Use case ID: net0001
- Application: RIOT network stack
- Use case descripiton: Initialize a network device
- Primary actor: network device driver
- Precondition: network device and network device driver is known
- Trigger: initialization program of network device driver is started
-
Basic flow:
- network device driver receives network device
- network device driver sets driver of network device to network device driver appropriatly
- network device driver sets initial state
- network device driver sets initial option values
- Alternate flow: —
- Use case ID: net0002
- Application: RIOT network stack
- Use case descripiton: Registers a receive callback to the network device driver to allow for further handling of received data
- Primary actor: network device driver
-
Precondition:
- receive callback is defined
- network device is initialized (net0001)
- Trigger: registration program of network device driver is started
-
Basic flow:
- network device driver receives receive callback
- network device driver checks if space is available to register receive callback
- if so network device driver registers receive callback to itself
-
Alternate flow:
- network device driver receives receive callback
- network device driver checks if space is available to register receive callback
- if not network device driver inform caller about unavailable space
- Use case ID: net0003
- Application: RIOT network stack
- Use case description: Unregister a receive callback to the network device driver to prevent further handling of received data as defined by the callback
- Primary actor: network device driver
-
Precondition:
- receive callback is defined
- network device is initialized (net0001)
- Trigger: unregistration program of network device driver is started
-
Basic flow:
- network device driver receives receive callback
- network device driver checks if receive callback is registered
- if so network device driver removes receive callback from its registry
-
Alternate flow:
- network device driver receives receive callback
- network device driver checks if receive callback is registered
- if not network device driver disregards call silently
- Use case ID: net0004
- Application: RIOT network stack
- Use case descripiton: RIOT receives a packet from network device via SPI or similar device
- Primary actor: network device driver
-
Precondition:
- at least one receive callback to network device driver (net0002)
- network device driver knows ID of receive event from network device
- Packet buffer is initialized
-
Trigger: Network device sends message of type
NETDEV_MSG_EVENT_TYPE
to MAC layer to inform about received packet -
Basic flow:
- MAC layer notifies event back to network device driver
- Network device driver identifies event as receive event
- Network device driver copies received data from network device buffer into packet buffer
- Network device driver calls receive callbacks
- Alternate flow: —
- Use case ID: net0005
- Application: RIOT network stack
- Use case descripiton: RIOT sends a packet to network device
- Primary actor: network device driver
-
Precondition:
- Packet buffer is initialized
- Packet is in packet buffer Packet buffer
- network device is initialized (net0001)
- Trigger: send program of network device driver is started
-
Basic flow:
- Network device driver checks destination address length and payload length and they are correct
- Network device driver sends radio's header
- Network device driver iterates over Packet headers and sends them in-order
- Network device driver sends payload data
-
Alternate flow:
- Address length not supported:
- Network device driver checks destination address length and payload length and destination address length not supported
- Network device driver inform caller that address length is not supported
- Data length not supported:
- Network device driver checks destination address length and payload length and data length not supported
- Network device driver inform caller that data length is not supported
- Address length not supported:
- Use case ID: net0006
- Application: RIOT network stack
- Use case description: Get an option from the network device (e.g. radio channel)
- Primary actor: network device driver
-
Precondition:
- network device is initialized (net0001)
- Trigger: get option program of network device driver is started
-
Basic flow:
- Network device driver checks if option type is supported
- if so: network device driver checks available space in given value buffer
- if long enough: network device driver resets length of given value buffer to actual length of value
- network device driver copies value data into value buffer
-
Alternate flow:
- option type is not supported:
- Network device driver checks if option type is supported
- if not: network device driver signals that option type is not supported to caller
- available space in given value buffer is not long enough
- Network device driver checks if option type is supported
- if so: network device driver checks available space in given value buffer
- if too short: network device driver signals to caller that value buffer space is too short
- option type is not supported:
- Use case ID: net0007
- Application: RIOT network stack
- Use case description: Set an option to the network device (e.g. radio channel)
- Primary actor: network device driver
-
Precondition:
- network device is initialized (net0001)
- Trigger: set option program of network device driver is started
-
Basic flow:
- Network device driver checks if option type is supported
- if so: network device driver checks length of given value buffer
- if short enough: network device driver copies data from value buffer to option register
-
Alternate flow:
- option type is not supported:
- Network device driver checks if option type is supported
- if not: network device driver signals that option type is not supported to caller
- length of given value buffer is too long
- Network device driver checks if option type is supported
- if so: network device driver checks length of given value buffer
- if too long: network device driver signals to caller that value in value buffer would overflow
- option type is not supported:
- Use case ID: net0008
- Application: RIOT network stack
- Use case description: Get state from the network device (e.g. low-power mode)
- Primary actor: network device driver
-
Precondition:
- network device is initialized (net0001)
- Trigger: get state program of network device driver is started
-
Basic flow:
- network device driver returns current state
- Alternate flow: —
- Use case ID: net0009
- Application: RIOT network stack
- Use case description: Set state from the network device (e.g. low-power mode)
- Primary actor: network device driver
-
Precondition:
- network device is initialized (net0001)
- Trigger: set state program of network device driver is started
-
Basic flow:
- network device driver checks if given state is supported
- if so: network device driver sets new state of device
-
Alternate flow:
- network device driver checks if given state is supported
- if not: network device driver signals to caller