SlideShare a Scribd company logo
1 of 21
The Contiki netstack
The Contiki netstack
• Four layers
– Network layer

Application
Transport

Network, routing
Adaptation

– MAC layer
– RDC layer
– Radio layer

MAC
Duty cycling
Radio
Netstack concepts
• Four fixed layers
–
–
–
–

•
•
•
•

NETSTACK_RADIO
NETSTACK_RDC
NETSTACK_MAC
NETSTACK_NETWORK

The packet buffer – packetbuf
Queue buffers – queuebuf
uIP packet buffer – uip_buf
Framers
– NETSTACK_FRAMER
The packetbuf
• One buffer, holds a single packet
• All layers of the netstack operate on the
packetbuf
• Large enough to hold a single radio packet
– PACKETBUF_CONF_LEN

• Packet attributes
– Parsed header data: addresses
– Packet meta data: RSSI
The packetbuf hdr and data
hdr

data

• hdr grows upwards
– Only used on outbound path

• data typically don’t grow
– Contains data on outbound path
– Contains header and data on inbound path
packetbuf
• void packetbuf_clear(void);
• int packetbuf_copyfrom(const void *from,
uint16_t len);
• void *packetbuf_dataptr(void);
• uint16_t packetbuf_datalen(void);
• void packetbuf_set_datalen(uint16_t len);
• void *packetbuf_hdrptr(void);
• uint8_t packetbuf_hdrlen(void);
• uint16_t packetbuf_totlen(void);
• void packetbuf_compact(void);
• int packetbuf_copyto(void *to);
queuebuf
• The packetbuf only holds the current
packet
• To store packets on queues, use a
queuebuf
• struct queuebuf *queuebuf_new_from_packetbuf(void);
• void queuebuf_to_packetbuf(struct queuebuf *b);
• void queuebuf_free(struct queuebuf *b);

• Use a list to keep track of them
Framer
• The framer module converts link-layer
headers to packet attributes
– parse()

• And packet attributes to link-layer headers
– create()
Walking up the netstack
A packet through the netstack
• Step 1: the radio interrupt
– Data arrives in bytes via an
interrupt handler
• Read byte by byte, put in buffer
• Poll process on last byte

– Or
– Data arrives as a full packet via
interrupt handler
• Read out packet into buffer, poll
process

Application
Transport

Network, routing
Adaptation
MAC
Duty cycling
Radio
A packet through the netstack
• Step 2: the radio process
– Copy packet data from buffer
into packetbuf
– Read out RSSI, store as
packetbuf attribute
– Call
NETSTACK_RDC.input();

Application
Transport

Network, routing
Adaptation
MAC
Duty cycling
Radio
Interruption: Calling Contiki from
an interrupt
• The golden rule: there is only one safe
Contiki function to call
– process_poll();

• process_poll(&process) will cause the
process to be sent a special
PROCESS_EVENT_POLL event
• Try to do as much as possible in a poll event
handler
• Synchronize data with ringbuf
A packet through the netstack
• Step 3: the RDC input
– Call framer to parse header
– Check if pending bit set
• Indicates a packet burst
• Might need to have radio on for
a while

– Call
NETSTACK_MAC.input()

Application
Transport

Network, routing
Adaptation
MAC
Duty cycling
Radio
A packet through the netstack
• Step 3: the MAC input
– Just call
NETSTACK_NETWORK.input()

Application
Transport

Network, routing
Adaptation
MAC
Duty cycling
Radio
A packet through the netstack
• Step 4: the 6lowpan input
– Uncompress header
– If part of a larger IPv6 packet,
copy into fragmentation
reassembly buffer and return to
wait for the next packet
– Copy packet into uip_buf
– Call the IPv6 stack
tcpip_input()

Application
Transport

Network, routing
Adaptation
MAC
Duty cycling
Radio
Walking down the netstack
A packet through the netstack
• Step 1: the 6lowpan output
– Clear packetbuf
– Compress header from uip_buf
to packetbuf
– If uip_buf packet too large, split
into several queuebufs
– Call NETSTACK_MAC.send();

Application
Transport

Network, routing
Adaptation
MAC
Duty cycling
Radio
A packet through the netstack
• Step 2: the MAC output
– Find the receiver in the
neighbor list
– Add the packet to the
neighbor’s output queue
– If only packet on queue, call
NETSTACK_RDC.send_list();

Application
Transport

Network, routing
Adaptation
MAC
Duty cycling
Radio
A packet through the netstack
• Step 3: the RDC output
– Check for radio traffic
• If so, return a collision to the MAC
layer

