Fog & Edge Computing
(CoAP)
Motilal Nehru National Institute of Technology Allahabad
211004, Uttar Pradesh
By – Nitin Kumar Yadav
(2017IS13)
Outline
• Introduction
• CoAP Features
• CoAP Transaction Model
• CoAP Layers
• CoAP Message Format
• CoAP Methods
• CoAP Source Code
• Conclusion
Introduction
• CoAP is a RESTful transfer protocol for constrained nodes and
networks.
• CoAP designed for Machine to Machine(M2M) application such as
smart energy and building automation.
• CoAP provides a request/ reseponse model between application
endpoints supports built in discovery of services and resources.
• CoAP is designed to easily interface with HTTP for integration with
the web while meeting specialized requirements such as multicast
support, very overhead, and simplicity for constrained enviroments.
CoAP Features
• Embedded web transfer protocol
• Asynchronous transaction model
• UDP binding with reliability and multicast support
• GET, POST, PUT, DELETE methods
• URI support
• Small, simple 4 byte header
• DTLS based PSK, RPK and Certificate security
• Subset of MIME types and HTTP response codes
• Built-in discovery protocol
• Optional observation and block transfer
CoAP Transaction Model
• Transport - CoAP is defined for UDP.
• Messaging
- Simple message exchange between end-points
- CON, NON, ACK, RST.
• REST
- Request/response piggybacked on messages
- Method, Response Code and Options (URI, content-type)
CoAP Layer
• CoAP is an application layer Protocol,
and it needs security.
• To get the authencity, integrity and
confidentiality, it
implements Datagram
Transport Layer Security (DTLS) in
Security layer.
• DTLS deals with packet loss and does
the reordering .
CoAP Layer Contd…
• Similar to HTTP a CoAP request is sent by a client using a Method
Code to request an action on a URI identifiable resource.
• The server replies with a Response Code which may include a
resource representation.
• CoAP model is essentially client/server architecture enabling the
client to request for service from server as needed and the server
responds.
• The message layer interfaces with UDP layer which formats the data
received into a datagram and sends it to the lower layers of the OSI or
the TCP/IP Model.
CoAP Messages
• Confirmable Message - Some messages require an
acknowledgement. These messages are called "Confirmable".
• Non-confirmable Message - Some other messages do not require an
acknowledgement.
• This is particularly true for messages that are repeated regularly for
application requirements.
CoAP Messages Contd…
• Acknowledgement Message - An Acknowledgement message
acknowledges that a specific Confirmable message arrived.
• By itself, an Acknowledgement message does not indicate success or
failure of any request encapsulated in the Confirmable message, but the
Acknowledgement message may also carry a Piggybacked Response.
• Reset Message - A Reset message indicates that a specific message
was received, but some context is missing to properly process it.
• This condition is usually caused when the receiving node has rebooted and
has forgotten some state that would be required to interpret the message.
CoAP Message Format
CoAP Message Format Contd…
• Ver- Version (1) 2 bit unsigned integer . Implementations of this field to 1
(01 binary).
• T– Message Type 2- bit unsigned integer. (Confirmable, Non-Confirmable,
Acknowledgement, Reset).
• TKL- Token Length 4-bit unsigned integer. Indicates the length of the
variable-length Token field (0-8 bytes).
• Code– 8-bit unsighted integer. 3 bit class(most signification bits). 5 bits
detail (least significant bits).
• Request Method (1-10) or Response Code (40-255)
• Message ID – 16-bit identifier for matching responses
• Token– Optional response matching token.
Option Format
• Option Delta - Difference between this
option type and the previous.
• 4 bit unsigned integer. A value between
0 and 12 indicates the Optional Delta.
• Length- Length of the option value.
• 4 bit unsigned integer. A value between
0 and 12 indicates the length of the
Optional Value, in bytes.
• Value- The value of Length bytes
immediately follows Length.
CoAP Methods
• Get - The Get method retrieves a representation for the information
that currently corresponds to the resource identified by the request
URI.
• Post - The Post method requests that the representation enclosed in
the request be processed.
• Put - The Put method requests that the resource identified by the
request URI be updated or created with the enclosed representation.
• Delete – The Delete method requests that the resource identified by
request URI be deleted.
Source Code
• The Constrained Application Protocol (CoAP) is a RESTful web
transfer protocol for resource-constrained networks and nodes.
• (Client Side) new a GET request
Request request = new Request(Method.GET);
request.URI = new Uri("coap://[::1]/hello-world");
request.Send();
• wait for one response
Response response = request.WaitForResponse();
Conclusion
• CoAP is very efficient RESTful protocol .
• CoAP is Ideal for constrained devices and networks.
• CoAP specialized for M2M Applications.
• CoAP is not general replacement for HTTP, HTTP compression or only
restricted to isolated “automation” networks.

