OS-IoT
Functions | Classes | Typedefs | Enumerations
onem2m Namespace Reference

Public interface for functions and classes in the OS-IoT library. More...

Functions

std::unique_ptr< ::xml_schema::typecreateResource (const std::string &address, const std::string &requestId,::xml_schema::type &resource, long &result,::xml_schema::integer &resObjType)
 
std::unique_ptr< ::xml_schema::typedeleteResource (const std::string &address, const std::string &requestId, long &result,::xml_schema::integer &resObjType)
 
std::string getCaInfo ()
 
std::string getCaPath ()
 
std::string getCipherList ()
 
std::string getFrom ()
 
bool getHttpServerRunning ()
 
std::string getKeyPasswd ()
 
size_t getMaxAcceptSize ()
 
onem2mProtocol getProtocol ()
 
std::string getPskIdentity ()
 
std::string getPskKey ()
 
std::string getSslCert ()
 
std::string getSslKey ()
 
std::string getSubjectAltNameAllowed ()
 
onem2mTransport getTransport ()
 
bool getVerifyHost ()
 
bool getVerifyPeer ()
 
void initialize ()
 
std::unique_ptr< ::xml_schema::typeretrieveResource (const std::string &address, const std::string &requestId, long &result,::xml_schema::integer &resObjType)
 
void setCaInfo (const std::string)
 
void setCaPath (const std::string)
 
void setCipherList (const std::string)
 
void setDebug (bool debugOut)
 
void setFrom (const std::string newFrom)
 
void setHostName (const std::string name)
 
void setKeyPasswd (const std::string)
 
void setMaxAcceptSize (const size_t newMaxAcceptSize)
 
void setProtocol (const onem2mProtocol)
 
void setPskIdentity (const std::string)
 
void setPskKey (const std::string)
 
void setSslCert (const std::string)
 
void setSslKey (const std::string)
 
void setSubjectAltNameAllowed (const std::string)
 
void setTransport (const onem2mTransport)
 
void setVerifyHost (const bool)
 
void setVerifyPeer (const bool)
 
long startHttpServer (const std::vector< std::string > &addressRegex, long port, notificationCallbackFn callback)
 
void stopHttpServer ()
 
void terminate ()
 
std::unique_ptr< ::xml_schema::typeupdateResource (const std::string &address, const std::string &requestId, const ::xml_schema::type *resource, long &result,::xml_schema::integer &resObjType)
 
std::unique_ptr< ::xml_schema::typeupdateResource (const std::string &address, const std::string &requestId, const ::xml_schema::type &resource, long &result,::xml_schema::integer &resObjType)
 

Classes

class  absRelTimestamp
 Union class corresponding to the absRelTimestamp schema type. More...
 
class  absRelTimestamp_member
 Class corresponding to the absRelTimestamp_member schema type. More...
 
class  absRelTimestamp_member1
 Class corresponding to the absRelTimestamp_member1 schema type. More...
 
class  accessControlContexts
 Class corresponding to the accessControlContexts schema type. More...
 
class  accessControlIpAddresses
 Class corresponding to the accessControlIpAddresses schema type. More...
 
class  accessControlOperations
 Enumeration class corresponding to the accessControlOperations schema type. More...
 
class  accessControlPolicy
 Class corresponding to the accessControlPolicy schema type. More...
 
class  accessControlRule
 Class corresponding to the accessControlRule schema type. More...
 
class  acpType
 Class corresponding to the acpType schema type. More...
 
class  acpType_base
 List class corresponding to the acpType_base schema type.
 
class  AE
 Class corresponding to the AE schema type. More...
 
class  announceableResource
 Class corresponding to the announceableResource schema type. More...
 
class  announceableSubordinateResource
 Class corresponding to the announceableSubordinateResource schema type. More...
 
class  announcedAttribute
 Class corresponding to the announcedAttribute schema type. More...
 
class  announcedAttribute1
 Class corresponding to the announcedAttribute1 schema type. More...
 
class  announcedAttribute1_base
 List class corresponding to the announcedAttribute1_base schema type. More...
 
class  announcedAttribute_base
 List class corresponding to the announcedAttribute_base schema type. More...
 
class  announcedResource
 Class corresponding to the announcedResource schema type. More...
 
class  announcedSubordinateResource
 Class corresponding to the announcedSubordinateResource schema type. More...
 
class  attribute
 Class corresponding to the attribute schema type. More...
 
class  attributeList
 List class corresponding to the attributeList schema type. More...
 
class  circRegion
 Class corresponding to the circRegion schema type. More...
 
class  circRegion_base
 List class corresponding to the circRegion_base schema type. More...
 
class  container
 Class corresponding to the container schema type. More...
 
class  contentInfo
 Class corresponding to the contentInfo schema type. More...
 
class  contentInstance
 Class corresponding to the contentInstance schema type. More...
 
class  contentRef
 Class corresponding to the contentRef schema type. More...
 
