/** Resource Type.*/
#define OC_RSRVD_RESOURCE_TYPES_URI "/oic/res/types/d"
-#if defined (ROUTING_GATEWAY) || defined (ROUTING_EP)
+
/** Gateway URI.*/
#define OC_RSRVD_GATEWAY_URI "/oic/gateway"
-#endif
-#ifdef WITH_PRESENCE
+
+/** MQ Broker URI.*/
+#define OC_RSRVD_WELL_KNOWN_MQ_URI "/oic/ps"
+
+
+/** Presence */
/** Presence URI through which the OIC devices advertise their presence.*/
#define OC_RSRVD_PRESENCE_URI "/oic/ad"
+/** Presence URI through which the OIC devices advertise their device presence.*/
+#define OC_RSRVD_DEVICE_PRESENCE_URI "/oic/prs"
+
/** Sets the default time to live (TTL) for presence.*/
-#define OC_DEFAULT_PRESENCE_TTL_SECONDS (60)
+#define OC_DEFAULT_PRESENCE_TTL_SECONDS (60)
/** For multicast Discovery mechanism.*/
-#define OC_MULTICAST_DISCOVERY_URI "/oic/res"
+#define OC_MULTICAST_DISCOVERY_URI "/oic/res"
/** Separator for multiple query string.*/
-#define OC_QUERY_SEPARATOR "&;"
+#define OC_QUERY_SEPARATOR "&;"
/**
* OC_DEFAULT_PRESENCE_TTL_SECONDS sets the default time to live (TTL) for presence.
* 60 sec/min * 60 min/hr * 24 hr/day
*/
#define OC_MAX_PRESENCE_TTL_SECONDS (60 * 60 * 24)
-#endif
+
/**
* Presence "Announcement Triggers".
#define OC_RSRVD_OC "oic"
+
/** For payload. */
#define OC_RSRVD_PAYLOAD "payload"
#define OC_RSRVD_RESOURCE_TYPE_PLATFORM "oic.wk.p"
/** To represent resource type with RES.*/
-#define OC_RSRVD_RESOURCE_TYPE_RES "oic.wk.res"
+#define OC_RSRVD_RESOURCE_TYPE_RES "oic.wk.res"
+
+/** To represent content type with MQ Broker.*/
+#define OC_RSRVD_RESOURCE_TYPE_MQ_BROKER "oic.wk.ps"
+
+/** To represent content type with MQ Topic.*/
+#define OC_RSRVD_RESOURCE_TYPE_MQ_TOPIC "oic.wk.ps.topic"
+
/** To represent interface.*/
#define OC_RSRVD_INTERFACE "if"
+/** To indicate how long RD should publish this item.*/
+#define OC_RSRVD_DEVICE_TTL "lt"
+
/** To represent time to live.*/
#define OC_RSRVD_TTL "ttl"
#define OC_RSRVD_HOSTING_PORT "port"
/** TCP Port. */
-#define OC_RSRVD_TCP_PORT "tcp"
+#define OC_RSRVD_TCP_PORT "x.org.iotivity.tcp"
/** For Server instance ID.*/
#define OC_RSRVD_SERVER_INSTANCE_ID "sid"
#define OC_RSRVD_SUPPORT_URL "mnsl"
/** System time for the platform. */
-#define OC_RSRVD_SYSTEM_TIME "st"
+#define OC_RSRVD_SYSTEM_TIME "st"
/**
* Device.
#define OC_RSRVD_DATA_MODEL_VERSION "dmv"
/** Device specification version.*/
-#define OC_SPEC_VERSION "core.1.0.0"
+#define OC_SPEC_VERSION "core.1.0.0"
/** Device Data Model version.*/
-#define OC_DATA_MODEL_VERSION "res.1.0.0"
+#define OC_DATA_MODEL_VERSION "res.1.0.0"
/**
* These provide backward compatibility - their use is deprecated.
#ifndef GOING_AWAY
/** Multicast Prefix.*/
-#define OC_MULTICAST_PREFIX "224.0.1.187:5683"
+#define OC_MULTICAST_PREFIX "224.0.1.187:5683"
/** Multicast IP address.*/
-#define OC_MULTICAST_IP "224.0.1.187"
+#define OC_MULTICAST_IP "224.0.1.187"
/** Multicast Port.*/
-#define OC_MULTICAST_PORT 5683
+#define OC_MULTICAST_PORT (5683)
#endif // GOING_AWAY
/** Max Device address size. */
#ifdef RA_ADAPTER
#define MAX_ADDR_STR_SIZE (256)
#else
-/** Max Address could be "coap+tcp://[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:xxxxx" */
-#define MAX_ADDR_STR_SIZE (59)
+/** Max Address could be
+ * "coaps+tcp://[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:yyy.yyy.yyy.yyy]:xxxxx"
+ * +1 for null terminator.
+ */
+#define MAX_ADDR_STR_SIZE (66)
#endif
/** Length of MAC address */
#define MAC_ADDR_BLOCKS (6)
/** Max identity size. */
-#define MAX_IDENTITY_SIZE (32)
+#define MAX_IDENTITY_SIZE (37)
/** Universal unique identity size. */
#define UUID_IDENTITY_SIZE (128/8)
#define OC_RSRVD_TITLE "title"
/** Defines URI. */
-#define OC_RSRVD_URI "uri"
+#define OC_RSRVD_URI "anchor"
/** Defines media type. */
-#define OC_RSRVD_MEDIA_TYPE "mt"
+#define OC_RSRVD_MEDIA_TYPE "type"
/** To represent resource type with Publish RD.*/
#define OC_RSRVD_RESOURCE_TYPE_RDPUBLISH "oic.wk.rdpub"
+/** Cloud Account */
+
+/** Account URI.*/
+#define OC_RSRVD_ACCOUNT_URI "/oic/account"
+
+/** Account session URI.*/
+#define OC_RSRVD_ACCOUNT_SESSION_URI "/oic/account/session"
+
+/** Account token refresh URI.*/
+#define OC_RSRVD_ACCOUNT_TOKEN_REFRESH_URI "/oic/account/tokenrefresh"
+
+/** ACL group URI.*/
+#define OC_RSRVD_ACL_GROUP_URI "/oic/acl/group"
+
+/** ACL invite URI.*/
+#define OC_RSRVD_ACL_INVITE_URI "/oic/acl/invite"
+
+/** Defines auth provider. */
+#define OC_RSRVD_AUTHPROVIDER "authprovider"
+
+/** Defines auth code. */
+#define OC_RSRVD_AUTHCODE "authcode"
+
+/** Defines access token. */
+#define OC_RSRVD_ACCESS_TOKEN "accesstoken"
+
+/** Defines login. */
+#define OC_RSRVD_LOGIN "login"
+
+/** Defines search. */
+#define OC_RSRVD_SEARCH "search"
+
+/** Defines grant type. */
+#define OC_RSRVD_GRANT_TYPE "granttype"
+
+/** Defines refresh token. */
+#define OC_RSRVD_REFRESH_TOKEN "refreshtoken"
+
+/** Defines user UUID. */
+#define OC_RSRVD_USER_UUID "uid"
+
+/** Defines user ID. */
+#define OC_RSRVD_USER_ID "userid"
+
+/** Defines group ID. */
+#define OC_RSRVD_GROUP_ID "gid"
+
+/** Defines group Master ID. */
+#define OC_RSRVD_GROUP_MASTER_ID "gmid"
+
+/** Defines group type. */
+#define OC_RSRVD_GROUP_TYPE "gtype"
+
+/** Defines member of group ID. */
+#define OC_RSRVD_MEMBER_ID "mid"
+
+/** Defines device ID list. */
+#define OC_RSRVD_DEVICE_ID_LIST "dilist"
+
+/** Defines public. */
+#define OC_RSRVD_PUBLIC "Public"
+
+/** Defines private. */
+#define OC_RSRVD_PRIVATE "Private"
+
+/** Defines options. */
+#define OC_RSRVD_INVITE "invite"
+
+/** Defines options. */
+#define OC_RSRVD_OPTIONS "options"
+
+/** To represent grant type with refresh token. */
+#define OC_RSRVD_GRANT_TYPE_REFRESH_TOKEN "refresh_token"
+
/**
* Mark a parameter as unused. Used to prevent unused variable compiler warnings.
* Used in three cases:
/** IP & TCP adapter only.*/
OC_IP_USE_V4 = (1 << 6),
- /** internal use only.*/
- OC_RESERVED1 = (1 << 7), // internal use only
+ /** Multicast only.*/
+ OC_MULTICAST = (1 << 7),
/** Link-Local multicast is the default multicast scope for IPv6.
* These are placed here to correspond to the IPv6 multicast address bits.*/
char addr[MAX_ADDR_STR_SIZE];
/** usually zero for default interface.*/
- uint32_t interface;
+ uint32_t ifindex;
#if defined (ROUTING_GATEWAY) || defined (ROUTING_EP)
char routeData[MAX_ADDR_STR_SIZE]; //destination GatewayID:ClientId
#endif
* processing its requests from clients.*/
OC_SLOW = (1 << 3),
+#ifdef __WITH_DTLS__
/** When this bit is set, the resource is a secure resource.*/
OC_SECURE = (1 << 4),
+#else
+ OC_SECURE = (0),
+#endif
/** When this bit is set, the resource is allowed to be discovered only
* if discovery request contains an explicit querystring.
* Ex: GET /oic/res?rt=oic.sec.acl */
OC_EXPLICIT_DISCOVERABLE = (1 << 5)
+
+#ifdef WITH_MQ
+ /** When this bit is set, the resource is allowed to be published */
+ ,OC_MQ_PUBLISHER = (1 << 6)
+#endif
+
+#ifdef MQ_BROKER
+ /** When this bit is set, the resource is allowed to be notified as MQ broker.*/
+ ,OC_MQ_BROKER = (1 << 7)
+#endif
} OCResourceProperty;
/**
OC_STACK_RESOURCE_CREATED,
OC_STACK_RESOURCE_DELETED,
OC_STACK_CONTINUE,
+ OC_STACK_RESOURCE_CHANGED,
/** Success status code - END HERE.*/
/** Error status code - START HERE.*/
OC_OBSERVE_DEREGISTER = 1,
/** Others. */
- OC_OBSERVE_NO_OPTION = 2
+ OC_OBSERVE_NO_OPTION = 2,
+
} OCObserveAction;
{
OC_EH_OK = 0,
OC_EH_ERROR,
- OC_EH_RESOURCE_CREATED,
- OC_EH_RESOURCE_DELETED,
- OC_EH_SLOW,
- OC_EH_FORBIDDEN,
- OC_EH_RESOURCE_NOT_FOUND
+ OC_EH_RESOURCE_CREATED, // 2.01
+ OC_EH_RESOURCE_DELETED, // 2.02
+ OC_EH_SLOW, // 2.05
+ OC_EH_FORBIDDEN, // 4.03
+ OC_EH_RESOURCE_NOT_FOUND, // 4.04
+ OC_EH_VALID, // 2.03
+ OC_EH_CHANGED, // 2.04
+ OC_EH_CONTENT, // 2.05
+ OC_EH_BAD_REQ, // 4.00
+ OC_EH_UNAUTHORIZED_REQ, // 4.01
+ OC_EH_BAD_OPT, // 4.02
+ OC_EH_METHOD_NOT_ALLOWED, // 4.05
+ OC_EH_NOT_ACCEPTABLE, // 4.06
+ OC_EH_INTERNAL_SERVER_ERROR, // 5.00
+ OC_EH_RETRANSMIT_TIMEOUT // 5.04
} OCEntityHandlerResult;
/**
OCStringLL *types;
/** Pointer to the device specification version.*/
char *specVersion;
- /** Pointer to the device data model version.*/
- char *dataModelVersion;
+ /** Pointer to the device data model versions (in CSV format).*/
+ OCStringLL *dataModelVersions;
} OCDeviceInfo;
#ifdef RA_ADAPTER
{
/** This is the target relative URI. */
char *href;
+ /** The relation of the target URI referenced by the link to the context URI;
+ * The default value is null. */
+ char *rel;
/** Resource Type - A standard OIC specified or vendor defined resource
* type of the resource referenced by the target URI. */
OCStringLL *rt;
/** Interface - The interfaces supported by the resource referenced by the target URI. */
OCStringLL *itf;
- /** The relation of the target URI referenced by the link to the context URI;
- * The default value is null. */
- char *rel;
- /** Specifies if the resource referenced by the target URIis observable or not. */
- bool obs;
+ /** Bitmap - The bitmap holds observable, discoverable, secure option flag. */
+ uint8_t p;
/** A title for the link relation. Can be used by the UI to provide a context. */
char *title;
/** This is used to override the context URI e.g. override the URI of the containing collection. */
- char *uri;
+ char *anchor;
/** The instance identifier for this web link in an array of web links - used in links. */
union
{
/** Use UUID for universal uniqueness - used in /oic/res to identify the device. */
OCIdentity uniqueUUID;
};
+ /** Time to keep holding resource.*/
+ uint64_t ttl;
/** A hint of the media type of the representation of the resource referenced by the target URI. */
- OCStringLL *mt;
+ OCStringLL *type;
/** Holding address of the next resource. */
struct OCLinksPayload *next;
} OCLinksPayload;
OCDeviceInfo n;
/** Device identifier. */
OCIdentity di;
- /** The base URI where the resources are hold. */
- char *baseURI;
- /** Bitmap holds observable, discoverable, secure option flag.*/
- uint8_t bitmap;
- /** Port set in case, the secure flag is set above. */
- uint16_t port;
- /** Id for each set of links i.e. tag. */
- union
- {
- /** An ordinal number that is not repeated - must be unique in the collection context. */
- uint8_t ins;
- /** Any unique string including a URI. */
- char *uniqueStr;
- /** Use UUID for universal uniqueness - used in /oic/res to identify the device. */
- OCIdentity uniqueUUID;
- };
- /** Defines the list of allowable resource types (for Target and anchors) in links included
- * in the collection; new links being created can only be from this list. */
- char *rts;
- /** When specified this is the default relationship to use when an OIC Link does not specify
- * an explicit relationship with *rel* parameter. */
- char *drel;
/** Time to keep holding resource.*/
- uint32_t ttl;
+ uint64_t ttl;
} OCTagsPayload;
/** Resource collection payload. */
OCTagsPayload *tags;
/** Array of links payload. */
OCLinksPayload *setLinks;
- /** Holding address of the next resource. */
- struct OCResourceCollectionPayload *next;
} OCResourceCollectionPayload;
-typedef struct
+typedef struct OCDiscoveryPayload
{
OCPayload base;
char *uri;
/** Resource Type */
- char *type;
+ OCStringLL *type;
/** Interface */
- OCStringLL *interface;
+ OCStringLL *iface;
/** This structure holds the old /oic/res response. */
OCResourcePayload *resources;
+ /** Holding address of the next DiscoveryPayload. */
+ struct OCDiscoveryPayload *next;
+
} OCDiscoveryPayload;
/**
char *sid;
char* deviceName;
char* specVersion;
- char* dataModelVersion;
+ OCStringLL *dataModelVersions;
OCStringLL *interfaces;
OCStringLL *types;
} OCDevicePayload;
/** Pointer to the array of the received vendor specific header options.*/
OCHeaderOption * rcvdVendorSpecificHeaderOptions;
+ /** Message id.*/
+ uint16_t messageID;
+
/** the payload from the request PDU.*/
OCPayload *payload;
/**
* Application server implementations must implement this callback to consume requests OTA.
* Entity handler callback needs to fill the resPayload of the entityHandlerRequest.
+ *
+ * When you set specific return value like OC_EH_CHANGED, OC_EH_CONTENT,
+ * OC_EH_SLOW and etc in entity handler callback,
+ * ocstack will be not send response automatically to client
+ * except for error return value like OC_EH_ERROR.
+ *
+ * If you want to send response to client with specific result,
+ * OCDoResponse API should be called with the result value.
+ *
+ * e.g)
+ *
+ * OCEntityHandlerResponse response;
+ *
+ * ..
+ *
+ * response.ehResult = OC_EH_CHANGED;
+ *
+ * ..
+ *
+ * OCDoResponse(&response)
+ *
+ * ..
+ *
+ * return OC_EH_OK;
*/
typedef OCEntityHandlerResult (*OCEntityHandler)
(OCEntityHandlerFlag flag, OCEntityHandlerRequest * entityHandlerRequest, void* callbackParam);
/**
* Device Entity handler need to use this call back instead of OCEntityHandler.
+ *
+ * When you set specific return value like OC_EH_CHANGED, OC_EH_CONTENT,
+ * OC_EH_SLOW and etc in entity handler callback,
+ * ocstack will be not send response automatically to client
+ * except for error return value like OC_EH_ERROR.
+ *
+ * If you want to send response to client with specific result,
+ * OCDoResponse API should be called with the result value.
+ *
+ * e.g)
+ *
+ * OCEntityHandlerResponse response;
+ *
+ * ..
+ *
+ * response.ehResult = OC_EH_CHANGED;
+ *
+ * ..
+ *
+ * OCDoResponse(&response)
+ *
+ * ..
+ *
+ * return OC_EH_OK;
*/
typedef OCEntityHandlerResult (*OCDeviceEntityHandler)
(OCEntityHandlerFlag flag, OCEntityHandlerRequest * entityHandlerRequest, char* uri, void* callbackParam);