Fog & edge computing(coap )

  • 1.
    Fog & EdgeComputing (CoAP) Motilal Nehru National Institute of Technology Allahabad 211004, Uttar Pradesh By – Nitin Kumar Yadav (2017IS13)
  • 2.
    Outline • Introduction • CoAPFeatures • CoAP Transaction Model • CoAP Layers • CoAP Message Format • CoAP Methods • CoAP Source Code • Conclusion
  • 3.
    Introduction • CoAP isa RESTful transfer protocol for constrained nodes and networks. • CoAP designed for Machine to Machine(M2M) application such as smart energy and building automation. • CoAP provides a request/ reseponse model between application endpoints supports built in discovery of services and resources. • CoAP is designed to easily interface with HTTP for integration with the web while meeting specialized requirements such as multicast support, very overhead, and simplicity for constrained enviroments.
  • 4.
    CoAP Features • Embeddedweb transfer protocol • Asynchronous transaction model • UDP binding with reliability and multicast support • GET, POST, PUT, DELETE methods • URI support • Small, simple 4 byte header • DTLS based PSK, RPK and Certificate security • Subset of MIME types and HTTP response codes • Built-in discovery protocol • Optional observation and block transfer
  • 5.
    CoAP Transaction Model •Transport - CoAP is defined for UDP. • Messaging - Simple message exchange between end-points - CON, NON, ACK, RST. • REST - Request/response piggybacked on messages - Method, Response Code and Options (URI, content-type)
  • 6.
    CoAP Layer • CoAPis an application layer Protocol, and it needs security. • To get the authencity, integrity and confidentiality, it implements Datagram Transport Layer Security (DTLS) in Security layer. • DTLS deals with packet loss and does the reordering .
  • 7.
    CoAP Layer Contd… •Similar to HTTP a CoAP request is sent by a client using a Method Code to request an action on a URI identifiable resource. • The server replies with a Response Code which may include a resource representation. • CoAP model is essentially client/server architecture enabling the client to request for service from server as needed and the server responds. • The message layer interfaces with UDP layer which formats the data received into a datagram and sends it to the lower layers of the OSI or the TCP/IP Model.
  • 8.
    CoAP Messages • ConfirmableMessage - Some messages require an acknowledgement. These messages are called "Confirmable". • Non-confirmable Message - Some other messages do not require an acknowledgement. • This is particularly true for messages that are repeated regularly for application requirements.
  • 9.
    CoAP Messages Contd… •Acknowledgement Message - An Acknowledgement message acknowledges that a specific Confirmable message arrived. • By itself, an Acknowledgement message does not indicate success or failure of any request encapsulated in the Confirmable message, but the Acknowledgement message may also carry a Piggybacked Response. • Reset Message - A Reset message indicates that a specific message was received, but some context is missing to properly process it. • This condition is usually caused when the receiving node has rebooted and has forgotten some state that would be required to interpret the message.
  • 10.
  • 11.
    CoAP Message FormatContd… • Ver- Version (1) 2 bit unsigned integer . Implementations of this field to 1 (01 binary). • T– Message Type 2- bit unsigned integer. (Confirmable, Non-Confirmable, Acknowledgement, Reset). • TKL- Token Length 4-bit unsigned integer. Indicates the length of the variable-length Token field (0-8 bytes). • Code– 8-bit unsighted integer. 3 bit class(most signification bits). 5 bits detail (least significant bits). • Request Method (1-10) or Response Code (40-255) • Message ID – 16-bit identifier for matching responses • Token– Optional response matching token.
  • 12.
    Option Format • OptionDelta - Difference between this option type and the previous. • 4 bit unsigned integer. A value between 0 and 12 indicates the Optional Delta. • Length- Length of the option value. • 4 bit unsigned integer. A value between 0 and 12 indicates the length of the Optional Value, in bytes. • Value- The value of Length bytes immediately follows Length.
  • 13.
    CoAP Methods • Get- The Get method retrieves a representation for the information that currently corresponds to the resource identified by the request URI. • Post - The Post method requests that the representation enclosed in the request be processed. • Put - The Put method requests that the resource identified by the request URI be updated or created with the enclosed representation. • Delete – The Delete method requests that the resource identified by request URI be deleted.
  • 14.
    Source Code • TheConstrained Application Protocol (CoAP) is a RESTful web transfer protocol for resource-constrained networks and nodes. • (Client Side) new a GET request Request request = new Request(Method.GET); request.URI = new Uri("coap://[::1]/hello-world"); request.Send(); • wait for one response Response response = request.WaitForResponse();
  • 15.
    Conclusion • CoAP isvery efficient RESTful protocol . • CoAP is Ideal for constrained devices and networks. • CoAP specialized for M2M Applications. • CoAP is not general replacement for HTTP, HTTP compression or only restricted to isolated “automation” networks.