QtCoap

namespace QtCoap

Contains miscellaneous identifiers used throughout the Qt CoAP module.

Header: qcoapnamespace.h
CMake: find_package(Qt6 REQUIRED COMPONENTS Coap)
target_link_libraries(mytarget PRIVATE Qt6::Coap)
qmake: QT += coap

Types

enum class Error { Ok, HostNotFound, AddressInUse, TimeOut, BadRequest, ..., Unknown }
enum class Method { Invalid, Get, Post, Put, Delete, Other }
enum class MulticastGroup { AllCoapNodesIPv4, AllCoapNodesIPv6LinkLocal, AllCoapNodesIPv6SiteLocal }
enum Port { DefaultPort, DefaultSecurePort }
enum class ResponseCode { EmptyMessage, Created, Deleted, Valid, Changed, ..., InvalidCode }
enum class SecurityMode { NoSecurity, PreSharedKey, RawPublicKey, Certificate }

Type Documentation

enum class QtCoap::Error

Indicates the error condition found during processing of the request.

ConstantDescription
OkNo error condition.
HostNotFoundThe remote host name was not found.
AddressInUseThe address is already in use.
TimeOutThe response did not arrive in time.
BadRequestThe request was not recognized.
UnauthorizedThe client is not authorized to perform the requested action.
BadOptionThe request could not be understood by the server due to one or more unrecognized or malformed options.
ForbiddenAccess to this resource is forbidden.
NotFoundThe resource requested was not found.
MethodNotAllowedThe server does not allow the method used for the URL requested.
NotAcceptableNo resource satisfying the request's acceptance criteria was found.
RequestEntityIncompleteThe server has not received the blocks of the request body that it needs to proceed. The client has not sent all blocks, has not sent them in the order required by the server, or sent them long enough ago that the server has already discarded them.
PreconditionFailedOne or more conditions given in the request header fields evaluated to false when tested on the server.
RequestEntityTooLargeThe request payload is larger than the server is willing or able to process.
UnsupportedContentFormatThe payload is in a format not supported by this method on the target resource.
InternalServerFaultThe server encountered an unexpected condition that prevented it from fulfilling the request.
NotImplementedThe server does not support the functionality required to fulfill the request.
BadGatewayAn error occurred with an upstream server.
ServiceUnavailableThe service is currently unavailable.
GatewayTimeoutThe server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request.
ProxyingNotSupportedThe server is unable or unwilling to act as a forward-proxy for the URI specified in the Proxy-Uri Option or using the scheme specified in Proxy-Scheme.
UnknownAn unknown error occurred.

enum class QtCoap::Method

This enum specifies CoAP request methods.

ConstantDescription
InvalidThe default request method for an empty request.
GetGET method.
PostPOST method.
PutPUT method.
DeleteDELETE method.
OtherOther request method.

enum class QtCoap::MulticastGroup

This enum represents CoAP multicast group addresses defined in RFC 7252.

ConstantDescription
AllCoapNodesIPv4IPv4 "All CoAP Nodes" address 224.0.1.187, from the "IPv4 Multicast Address Space Registry".
AllCoapNodesIPv6LinkLocalIPv6 "All CoAP Nodes" link-local scoped address FF02::FD, from the "IPv6 Multicast Address Space Registry".
AllCoapNodesIPv6SiteLocalIPv6 "All CoAP Nodes" site-local scoped address FF05::FD, from the "IPv6 Multicast Address Space Registry".

enum QtCoap::Port

This enum specifies the default CoAP port values.

ConstantDescription
DefaultPortThe default port used for the non-secure transmission.
DefaultSecurePortThe default port used for the secure transmission.

enum class QtCoap::ResponseCode

This enum represents the response code from the CoAP protocol, as defined in RFC 7252 and RFC 7959.

ConstantDescription
EmptyMessageThe response code for an empty message.
CreatedThe request was successful and has resulted in new resources being created. This response code corresponds to HTTP 201 "Created".
DeletedThe resource has been successfully deleted. This response code corresponds to HTTP 204 "No Content" but is only used in response to requests that cause the resource to cease being available, such as DELETE and, in certain circumstances, POST.
ValidThis response code is related to HTTP 304 "Not Modified" but is only used to indicate that the response identified by the entity-tag given in the ETag Option is valid.
ChangedThe resource has been successfully modified. This response code corresponds to HTTP 204 "No Content" but is only used in response to POST and PUT requests.
ContentThe request has succeeded. This response code corresponds to HTTP 200 "OK" but is only used in response to GET requests.
ContinueIndicates that the transfer of the current block was successful, and the server will send more blocks.
BadRequestThe request was not recognized. This response code corresponds to HTTP 400 "Bad Request".
UnauthorizedThe client is not authorized to perform the requested action. This response code corresponds to HTTP 401 "Unauthorized".
BadOptionThe request could not be understood by the server due to unrecognized options.
ForbiddenAccess to this resource is forbidden. This response code corresponds to HTTP 403 "Forbidden".
NotFoundThe resource requested was not found. This response code corresponds to HTTP 404 "Not Found".
MethodNotAllowedThe server does not allow the method used for the URL requested. This response code corresponds to HTTP 405 "Method Not Allowed" but with no parallel to the "Allow" header field.
NotAcceptableNo resource satisfying the request's acceptance criteria was found. This response code corresponds to HTTP 406 "Not Acceptable", but with no response entity.
RequestEntityIncompleteThe server has not received all blocks, of the request body, that it needs to proceed.
PreconditionFailedPreconditions given in the request header fields evaluated to false when tested on the server. This response code corresponds to HTTP 412 "Precondition Failed".
RequestEntityTooLargeThe request payload is larger than the server is willing or able to process. This response code corresponds to HTTP 413 "Request Entity Too Large".
UnsupportedContentFormatThe payload is in a format not supported by this method on the target resource. This response code corresponds to HTTP 415 "Unsupported Media Type".
InternalServerFaultThe server encountered an unexpected condition that prevented it from fulfilling the request. This response code corresponds to HTTP 500 "Internal Server Error".
NotImplementedThe server does not support the functionality required to fulfill the request. This response code corresponds to HTTP 501 "Not Implemented".
BadGatewayAn error occurred with an upstream server. This response code corresponds to HTTP 502 "Bad Gateway".
ServiceUnavailableThe service is currently unavailable. This response code corresponds to HTTP 503 "Service Unavailable".
GatewayTimeoutThe server, while acting as a gateway or proxy, did not receive a timely response from an upstream server. This response code corresponds to HTTP 504 "Gateway Timeout".
ProxyingNotSupportedThe server is unable or unwilling to act as a forward-proxy for the URI specified in the Proxy-Uri Option or using the scheme specified in Proxy-Scheme.
InvalidCodeAn invalid response code.

enum class QtCoap::SecurityMode

Specifies the security mode used for securing a CoAP connection, as defined in RFC 7252.

ConstantDescription
NoSecurityThere is no protocol-level security (DTLS is disabled).
PreSharedKeyDTLS is enabled. PSK authentication will be used for security.
RawPublicKeyDTLS is enabled. An asymmetric key pair without a certificate (a raw public key) will be used for security. This mode is not supported yet.
CertificateDTLS is enabled. An asymmetric key pair with an X.509 certificate will be used for security.