class  countryCode
 Class corresponding to the countryCode schema type. More...
 
class  countryCode1
 Class corresponding to the countryCode1 schema type. More...
 
class  countryCode1_base
 List class corresponding to the countryCode1_base schema type. More...
 
class  CSEBase
 Class corresponding to the CSEBase schema type. More...
 
class  cseTypeID
 Enumeration class corresponding to the cseTypeID schema type. More...
 
class  dataLink
 Class corresponding to the dataLink schema type. More...
 
class  deviceID
 Class corresponding to the deviceID schema type. More...
 
class  encodingType
 Enumeration class corresponding to the encodingType schema type. More...
 
class  eventNotificationCriteria
 Class corresponding to the eventNotificationCriteria schema type. More...
 
class  externalID
 Class corresponding to the externalID schema type. More...
 
class  flexContainerResource
 Class corresponding to the flexContainerResource schema type. More...
 
class  ID
 Class corresponding to the ID schema type. More...
 
class  ipv4
 Class corresponding to the ipv4 schema type. More...
 
class  ipv4Addresses
 Class corresponding to the ipv4Addresses schema type. More...
 
class  ipv4Addresses_base
 List class corresponding to the ipv4Addresses_base schema type. More...
 
class  ipv6
 Class corresponding to the ipv6 schema type. More...
 
class  ipv6Addresses
 Class corresponding to the ipv6Addresses schema type. More...
 
class  ipv6Addresses_base
 List class corresponding to the ipv6Addresses_base schema type. More...
 
class  labels
 Class corresponding to the labels schema type. More...
 
class  labels_base
 List class corresponding to the labels_base schema type. More...
 
class  listOfDuration
 List class corresponding to the listOfDuration schema type. More...
 
class  listOfM2MID
 Class corresponding to the listOfM2MID schema type. More...
 
class  listOfM2MID_base
 List class corresponding to the listOfM2MID_base schema type. More...
 
class  listOfNCNames
 Class corresponding to the listOfNCNames schema type. More...
 
class  listOfNCNames_base
 List class corresponding to the listOfNCNames_base schema type. More...
 
class  listOfURIs
 Class corresponding to the listOfURIs schema type. More...
 
class  listOfURIs_base
 List class corresponding to the listOfURIs_base schema type. More...
 
class  locationRegion
 Class corresponding to the locationRegion schema type. More...
 
class  locationSource
 Enumeration class corresponding to the locationSource schema type. More...
 
class  missingData
 Class corresponding to the missingData schema type. More...
 
class  nhURI
 Class corresponding to the nhURI schema type. More...
 
class  nodeID
 Class corresponding to the nodeID schema type. More...
 
class  notification
 Class corresponding to the notification schema type. More...
 
class  notificationBase
 Class corresponding to the notification schema type. More...
 
class  notificationContentType
 Enumeration class corresponding to the notificationContentType schema type. More...
 
class  notificationEvent
 Class corresponding to the notificationEvent schema type. More...
 
class  notificationEventType
 Enumeration class corresponding to the notificationEventType schema type. More...
 
class  notificationURI
 Class corresponding to the notificationURI schema type. More...
 
class  notificationURI_base
 List class corresponding to the notificationURI_base schema type. More...
 
class  operation
 Enumeration class corresponding to the operation schema type. More...
 
class  operationMonitor
 Class corresponding to the operationMonitor schema type. More...
 
class  pendingNotification
 Enumeration class corresponding to the pendingNotification schema type. More...
 
class  permittedMediaTypes
 Enumeration class corresponding to the permittedMediaTypes schema type. More...
 
class  poaList
 Class corresponding to the poaList schema type. More...
 
class  poaList_base
 List class corresponding to the poaList_base schema type.
 
class  pollingChannel
 Class corresponding to the pollingChannel schema type. More...
 
class  regularResource
 Class corresponding to the regularResource schema type. More...
 
class  requestID
 Class corresponding to the requestID schema type. More...
 
class  resource
 Class corresponding to the resource schema type. More...
 
class  resourceName
 Class corresponding to the resourceName schema type. More...
 
class  resourceType
 Enumeration class corresponding to the resourceType schema type. More...
 
class  resourceTypeList
 Class corresponding to the resourceTypeList schema type. More...
 
class  resourceTypeList_base
 List class corresponding to the resourceTypeList_base schema type. More...
 
class  responseType
 Enumeration class corresponding to the responseType schema type. More...
 
class  responseTypeInfo
 Class corresponding to the responseTypeInfo schema type. More...
 
class  roleID
 Class corresponding to the roleID schema type. More...
 
class  scheduleEntries
 Class corresponding to the scheduleEntries schema type. More...
 
class  scheduleEntry
 Class corresponding to the scheduleEntry schema type. More...
 
class  serializations
 Class corresponding to the serializations schema type. More...
 