– Send all packets on list, wait for
ACK between each

Application
Transport

Network, routing
Adaptation
MAC
Duty cycling
Radio
A packet through the netstack
• Step 4: the radio output
– Push packet to radio hardware
– Send packet

Application
Transport

Network, routing
Adaptation
MAC
Duty cycling
Radio
More

http://thingsquare.com

More Related Content

What's hot

LinuxCon 2015 Stateful NAT with OVS
LinuxCon 2015 Stateful NAT with OVSLinuxCon 2015 Stateful NAT with OVS
LinuxCon 2015 Stateful NAT with OVSThomas Graf
 
IPv6 at Mythic Beasts - Networkshop44
IPv6 at Mythic Beasts - Networkshop44IPv6 at Mythic Beasts - Networkshop44
IPv6 at Mythic Beasts - Networkshop44Jisc
 
LISP and NSH in Open vSwitch
LISP and NSH in Open vSwitchLISP and NSH in Open vSwitch
LISP and NSH in Open vSwitchmestery
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Adam Dunkels
 
IP routing in linux
IP routing in linuxIP routing in linux
IP routing in linuxgamer007
 
Conceptos ipv6, direccionamiento
Conceptos ipv6, direccionamientoConceptos ipv6, direccionamiento
Conceptos ipv6, direccionamientoEdgardo Scrimaglia
 
Opensample: A Low-latency, Sampling-based Measurement Platform for Software D...
Opensample: A Low-latency, Sampling-based Measurement Platform for Software D...Opensample: A Low-latency, Sampling-based Measurement Platform for Software D...
Opensample: A Low-latency, Sampling-based Measurement Platform for Software D...Junho Suh
 
Como definir un esquema de direcciones IPv6
Como definir un esquema de direcciones IPv6Como definir un esquema de direcciones IPv6
Como definir un esquema de direcciones IPv6Edgardo Scrimaglia
 
Ns3 implementation wifi
Ns3 implementation wifiNs3 implementation wifi
Ns3 implementation wifiSalah Amean
 
Network Node is Not Needed Anymore - Completed Distributed Virtual Router / F...
Network Node is Not Needed Anymore - Completed Distributed Virtual Router / F...Network Node is Not Needed Anymore - Completed Distributed Virtual Router / F...
Network Node is Not Needed Anymore - Completed Distributed Virtual Router / F...Takanori Miyagishi
 
L3 and Multicasting PPT by NETWORKERS HOME
L3 and Multicasting PPT by NETWORKERS HOMEL3 and Multicasting PPT by NETWORKERS HOME
L3 and Multicasting PPT by NETWORKERS HOMEnetworkershome
 
Open vSwitch - Stateful Connection Tracking & Stateful NAT
Open vSwitch - Stateful Connection Tracking & Stateful NATOpen vSwitch - Stateful Connection Tracking & Stateful NAT
Open vSwitch - Stateful Connection Tracking & Stateful NATThomas Graf
 
Barak Perlman, ConteXtream - SFC (Service Function Chaining) Using Openstack ...
Barak Perlman, ConteXtream - SFC (Service Function Chaining) Using Openstack ...Barak Perlman, ConteXtream - SFC (Service Function Chaining) Using Openstack ...
Barak Perlman, ConteXtream - SFC (Service Function Chaining) Using Openstack ...Cloud Native Day Tel Aviv
 
Pyretic - A new programmer friendly language for SDN
Pyretic - A new programmer friendly language for SDNPyretic - A new programmer friendly language for SDN
Pyretic - A new programmer friendly language for SDNnvirters
 

What's hot (20)

LinuxCon 2015 Stateful NAT with OVS
LinuxCon 2015 Stateful NAT with OVSLinuxCon 2015 Stateful NAT with OVS
LinuxCon 2015 Stateful NAT with OVS
 
BGP Advanced topics
BGP Advanced topicsBGP Advanced topics
BGP Advanced topics
 
IPv6 at Mythic Beasts - Networkshop44
IPv6 at Mythic Beasts - Networkshop44IPv6 at Mythic Beasts - Networkshop44
IPv6 at Mythic Beasts - Networkshop44
 
Network Layer
Network LayerNetwork Layer
Network Layer
 
LISP and NSH in Open vSwitch
LISP and NSH in Open vSwitchLISP and NSH in Open vSwitch
LISP and NSH in Open vSwitch
 
SEGMENT Routing
SEGMENT RoutingSEGMENT Routing
SEGMENT Routing
 
