Merge branch 'master' into cloud-interface
[platform/upstream/iotivity.git] / resource / csdk / stack / include / internal / ocstackinternal.h
index 224f456..241f588 100644 (file)
 #include "ocstack.h"
 #include "ocstackconfig.h"
 #include "occlientcb.h"
-#include <logger.h>
 #include <ocrandom.h>
 
 #include "cacommon.h"
 #include "cainterface.h"
+#include "securevirtualresourcetypes.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -66,8 +66,8 @@ extern void* defaultDeviceHandlerCallbackParameter;
 /** 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 2*/
+#define OC_OFFSET_SEQUENCE_NUMBER (1)
 
 /**
  * This structure will be created in occoap and passed up the stack on the server side.
@@ -80,6 +80,9 @@ typedef struct
     /** The REST method retrieved from received request PDU.*/
     OCMethod method;
 
+    /** the requested payload format. */
+    OCPayloadFormat acceptFormat;
+
     /** resourceUrl will be filled in occoap using the path options in received request PDU.*/
     char resourceUrl[MAX_URI_LENGTH];
 
@@ -87,7 +90,7 @@ typedef struct
     char query[MAX_QUERY_LENGTH];
 
     /** reqJSON is retrieved from the payload of the received request PDU.*/
-    uint8_t payload[MAX_REQUEST_LENGTH];
+    uint8_t *payload;
 
     /** qos is indicating if the request is CON or NON.*/
     OCQualityOfService qos;
@@ -199,7 +202,7 @@ OCStackResult HandleStackRequests(OCServerProtocolRequest * protocolRequest);
 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);
+        CAToken_t token, uint8_t tokenLength, const char *resourceUri);
 
 #ifdef WITH_PRESENCE
 
@@ -263,29 +266,12 @@ OCStackResult BindResourceTypeToResource(OCResource* resource,
 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.
- *
- * 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 uint8_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.
+ * Converts a OCStackResult type to a bool type.
  *
- * @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.
@@ -311,9 +297,9 @@ OCStackResult OCChangeResourceProperty(OCResourceProperty * inputProperty,
         OCResourceProperty resourceProperties, uint8_t enable);
 #endif
 
-const char *convertTriggerEnumToString(OCPresenceTrigger trigger);
+OC_EXPORT const char *convertTriggerEnumToString(OCPresenceTrigger trigger);
 
-OCPresenceTrigger convertTriggerStringToEnum(const char * triggerStr);
+OC_EXPORT OCPresenceTrigger convertTriggerStringToEnum(const char * triggerStr);
 
 void CopyEndpointToDevAddr(const CAEndpoint_t *in, OCDevAddr *out);
 
@@ -324,4 +310,3 @@ void CopyDevAddrToEndpoint(const OCDevAddr *in, CAEndpoint_t *out);
 #endif // __cplusplus
 
 #endif /* OCSTACKINTERNAL_H_ */
-