class  serializations_base
 List class corresponding to the serializations_base schema type. More...
 
class  serializationType
 Enumeration class corresponding to the serializationType schema type. More...
 
class  setOfAcrs
 Class corresponding to the setOfAcrs schema type. More...
 
class  sparql
 Class corresponding to the sparql schema type. More...
 
class  stdEventCats
 Enumeration class corresponding to the stdEventCats schema type. More...
 
class  subordinateResource
 Class corresponding to the subordinateResource schema type. More...
 
class  subscription
 Class corresponding to the subscription schema type. More...
 
class  supportedResourceType
 List class corresponding to the supportedResourceType schema type. More...
 
class  timestamp
 Class corresponding to the timestamp schema type. More...
 
class  tokenID
 Class corresponding to the tokenID schema type. More...
 
class  triggerRecipientID
 Class corresponding to the triggerRecipientID schema type. More...
 
class  typeOfContent
 Class corresponding to the typeOfContent schema type. More...
 
class  URIReference
 Class corresponding to the URIReference schema type. More...
 

Typedefs

typedef SimpleWeb::Server< SimpleWeb::HTTP > HttpServer
 
typedef std::function< onem2mResponseStatusCode(std::string, std::string &,::onem2m::notification *)> notificationCallbackFn
 

Enumerations

enum  onem2mAccesControlOperation : ::xml_schema::integer {
  accessControlCreate = 1, accessControlRetrieve = 2, accessControlUpdate = 4, accessControlDelete = 8,
  accessControlNotify = 16, accessControlDiscover = 32, accessControlAll = 63
}
 
enum  onem2mMotificationContentType : ::xml_schema::integer { nctAllAttributes = 1, nctModifiedAttributes, nctResourceId }
 
enum  onem2mNotificationEventType : ::xml_schema::integer {
  updateOfResource = 1, deleteOfResource, createOfDirectChildResource, deleteOfDirectChildResource,
  retrieveOfContainerResourceWithNoChildResource
}
 
enum  onem2mOperation : ::xml_schema::integer {
  operationCreate = 1, operationRetrieve, operationUpdate, operationDelete,
  operationNotify
}
 
enum  onem2mProtocol { protocolXml = 1, protocolJson }
 
enum  onem2mResourceType : ::xml_schema::integer {
  resourceTypeUnknown = 0, resourceTypeAccessControlPolicy, resourceTypeAE, resourceTypeContainer,
  resourceTypeContentInstance, resourceTypeCSEBase, resourceTypePollingChannel = 15, resourceTypeSubscription = 23,
  resourceTypeFlexContainerResource = 28, operationTypeNotification = 30500, objectTypeListOfURIs = 30501
}
 
enum  onem2mResponseStatusCode : long {
  rcACCEPTED = 1000, rcOK = 2000, rcCREATED = 2001, rcDELETED = 2002,
  rcUPDATED = 2004, rcBAD_REQUEST = 4000, rcNOT_FOUND = 4004 , rcREQUEST_TIMEOUT = 4008,
  rcSUBSCRIPTION_CREATOR_HAS_NO_PRIVILEGE = 4101, rcCONTENTS_UNACCEPTABLE = 4102, rcORIGINATOR_HAS_NO_PRIVILEGE = 4103, rcGROUP_REQUEST_IDENTIFIER_EXISTS = 4104,
  rcCONFLICT = 4105, rcORIGINATOR_HAS_NOT_REGISTERED = 4106, rcSECURITY_ASSOCIATION_REQUIRED = 4107, rcINVALID_CHILD_RESOURCE_TYPE = 4108,
  rcNO_MEMBERS = 4109, rcGROUP_MEMBER_TYPE_INCONSISTENT = 4110, rcESPRIM_UNSUPPORTED_OPTION = 4111, rcESPRIM_UNKNOWN_KEY_ID = 4112,
  rcGESPRIM_UNKNOWN_ORIG_RAND_ID = 4113, rcESPRIM_UNKNOWN_RECV_RAND_ID = 4114, rcGESPRIM_BAD_MAC = 4115, rcESPRIM_IMPERSONATION_ERROR = 4116,
  rcINTERNAL_SERVER_ERROR = 5000, rcNOT_IMPLEMENTED = 5001, rcTARGET_NOT_REACHABLE = 5103, rcRECEIVER_HAS_NO_PRIVILEGE = 5105,
  rcALREADY_EXISTS = 5106, rcTARGET_NOT_SUBSCRIBABLE = 5203, rcSUBSCRIPTION_VERIFICATION_INITIATION_FAILED = 5204, rcSUBSCRIPTION_HOST_HAS_NO_PRIVILEGE = 5205,
  rcNON_BLOCKING_REQUEST_NOT_SUPPORTED = 5206, rcNOT_ACCEPTABLE = 5207, rcDISCOVERY_DENIED_BY_IPE = 5208, rcGROUP_MEMBERS_NOT_RESPONDED = 5209,
  rcESPRIM_DECRYPTION_ERROR = 5210, rcESPRIM_ENCRYPTION_ERROR1 = 5211, rcESPRIM_ENCRYPTION_ERROR2 = 5212 , rcEXTERNAL_OBJECT_NOT_FOUND = 6005,
  rcMAX_NUMBER_OF_MEMBER_EXCEEDED = 6010, rcMGMT_SESSION_CANNOT_BE_ESTABLISHED = 6020, rcMGMT_SESSION_ESTABLISHMENT_TIMEOUT = 6021, rcINVALID_CMDTYPE = 6022,
  rcINVALID_ARGUMENTS = 6023, rcINSUFFICIENT_ARGUMENTS = 6024, rcMGMT_CONVERSION_ERROR = 6025, rcMGMT_CANCELLATION_FAILED = 6026,
  rcALREADY_COMPLETE = 6028, rcMGMT_COMMAND_NOT_CANCELLABLE = 6029
}
 