6lowpan
6lowpan6lowpan
6lowpan
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
 
IP routing in linux
IP routing in linuxIP routing in linux
IP routing in linux
 
Conceptos ipv6, direccionamiento
Conceptos ipv6, direccionamientoConceptos ipv6, direccionamiento
Conceptos ipv6, direccionamiento
 
6LoWPAN: An open IoT Networking Protocol
6LoWPAN: An open IoT Networking Protocol6LoWPAN: An open IoT Networking Protocol
6LoWPAN: An open IoT Networking Protocol
 
Opensample: A Low-latency, Sampling-based Measurement Platform for Software D...
Opensample: A Low-latency, Sampling-based Measurement Platform for Software D...Opensample: A Low-latency, Sampling-based Measurement Platform for Software D...
Opensample: A Low-latency, Sampling-based Measurement Platform for Software D...
 
Como definir un esquema de direcciones IPv6
Como definir un esquema de direcciones IPv6Como definir un esquema de direcciones IPv6
Como definir un esquema de direcciones IPv6
 
Ns3 implementation wifi
Ns3 implementation wifiNs3 implementation wifi
Ns3 implementation wifi
 
Mecanismos de transicion pv6
Mecanismos de transicion pv6Mecanismos de transicion pv6
Mecanismos de transicion pv6
 
Network Node is Not Needed Anymore - Completed Distributed Virtual Router / F...
Network Node is Not Needed Anymore - Completed Distributed Virtual Router / F...Network Node is Not Needed Anymore - Completed Distributed Virtual Router / F...
Network Node is Not Needed Anymore - Completed Distributed Virtual Router / F...
 
L3 and Multicasting PPT by NETWORKERS HOME
L3 and Multicasting PPT by NETWORKERS HOMEL3 and Multicasting PPT by NETWORKERS HOME
L3 and Multicasting PPT by NETWORKERS HOME
 
Open vSwitch - Stateful Connection Tracking & Stateful NAT
Open vSwitch - Stateful Connection Tracking & Stateful NATOpen vSwitch - Stateful Connection Tracking & Stateful NAT
Open vSwitch - Stateful Connection Tracking & Stateful NAT
 
Barak Perlman, ConteXtream - SFC (Service Function Chaining) Using Openstack ...
Barak Perlman, ConteXtream - SFC (Service Function Chaining) Using Openstack ...Barak Perlman, ConteXtream - SFC (Service Function Chaining) Using Openstack ...
Barak Perlman, ConteXtream - SFC (Service Function Chaining) Using Openstack ...
 
Pyretic - A new programmer friendly language for SDN
Pyretic - A new programmer friendly language for SDNPyretic - A new programmer friendly language for SDN
Pyretic - A new programmer friendly language for SDN
 

Viewers also liked

Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...Adam Dunkels
 
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1Adam Dunkels
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1Adam Dunkels
 
Contiki Operating system tutorial
Contiki Operating system tutorialContiki Operating system tutorial
Contiki Operating system tutorialSalah Amean
 
Contiki os timer tutorial
Contiki os timer tutorialContiki os timer tutorial
Contiki os timer tutorialSalah Amean
 
Contiki introduction I.
Contiki introduction I.Contiki introduction I.
Contiki introduction I.Dingxin Xu
 
Slide RPL- Routing Protocol for Loossy and Low-power LLNs
Slide RPL- Routing Protocol for Loossy and Low-power LLNsSlide RPL- Routing Protocol for Loossy and Low-power LLNs
Slide RPL- Routing Protocol for Loossy and Low-power LLNsQuang Do
 
Rpl:Routing Protocol for Low-Power and Lossy Networks
Rpl:Routing Protocol for Low-Power and Lossy NetworksRpl:Routing Protocol for Low-Power and Lossy Networks
Rpl:Routing Protocol for Low-Power and Lossy NetworksLandry Simo
 

Viewers also liked (12)

Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
 
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
 
Contiki Operating system tutorial
Contiki Operating system tutorialContiki Operating system tutorial
Contiki Operating system tutorial
 
Contiki Presentation
Contiki PresentationContiki Presentation
Contiki Presentation
 
Contiki os timer tutorial
Contiki os timer tutorialContiki os timer tutorial
Contiki os timer tutorial
 
Contiki introduction I.
Contiki introduction I.Contiki introduction I.
Contiki introduction I.
 
Rpl
Rpl Rpl
Rpl
 
