/** The coap scheme */
#define OC_COAP_SCHEME "coap://"
-/** the first outgoing sequence number will be 5*/
-#define OC_OFFSET_SEQUENCE_NUMBER (4)
+/** the first outgoing sequence number will be 1*/
+#define OC_OFFSET_SEQUENCE_NUMBER (0)
/**
* This structure will be created in occoap and passed up the stack on the server side.
} OCServerProtocolRequest;
/**
- * This structure will be created in occoap and passed up the stack on the client side.
- */
-typedef struct
-{
- /** handle is retrieved by comparing the token-handle pair in the PDU.*/
- ClientCB * cbNode;
-
- /** This is how long this response is valid for (in seconds).*/
- uint32_t maxAge;
-
- /** This is the Uri of the resource. (ex. "coap://192.168.1.1/a/led").*/
- char * fullUri;
-
- /** This is the relative Uri of the resource. (ex. "/a/led").*/
- char * rcvdUri;
-
- /** This is the received payload.*/
- char * bufRes;
-
- /** This is the token received OTA.*/
- CAToken_t rcvdToken;
-
- /** this structure will be passed to client.*/
- OCClientResponse * clientResponse;
-} OCResponse;
-
-/**
* This typedef is to represent our Server Instance identification.
*/
typedef uint8_t ServerID[16];
OCStackResult SendDirectStackResponse(const CAEndpoint_t* endPoint, const uint16_t coapID,
const CAResponseResult_t responseResult, const CAMessageType_t type,
const uint8_t numOptions, const CAHeaderOption_t *options,
- CAToken_t token, uint8_t tokenLength, const char *resourceUri);
+ CAToken_t token, uint8_t tokenLength, const char *resourceUri,
+ CADataType_t dataType);
#ifdef WITH_PRESENCE
OCStackResult BindResourceTypeToResource(OCResource* resource,
const char *resourceTypeName);
+/**
+ * Convert OCStackResult to CAResponseResult_t.
+ *
+ * @param ocCode OCStackResult code.
+ * @param method OCMethod method the return code replies to.
+ * @return ::CA_CONTENT on OK, some other value upon failure.
+ */
+CAResponseResult_t OCToCAStackResult(OCStackResult ocCode, OCMethod method);
/**
* Converts a CAResult_t type to a OCStackResult type.
OCStackResult CAResultToOCResult(CAResult_t caResult);
/**
- * Get a byte representation of the server instance ID.
- * The memory is managed internal to this function, so freeing it externally will
- * result in a runtime error.
+ * Converts a OCStackResult type to a bool type.
*
- * Note: This will NOT seed the RNG, so it must be called after the RNG is seeded.
- * This is done automatically during the OCInit process,
- * so ensure that this call is done after that.
- *
- * @return A uint8_t representation the server instance ID.
- */
-const OicUuid_t* OCGetServerInstanceID(void);
-
-/**
- * Get a string representation the server instance ID.
- * The memory is managed internal to this function, so freeing externally will result
- * in a runtime error.
- * Note: This will NOT seed the RNG, so it must be called after the RNG is seeded.
- * This is done automatically during the OCInit process,
- * so ensure that this call is done after that.
- *
- * @return A string representation the server instance ID.
+ * @param ocResult OCStackResult value to convert.
+ * @return true on success, false upon failure.
*/
-const char* OCGetServerInstanceIDString(void);
+bool OCResultToSuccess(OCStackResult ocResult);
/**
* Map OCQualityOfService to CAMessageType.
OCPresenceTrigger convertTriggerStringToEnum(const char * triggerStr);
+OCStackResult encodeAddressForRFC6874(char * outputAddress,
+ size_t outputSize,
+ const char * inputAddress);
+
void CopyEndpointToDevAddr(const CAEndpoint_t *in, OCDevAddr *out);
void CopyDevAddrToEndpoint(const OCDevAddr *in, CAEndpoint_t *out);
#endif // __cplusplus
#endif /* OCSTACKINTERNAL_H_ */
-