enum  onem2mResult : long {
  onem2mHttpCONTINUE = 100, onem2mHttpSWITCHING_PROTOCOLS = 101, onem2mHttpOK = 200, onem2mHttpCREATED = 201,
  onem2mHttpACCEPTED = 202, onem2mHttpNON_AUTHORITATIVE_INFORMATION = 203, onem2mHttpNO_CONTENT = 204 , onem2mHttpPARTIAL_CONTENT = 206,
  onem2mHttpMULTIPLE_CHOICES = 300 , onem2mHttpFOUND = 302, onem2mHttpSEE_OTHER = 303, onem2mHttpNOT_MODIFIED = 304,
  onem2mHttpUSE_PROXY = 305, onem2mHttpTEMPORARY_REDIRECT = 307, onem2mHttpBAD_REQUEST = 400, onem2mHttpUNAUTHORIZED = 401,
  onem2mHttpPAYMENT_REQUIRED = 402, onem2mHttpFORBIDDEN = 403, onem2mHttpNOT_FOUND = 404, onem2mHttpMETHOD_NOT_ALLOWED = 405,
  onem2mHttpNOT_ACCEPTABLE = 406, onem2mHttpPROXY_AUTHENTICATION_REQUIRED = 407, onem2mHttpREQUEST_TIMEOUT = 408, onem2mHttpCONFLICT = 409,
  onem2mHttpGONE = 410, onem2mHttpLENGTH_REQUIRED = 411, onem2mHttpPRECONDITION_FAILED = 412, onem2mHttpREQUEST_ENTITY_TOO_LARGE = 413,
  onem2mHttpREQUEST_URI_TOO_LONG = 414, onem2mHttpUNSUPPORTED_MEDIA_TYPE = 415, onem2mHttpREQUESTED_RANGE_NOT_SATISFIABLE = 416, onem2mHttpEXPECTATION_FAILED = 417,
  onem2mHttpUNPROCESSABLE_ENTITY = 422, onem2mHttpTOO_MANY_REQUESTS = 429, onem2mHttpINTERNAL_SERVER_ERROR = 500, onem2mHttpNOT_IMPLEMENTED = 501,
  onem2mHttpBAD_GATEWAY = 502, onem2mHttpSERVICE_UNAVAILABLE = 503, onem2mHttpGATEWAY_TIMEOUT = 504, onem2mHttpHTTP_VERSION_NOT_SUPPORTED = 505,
  onem2mCURLE_UNSUPPORTED_PROTOCOL = 1001, onem2mCURLE_FAILED_INIT , onem2mCURLE_NOT_BUILT_IN, onem2mCURLE_COULDNT_RESOLVE_PROXY,
  onem2mCURLE_COULDNT_RESOLVE_HOST, onem2mCURLE_COULDNT_CONNECT, onem2mCURLE_WEIRD_SERVER_REPLY, onem2mCURLE_REMOTE_ACCESS_DENIED,
  onem2mCURLE_FTP_ACCEPT_FAILED, onem2mCURLE_FTP_WEIRD_PASS_REPLY, onem2mCURLE_FTP_ACCEPT_TIMEOUT, onem2mCURLE_FTP_WEIRD_PASV_REPLY,
  onem2mCURLE_FTP_WEIRD_227_FORMAT, onem2mCURLE_FTP_CANT_GET_HOST, onem2mCURLE_HTTP2, onem2mCURLE_FTP_COULDNT_SET_TYPE,
  onem2mCURLE_PARTIAL_FILE, onem2mCURLE_FTP_COULDNT_RETR_FILE, onem2mCURLE_OBSOLETE20, onem2mCURLE_QUOTE_ERROR,
  onem2mCURLE_HTTP_RETURNED_ERROR, onem2mCURLE_WRITE_ERROR, onem2mCURLE_OBSOLETE24, onem2mCURLE_UPLOAD_FAILED,
  onem2mCURLE_READ_ERROR, onem2mCURLE_OUT_OF_MEMORY, onem2mCURLE_OPERATION_TIMEDOUT, onem2mCURLE_OBSOLETE29,
  onem2mCURLE_FTP_PORT_FAILED, onem2mCURLE_FTP_COULDNT_USE_REST, onem2mCURLE_OBSOLETE32, onem2mCURLE_RANGE_ERROR,
  onem2mCURLE_HTTP_POST_ERROR, onem2mCURLE_SSL_CONNECT_ERROR, onem2mCURLE_BAD_DOWNLOAD_RESUME, onem2mCURLE_FILE_COULDNT_READ_FILE,
  onem2mCURLE_LDAP_CANNOT_BIND, onem2mCURLE_LDAP_SEARCH_FAILED, onem2mCURLE_OBSOLETE40, onem2mCURLE_FUNCTION_NOT_FOUND,
  onem2mCURLE_ABORTED_BY_CALLBACK, onem2mCURLE_BAD_FUNCTION_ARGUMENT, onem2mCURLE_OBSOLETE44, onem2mCURLE_INTERFACE_FAILED,
  onem2mCURLE_OBSOLETE46, onem2mCURLE_TOO_MANY_REDIRECTS, onem2mCURLE_UNKNOWN_OPTION, onem2mCURLE_TELNET_OPTION_SYNTAX,
  onem2mCURLE_OBSOLETE50, onem2mCURLE_PEER_FAILED_VERIFICATION , onem2mCURLE_SSL_ENGINE_NOTFOUND, onem2mCURLE_SSL_ENGINE_SETFAILED,
  onem2mCURLE_SEND_ERROR, onem2mCURLE_RECV_ERROR, onem2mCURLE_OBSOLETE57 , onem2mCURLE_BAD_CONTENT_ENCODING,
  onem2mCURLE_LDAP_INVALID_URL, onem2mCURLE_FILESIZE_EXCEEDED, onem2mCURLE_USE_SSL_FAILED, onem2mCURLE_SEND_FAIL_REWIND,
  onem2mCURLE_SSL_ENGINE_INITFAILED, onem2mCURLE_LOGIN_DENIED, onem2mCURLE_TFTP_NOTFOUND, onem2mCURLE_TFTP_PERM,
  onem2mCURLE_REMOTE_DISK_FULL, onem2mCURLE_TFTP_ILLEGAL, onem2mCURLE_TFTP_UNKNOWNID, onem2mCURLE_REMOTE_FILE_EXISTS,
  onem2mCURLE_TFTP_NOSUCHUSER, onem2mCURLE_CONV_FAILED, onem2mCURLE_CONV_REQD, onem2mCURLE_SSL_CACERT_BADFILE,
  onem2mCURLE_REMOTE_FILE_NOT_FOUND, onem2mCURLE_SSH, onem2mCURLE_SSL_SHUTDOWN_FAILED, onem2mCURLE_AGAIN,
  onem2mCURLE_SSL_CRL_BADFILE, onem2mCURLE_SSL_ISSUER_ERROR, onem2mCURLE_FTP_PRET_FAILED, onem2mCURLE_RTSP_CSEQ_ERROR,
  onem2mCURLE_RTSP_SESSION_ERROR, onem2mCURLE_FTP_BAD_FILE_LIST, onem2mCURLE_CHUNK_FAILED, onem2mCURLE_NO_CONNECTION_AVAILABLE ,
  onem2mCURLE_HTTP2_STREAM, onem2mErrCantOpenServer = 2001, onem2mErrServerAlreadyRunning
}
 