Slide RPL- Routing Protocol for Loossy and Low-power LLNs
Slide RPL- Routing Protocol for Loossy and Low-power LLNsSlide RPL- Routing Protocol for Loossy and Low-power LLNs
Slide RPL- Routing Protocol for Loossy and Low-power LLNs
 
Rpl dodag
Rpl dodagRpl dodag
Rpl dodag
 
Rpl:Routing Protocol for Low-Power and Lossy Networks
Rpl:Routing Protocol for Low-Power and Lossy NetworksRpl:Routing Protocol for Low-Power and Lossy Networks
Rpl:Routing Protocol for Low-Power and Lossy Networks
 
Rpl2016
Rpl2016Rpl2016
Rpl2016
 

Similar to Advanced Internet of Things firmware engineering with Thingsquare and Contiki - day 1, part 2

Network protocols and vulnerabilities
Network protocols and vulnerabilitiesNetwork protocols and vulnerabilities
Network protocols and vulnerabilitiesG Prachi
 
Packet Analysis - Course Technology Computing Conference
Packet Analysis - Course Technology Computing ConferencePacket Analysis - Course Technology Computing Conference
Packet Analysis - Course Technology Computing ConferenceCengage Learning
 
UNIT-3 network security layers andits types
UNIT-3 network security layers andits typesUNIT-3 network security layers andits types
UNIT-3 network security layers andits typesgjeyasriitaamecnew
 
transport.pptx
transport.pptxtransport.pptx
transport.pptxjatinder42
 
The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecturehugo lu
 
ENC_254_PPT_ch04.pdf
ENC_254_PPT_ch04.pdfENC_254_PPT_ch04.pdf
ENC_254_PPT_ch04.pdfshaker402
 
High performance browser networking ch1,2,3
High performance browser networking ch1,2,3High performance browser networking ch1,2,3
High performance browser networking ch1,2,3Seung-Bum Lee
 
Making our networking stack truly extensible
Making our networking stack truly extensible Making our networking stack truly extensible
Making our networking stack truly extensible Olivier Bonaventure
 
Ocpeu14
Ocpeu14Ocpeu14
Ocpeu14KALRAY
 
integrated and diffrentiated services
 integrated and diffrentiated services integrated and diffrentiated services
integrated and diffrentiated servicesRishabh Gupta
 
LTE Training Course
LTE Training CourseLTE Training Course
LTE Training CourseChiehChun
 

Similar to Advanced Internet of Things firmware engineering with Thingsquare and Contiki - day 1, part 2 (20)

Network protocols and vulnerabilities
Network protocols and vulnerabilitiesNetwork protocols and vulnerabilities
Network protocols and vulnerabilities
 
WiFi - IEEE 802.11
WiFi - IEEE 802.11WiFi - IEEE 802.11
WiFi - IEEE 802.11
 
4. network layer
4. network layer4. network layer
4. network layer
 
IPHEADER_IPV4_IPV6_4.pdf
IPHEADER_IPV4_IPV6_4.pdfIPHEADER_IPV4_IPV6_4.pdf
IPHEADER_IPV4_IPV6_4.pdf
 
Packet Analysis - Course Technology Computing Conference
Packet Analysis - Course Technology Computing ConferencePacket Analysis - Course Technology Computing Conference
Packet Analysis - Course Technology Computing Conference
 
Lect9
Lect9Lect9
Lect9
 
Lect9 (1)
Lect9 (1)Lect9 (1)
Lect9 (1)
 
UNIT-3 network security layers andits types
UNIT-3 network security layers andits typesUNIT-3 network security layers andits types
UNIT-3 network security layers andits types
 
Future Internet protocols
Future Internet protocolsFuture Internet protocols
Future Internet protocols
 
transport.pptx
transport.pptxtransport.pptx
transport.pptx
 
The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecture
 
ENC_254_PPT_ch04.pdf
ENC_254_PPT_ch04.pdfENC_254_PPT_ch04.pdf
ENC_254_PPT_ch04.pdf
 
High performance browser networking ch1,2,3
High performance browser networking ch1,2,3High performance browser networking ch1,2,3
High performance browser networking ch1,2,3
 
CN Jntu PPT
CN Jntu PPTCN Jntu PPT
CN Jntu PPT
 
Transportlayer tanenbaum
Transportlayer tanenbaumTransportlayer tanenbaum
Transportlayer tanenbaum
 
Making our networking stack truly extensible
Making our networking stack truly extensible Making our networking stack truly extensible
Making our networking stack truly extensible
 
