forked from RIOT-OS/RIOT
-
Notifications
You must be signed in to change notification settings - Fork 0
Model for the network stack
authmillenon edited this page Nov 3, 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
- Use case ID: pkt0001
- Application: Packet buffer
- Use case description: Allocate space for a packet in packet buffer
- Primary actor: packet buffer
- Precondition: —
- Trigger: allocate packet program of packet buffer is started
-
Basic flow:
- packet buffer checks if space for packet is left
- if so: packet buffer allocates packet space
- packet buffer marks allocated packet space as processed (pkt0005)
- packet buffer returns newly allocated packet
-
Alternate flow:
- packet buffer checks if space for packet is left
- if not: packet buffer signals to caller, that space is not available
- Use case ID: pkt0002
- Application: Packet buffer
- Use case description: Re-sizes allocated space for a packet in packet buffer
- Primary actor: packet buffer
- Precondition: —
- Trigger: reallocate packet program of packet buffer is started
-
Basic flow:
- packet buffer checks if given packet is in it
- if so: packet buffer checks if re-sized packet would fit into the same space
- if so: packet buffer re-sizes packet
- packet buffer returns original pointer to packet
-
Alternate flow:
- given packet not in packet buffer
- packet buffer checks if given packet is in it
- if not: pkt0001
- re-sized packet does not fit into old space
- packet buffer checks if given packet is in it
- if so: packet buffer checks if re-sized packet would fit into the same space
- if not: allocate new packet space (pkt0001)
- if new space is available: copy data and headers from old space to new (pkt0004)
- remove allocation for old space (pkt0006)
- packet buffer returns pointer to new space
- re-sized packet does not fit into old space and no new space available
- packet buffer checks if given packet is in it
- if so: packet buffer checks if re-sized packet would fit into the same space
- if not: allocate new packet space (pkt0001)
- if no new space is available: packet buffer signals to caller, that space is not available
- given packet not in packet buffer
- Use case ID: pkt0003
- Application: Packet buffer
- Use case description: Allocate space for a packet in packet buffer and fill it with given data
- Primary actor: packet buffer
- Precondition: —
- Trigger: insert packet program of packet buffer is started
- Basic flow:
-
Alternate flow:
- packet buffer allocates packet (pkt0001)
- if space available: packet buffer signals to caller, that space is not available
- Use case ID: pkt0004
- Application: Packet buffer
- Use case description: Fill a given packet with given data
- Primary actor: packet buffer
- Precondition: —
- Trigger: copy packet program of packet buffer is started
-
Basic flow:
- packet buffer checks if given packet is in it
- if so: packet buffer checks if given data would fit into packet
- if so: packet buffer copies given data into allocated space
- packet buffer signals success to caller
-
Alternate flow:
- given packet is not in packet buffer
- packet buffer checks if given packet is in it
- if not: net0003
- packet buffer signals success or failure of net0003 to caller
- given data is to long for given packet:
- packet buffer checks if given packet is in it
- if so: packet buffer checks if given data would fit into packet
- if not: packet buffer signals to caller that packet space is too small
- given packet is not in packet buffer
- Use case ID: pkt0005
- Application: Packet buffer
-
Use case description: Increment
processing
counter of packet - Primary actor: packet buffer
- Precondition: packet is in packet buffer
- Trigger: hold packet program of packet buffer is started
-
Basic flow:
- increment
processing
counter of packet
- increment
- Use case ID: pkt0006
- Application: Packet buffer
-
Use case description: Decrement
processing
counter of packet - Primary actor: packet buffer
- Precondition: packet is in packet buffer
- Trigger: release packet program of packet buffer is started
-
Basic flow:
- decrement
processing
counter of packet - if
processing == 0
remove packet from packet buffer
- decrement
(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 description: 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 description: 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 description: 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 description: 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
RIOT - The friendly Operating System for the Internet of Things
Homepage | [GitHub] (https://github.com/RIOT-OS/) | Developers Mailing List | Users Mailing List | Twitter @RIOT_OS
- Family: ARM
- Board: Airfy Beacon
- Board: Arduino Due
- Board: CC2538DK
- Board: CC2650STK
- Board: HikoB Fox
- Board: IoT LAB M3
- Board: LimiFrog-v1
- Board: mbed_lpc1768
- Board: MSB-IoT
- Board: MSBA2
- Board: Nucleo-L1
- Board: Nucleo-F446
- Board: Nucleo-F334
- Board: Nucleo-F303
- Board: Nucleo-F091
- Board: Mulle
- Board: OpenMote
- Board: PCA1000x (nRF51822 Development Kit)
- Board: Phytec phyWAVE-KW22
- Board: RFduino
- Board: SAMR21-xpro
- Board: SAML21-xpro
- Board: Seeeduino Arch-Pro
- Board: SODAQ Autonomo
- Board: Spark Core
- Board: STM32F0discovery
- Board: STM32F3discovery
- Board: STM32F4discovery
- Board: UDOO
- Board: yunjia-nrf51822
- Board: Zolertia remote
- Family: ATmega
- Board: Arduino Mega2560
- Board: Arduino Uno
- Board: Arduino Duemilanove
- Family: MSP430
- Board: MSB-430H
- Board: TelosB
- Board: WSN430
- Board: Zolertia Z1
- Board: eZ430-Chronos
- Family: native
- Board: native
- Family: x86
- Board: Intel Galileo