enum  onem2mTransport { transportHttp = 1, transportHttpsCertificate, transportHttpsPsk }
 

Detailed Description

Public interface for functions and classes in the OS-IoT library.

C++ namespace for the http://www.onem2m.org/xml/protocols schema namespace.

Functions are used to perform oneM2M operations. Classes represent oneM2M resources and operations.

Typedef Documentation

typedef std::function<onem2mResponseStatusCode(std::string, std::string&, ::onem2m::notification*)> onem2m::notificationCallbackFn

Function template to be used if the application specifies a callback function to receive notifications.

Enumeration Type Documentation

Identifiers for accessControlOperations

Enumerator
accessControlCreate 

Create access control.

accessControlRetrieve 

Retrieve access control.

accessControlUpdate 

Update access control.

accessControlDelete 

Delete access control.

accessControlNotify 

Notify access control.

accessControlDiscover 

Discover access control.

accessControlAll 

All access control.

Identifiers for notificationContentType

Enumerator
nctAllAttributes 

All atributes.

nctModifiedAttributes 

Modified attributes.

nctResourceId 

Resource Id.

Identifers for notification event types

Identifiers for operations

Enumerator
operationCreate 

Create a resource.

operationRetrieve 

Retrieve a resource.

operationUpdate 

Update a resource.

operationDelete 