Ocpeu14
Ocpeu14Ocpeu14
Ocpeu14
 
integrated and diffrentiated services
 integrated and diffrentiated services integrated and diffrentiated services
integrated and diffrentiated services
 
Qo s 09-integrated and red
Qo s 09-integrated and redQo s 09-integrated and red
Qo s 09-integrated and red
 
LTE Training Course
LTE Training CourseLTE Training Course
LTE Training Course
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 

Recently uploaded (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

Advanced Internet of Things firmware engineering with Thingsquare and Contiki - day 1, part 2

  • 2. The Contiki netstack • Four layers – Network layer Application Transport Network, routing Adaptation – MAC layer – RDC layer – Radio layer MAC Duty cycling Radio
  • 3. Netstack concepts • Four fixed layers – – – – • • • • NETSTACK_RADIO NETSTACK_RDC NETSTACK_MAC NETSTACK_NETWORK The packet buffer – packetbuf Queue buffers – queuebuf uIP packet buffer – uip_buf Framers – NETSTACK_FRAMER
  • 4. The packetbuf • One buffer, holds a single packet • All layers of the netstack operate on the packetbuf • Large enough to hold a single radio packet – PACKETBUF_CONF_LEN • Packet attributes – Parsed header data: addresses – Packet meta data: RSSI
  • 5. The packetbuf hdr and data hdr data • hdr grows upwards – Only used on outbound path • data typically don’t grow – Contains data on outbound path – Contains header and data on inbound path
  • 6. packetbuf • void packetbuf_clear(void); • int packetbuf_copyfrom(const void *from, uint16_t len); • void *packetbuf_dataptr(void); • uint16_t packetbuf_datalen(void); • void packetbuf_set_datalen(uint16_t len); • void *packetbuf_hdrptr(void); • uint8_t packetbuf_hdrlen(void); • uint16_t packetbuf_totlen(void); • void packetbuf_compact(void); • int packetbuf_copyto(void *to);
  • 7. queuebuf • The packetbuf only holds the current packet • To store packets on queues, use a queuebuf • struct queuebuf *queuebuf_new_from_packetbuf(void); • void queuebuf_to_packetbuf(struct queuebuf *b); • void queuebuf_free(struct queuebuf *b); • Use a list to keep track of them
  • 8. Framer • The framer module converts link-layer headers to packet attributes – parse() • And packet attributes to link-layer headers – create()
  • 9. Walking up the netstack
  • 10. A packet through the netstack • Step 1: the radio interrupt – Data arrives in bytes via an interrupt handler • Read byte by byte, put in buffer • Poll process on last byte – Or – Data arrives as a full packet via interrupt handler • Read out packet into buffer, poll process Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 11. A packet through the netstack • Step 2: the radio process – Copy packet data from buffer into packetbuf – Read out RSSI, store as packetbuf attribute – Call NETSTACK_RDC.input(); Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 12. Interruption: Calling Contiki from an interrupt • The golden rule: there is only one safe Contiki function to call – process_poll(); • process_poll(&process) will cause the process to be sent a special PROCESS_EVENT_POLL event • Try to do as much as possible in a poll event handler • Synchronize data with ringbuf
  • 13. A packet through the netstack • Step 3: the RDC input – Call framer to parse header – Check if pending bit set • Indicates a packet burst • Might need to have radio on for a while – Call NETSTACK_MAC.input() Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 14. A packet through the netstack • Step 3: the MAC input – Just call NETSTACK_NETWORK.input() Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 15. A packet through the netstack • Step 4: the 6lowpan input – Uncompress header – If part of a larger IPv6 packet, copy into fragmentation reassembly buffer and return to wait for the next packet – Copy packet into uip_buf – Call the IPv6 stack tcpip_input() Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 16. Walking down the netstack
  • 17. A packet through the netstack • Step 1: the 6lowpan output – Clear packetbuf – Compress header from uip_buf to packetbuf – If uip_buf packet too large, split into several queuebufs – Call NETSTACK_MAC.send(); Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 18. A packet through the netstack • Step 2: the MAC output – Find the receiver in the neighbor list – Add the packet to the neighbor’s output queue – If only packet on queue, call NETSTACK_RDC.send_list(); Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 19. A packet through the netstack • Step 3: the RDC output – Check for radio traffic • If so, return a collision to the MAC layer – Send all packets on list, wait for ACK between each Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 20. A packet through the netstack • Step 4: the radio output – Push packet to radio hardware – Send packet Application Transport Network, routing Adaptation MAC Duty cycling Radio