Delete a resource.

operationNotify 

Notify of a resource change.

Identifiers for protocols to used sending commands

Enumerator
protocolXml 

XML protocol.

protocolJson 

JSON protocol.

Identifiers for types of resource or operations in prototol

Enumerator
resourceTypeUnknown 

Unknown resource type or no resource type included.

operationTypeNotification 

Value used to designate a notification operation, which is not a resource.

objectTypeListOfURIs 

Valuse used to designate a listOfURIs object, which is not a resource.

Identifiers for responseStatusCodes

enum onem2m::onem2mResult : long

Identifiers for results and errors

HTTP responses take their normal values. Errors reported by libCURL are returned as 1000+ their native Curl values.

Identifiers for transports used sending comments

Enumerator
transportHttp 

HTTP transport.

transportHttpsCertificate 

HTTPS transport with certificate-based security.

transportHttpsPsk 

HTTPS transport with PSK security.

Function Documentation

std::unique_ptr<::xml_schema::type > onem2m::createResource ( const std::string &  address,
const std::string &  requestId,
::xml_schema::type resource,
long &  result,
::xml_schema::integer resObjType 
)

High level function to create a resource

Return type is unique_ptr< ::xml_schema::type > to permit any oneM2M object to be returned. The caller should check the resObjType and cast the return object to the appropriate type if it wishes to inspect its contents.

Note that if the resource is a flexContainer (e.g. a HAIM resource like deviceLight) then this procedure will populate the containerDefinition field of the passed resource to the appropriate value.

Parameters
addressaddress of resource
requestIdthe request ID to use
resourcereference to a pre-populated object of the resource to be created
resultused to return the HTTP result code
resObjTypeused to return the type of the object in the result
Returns
a one M2M object representing the body of the response (if present)
std::unique_ptr<::xml_schema::type > onem2m::deleteResource ( const std::string &  address,
const std::string &  requestId,
long &  result,
::xml_schema::integer resObjType 
)

High level function to delete a resource

Return type is unique_ptr< ::xml_schema::type > to permit any oneM2M object to be returned. The caller should check the resObjType and cast the return object to the appropriate type if it wishes to inspect its contents.

Parameters
addressaddress of resource
requestIdthe request ID to use
resultused to return the HTTP result code
resObjTypeused to return the type of the object in the result
Returns
a one M2M object representing the body of the response (if present)
std::string onem2m::getCaInfo ( )

Get the currently assigned value for the caInfo.

Returns
the assigned caInfo
std::string onem2m::getCaPath ( )

Get the currently assigned value for the caPath.

Returns
the assigned caPath
std::string onem2m::getCipherList ( )

Get the currently assigned value for the cipher list.

Returns
the assigned cipherList
std::string onem2m::getFrom ( )

Get the currently assigned value for the 'from' parameter.

Returns
the assigned 'from' string
bool onem2m::getHttpServerRunning ( )

Get if the HTTP server is running

This function will check if the HTTP server is running. If an HTTP server is expected to be running this function will confirm that the thread used for the server is still active.

Returns
true if the server is started and the thread is still active, false otherwise
std::string onem2m::getKeyPasswd ( )

Get the currently assigned value for the keyPasswd.

Returns
the assigned keyPasswd
size_t onem2m::getMaxAcceptSize ( )

Get the currently assigned value for the 'maxAcceptSize' parameter.

Returns
maxAcceptSize (in bytes)
onem2mProtocol onem2m::getProtocol ( )

Get the currently assigned protocol to be used for subsequent oneM2M signalling

std::string onem2m::getPskIdentity ( )

Get the currently assigned value for the PSK identity.

Returns
the assigned pskIdentity
std::string onem2m::getPskKey ( )

Get the currently assigned value for the PSK key.

Returns
the assigned pskKey
std::string onem2m::getSslCert ( )

Get the currently assigned value for the sslCert.

Returns
the assigned sslCert
std::string onem2m::getSslKey ( )

Get the currently assigned value for the sslKey.

Returns
the assigned sslKey
std::string onem2m::getSubjectAltNameAllowed ( )

Get the currently assigned value for the allowed subjectAltName.

Returns
the assigned allowed subjectAltName
onem2mTransport onem2m::getTransport ( )

Get the currently assigned transport to be used for subsequent oneM2M signalling

bool onem2m::getVerifyHost ( )

Get the currently assigned value for verifyHost.

Returns
the assigned verifyHost value
bool onem2m::getVerifyPeer ( )

Get the currently assigned value for verifyPeer.

Returns
the assigned verifyPeer value
void onem2m::initialize ( )

Initialize the OS-IoT Library

Call once before any other OS-IoT functions. Following the call to initialize the library parameters are set to the default values loaded from the file onem2mdefaults.hxx. After initialization, these default value may be overwritten by the calling application using other functions defined in the API.

std::unique_ptr<::xml_schema::type > onem2m::retrieveResource ( const std::string &  address,
const std::string &  requestId,
long &  result,
::xml_schema::integer resObjType 
)

High level function to retrieve a resource

Return type is unique_ptr< ::xml_schema::type > to permit any oneM2M object to be returned. The caller should check the resObjType and cast the return object to the appropriate type if it wishes to inspect its contents.

Parameters
addressaddress of resource
requestIdthe request ID to use
resultused to return the HTTP result code
resObjTypeused to return the type of the object in the result
Returns
a one M2M object representing the body of the response (if present)
void onem2m::setCaInfo ( const std::string  newCaInfo)

Set the CA certificate file.

Only applicable to the onem2mHttpsCertificate transport. Sets a string naming a PEM file holding one or more certificates to verify the peer with (see https://curl.haxx.se/libcurl/c/CURLOPT_CAINFO.html).

Parameters
newCaInfothe file path.
void onem2m::setCaPath ( const std::string  newCaPath)

Set the CA certificate directory.

Only applicable to the onem2mHttpsCertificate transport. Sets a string naming a directory holding multiple CA certificates to verify the peer with (see https://curl.haxx.se/libcurl/c/CURLOPT_CAPATH.html)

Parameters
newCaPaththe directory path.
void onem2m::setCipherList ( const std::string  newCipherList)

Set the list of ciphers to be used for an HTTPS connection.

Only applicable to the onem2mHttpsCertificate and onem2mHttpsPsk transports. The ciphers listed should be approprite to the transport security mode (certificate or PSK).

If PSK security is to be used this must be set to “PSK” or a list of PSK ciphers.

Assigning an empty string will mean that the default openSSL certificate based cipher list is used. Note that the ciphers must be supported in the available version of openSSL. See: https://curl.haxx.se/libcurl/c/CURLOPT_SSL_CIPHER_LIST.html

Note that mandatory cipher-suite for certificate security according to oneM2M TS-0003 is "ECDHE-ECDSA-AES128-SHA256". For PSK security it is "PSK-AES128-CBC-SHA256". Note that the cipher "PSK-AES128-CBC-SHA256" is only supported in openSSL from version 1.1.0 (Aug 2016).

Parameters
newCipherListthe cipher list
void onem2m::setDebug ( bool  debugOut)

Choose whether to generate 'debug' output to stdout

Parameters
debugOutcontrol debug out and 'pretty' formatting of messages
void onem2m::setFrom ( const std::string  newFrom)

Set the value to be used in the 'from' parameter.

Assigning an empty string will cause the 'from' field to be omitted. According to the oneM2M standard this is only permitted when creating an AE resource.

Parameters
newFromthe from string
void onem2m::setHostName ( const std::string  name)

Set the host name and port number for oneM2M signalling.

Host name may be DNS name, IPv4 address or IPv6 address written as a string. Port number should be appended after a colon. e.g. "127.0.0.1:8888"

Parameters
namethe host name
void onem2m::setKeyPasswd ( const std::string  newKeyPasswd)

Set the client certificate key password.

Only applicable to the onem2mHttpsCertificate transport. Sets a password to decode the SslKey file. Leave empty if no password is needed. (see https://curl.haxx.se/libcurl/c/CURLOPT_KEYPASSWD.html)

Parameters
newKeyPasswdthe password.
void onem2m::setMaxAcceptSize ( const size_t  newMaxAcceptSize)

Set the maximum size of requests or responses accepted by the client.

Parameters
newMaxAcceptSizemax size accepted (in bytes)
void onem2m::setProtocol ( const onem2mProtocol  p)

Sets the protocol to be used for subsequent oneM2M signalling to the value indicated by p

Parameters
pan integer representing the protocol to be used, e.g. onem2m::protocolJson
void onem2m::setPskIdentity ( const std::string  newPskIdentity)

Set the client PSK idenity.

Parameters
newPskIdentitythe PSK identity.
void onem2m::setPskKey ( const std::string  newPskKey)

Set the client PSK key.

The PSK key should be encoded as a hexidecimal string with no radix tag. e.g. "1a2b3c4d5e6f7a8b"

Parameters
newPskKeythe PSK key.
void onem2m::setSslCert ( const std::string  newSslCert)

Set the client certificate.

Only applicable to the onem2mHttpsCertificate transport. Sets a string naming a PEM file holding your client certificate. Leave blank to not provide a client certificate. (see https://curl.haxx.se/libcurl/c/CURLOPT_SSLCERT.html)

Parameters
newSslCertthe file path.
void onem2m::setSslKey ( const std::string  newSslKey)

Set the client certificate key.

Only applicable to the onem2mHttpsCertificate transport. Sets a string naming a PEM file holding the key of your client certificate. (see https://curl.haxx.se/libcurl/c/CURLOPT_SSLKEY.html)

Parameters
newSslKeythe file path.
void onem2m::setSubjectAltNameAllowed ( const std::string  newSubjectAltNameAllowed)

Set the identity of the CSE which is allowed in its certificates subjectAltName field.

Only applicable to the onem2mHttpsCertificate transport. Sets the DNS identity of the CSE which is allowed in its certificates subjectAltName field (e.g. mycse.myprovider.org) Leave empty if you do not wish to check the subjectAltName.

Parameters
newSubjectAltNameAllowedthe allowed subjectAltName.
void onem2m::setTransport ( const onem2mTransport  t)

Sets the transport to be used for subsequent oneM2M signalling to the value indicated by t

For secure transports, you should also configure the cipher list and security credentials appropriately after selecting the transport.

If the transport "transportHttpsPsk" is selected this procedure will additoinally set the cipherList to "PSK"

Parameters
tan integer representing the transport to be used, e.g. onem2m::transportHttp
void onem2m::setVerifyHost ( const bool  newVerificationSetting)

Set whether to verify peer names between the URL and the certificate.

Only applicable to the onem2mHttpsCertificate transport. If true then the library will check if the host name in the peer certificate matches the DNS name used to reach the host. If false, then this check is not made.

Parameters
newVerificationSettingsetting to use.
void onem2m::setVerifyPeer ( const bool  newVerificationSetting)

Set whether to verify peer certificates.

Only applicable to the onem2mHttpsCertificate transport. If true then peer certificates will be validated. If false then peer certificates will not be validated.

Parameters
newVerificationSettingsetting to use.
long onem2m::startHttpServer ( const std::vector< std::string > &  addressRegex,
long  port,
notificationCallbackFn  callback 
)

Start an HTTP server to receive notification requests

This function will start an HTTP server on the client. Currently, the only supported function of this server is to accept oneM2M notification requests delivered using a POST operation. Only one HTTP server may be run. Upon receipt of a notification the callback function will be called. This callback function should return a result to indicate the response to verification requests and any other type of notification needed by the application.

The server should be created before any Subscription resources as creating a Subscription resource may trigger a notification verification request. The calling application is responsible for setting the 'requestReachable' parameter for the AE to 'true' if it wishes the CSE to treat the AE as request reachable. The calling application is also responsible for informing the CSE of the address to receive notifications in the Subscription resource notificationURI parameter or in the AE resource pointOfAccess parameter.

The server is created in a separate thread for the main application so this function will return once the server is started. This function will block the main thread for 1 second to allow the server time to start.

The recommended approach is for the server to accept notifications any URL path on the relevant IP port (for compatibility with different CSEs and compiler behavior). To do this, it is recommended that the addressRegex parameter is an empty vector (std::vector< std::string >()) Alternatively, but not recommended, the paths from which notifications will be procssed can be specified by populating regex strings in the addressRegex parameter. Note that if a regex (other than an empty string) is specified then incorrect behavior may be experienced on GCC versions prior to 4.9.0 due to incomplete implementation of std::regex_match in the compiler.

Parameters
addressRegexis a vector of regex strings to match the URL path. It is recommended this contains a single empty string.
portis the IP port number to run the server.
callbackis the callback function to call when a notification is received.
Returns
an indication if the server has started successfully (onem2mHttpOK if successful)
void onem2m::stopHttpServer ( )

Stop the HTTP server if it is running

This function will stop the HTTP server if it is running and wait for the thread that the server was using to terminate. If the HTTP server was not running this function returns immediately.

void onem2m::terminate ( )

Close the OS-IoT Library

Call once after all OS-IoT functions have been completed.

std::unique_ptr<::xml_schema::type > onem2m::updateResource ( const std::string &  address,
const std::string &  requestId,
const ::xml_schema::type resource,
long &  result,
::xml_schema::integer resObjType 
)

High level function to update a resource

Return type is unique_ptr< ::xml_schema::type > to permit any oneM2M object to be returned. The caller should check the resObjType and cast the return object to the appropriate type if it wishes to inspect its contents.

Parameters
addressaddress of resource
requestIdthe request ID to use
resourcea pointer to a pre-populated object of the resource to be updated, or 0 if no resource to be included
resultused to return the HTTP result code
resObjTypeused to return the type of the object in the result
Returns
a one M2M object representing the body of the response (if present)
std::unique_ptr<::xml_schema::type > onem2m::updateResource ( const std::string &  address,
const std::string &  requestId,
const ::xml_schema::type resource,
long &  result,
::xml_schema::integer resObjType 
)

High level function to update a resource

Return type is unique_ptr< ::xml_schema::type > to permit any oneM2M object to be returned. The caller should check the resObjType and cast the return object to the appropriate type if it wishes to inspect its contents.

Parameters
addressaddress of resource
requestIdthe request ID to use
resourcea reference to a pre-populated object of the resource to be updated
resultused to return the HTTP result code
resObjTypeused to return the type of the object in the result
Returns
a one M2M object representing the body of the response (if present)