X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fconnectivity%2Finc%2Fcatcpinterface.h;h=201dd260825de438c203f2223123783688b58651;hb=3c093548382bb2542c87a67e6e5fa32552c29cb3;hp=8ece9634f9158e1472cb0f344fe236ffd6501a53;hpb=dda23e25e4747e25255bb2294e4f54144e57c5cc;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/connectivity/inc/catcpinterface.h b/resource/csdk/connectivity/inc/catcpinterface.h index 8ece963..201dd26 100644 --- a/resource/csdk/connectivity/inc/catcpinterface.h +++ b/resource/csdk/connectivity/inc/catcpinterface.h @@ -44,11 +44,12 @@ extern "C" * @param[in] endpoint network endpoint description. * @param[in] data Data received from remote OIC device. * @param[in] dataLength Length of data in bytes. + * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). * @pre Callback must be registered using CAIPSetPacketReceiveCallback(). */ -typedef void (*CATCPPacketReceivedCallback)(const CASecureEndpoint_t *endpoint, - const void *data, - size_t dataLength); +typedef CAResult_t (*CATCPPacketReceivedCallback)(const CASecureEndpoint_t *endpoint, + const void *data, + size_t dataLength); /** * Callback to notify error in the TCP adapter. @@ -67,9 +68,11 @@ typedef void (*CATCPErrorHandleCallback)(const CAEndpoint_t *endpoint, const voi * * @param[in] endpoint network endpoint description. * @param[in] isConnected Whether keepalive message needs to be sent. + * @param[in] isClient Host Mode of Operation. * @see Callback must be registered using CATCPSetKeepAliveCallback(). */ -typedef void (*CATCPConnectionHandleCallback)(const CAEndpoint_t *endpoint, bool isConnected); +typedef void (*CATCPConnectionHandleCallback)(const CAEndpoint_t *endpoint, bool isConnected, + bool isClient); /** * set error callback to notify error in TCP adapter. @@ -241,6 +244,48 @@ CAResult_t CASearchAndDeleteTCPSession(const CAEndpoint_t *endpoint); */ size_t CACheckPayloadLengthFromHeader(const void *data, size_t dlen); +/** + * Construct CoAP header and payload from buffer + * + * @param[in] svritem - used socket, buffer, current received message length and protocol + * @param[in/out] data - data buffer, this value is updated as data is copied to svritem + * @param[in/out] dataLength - length of data, this value decreased as data is copied to svritem + * @return - CA_STATUS_OK or appropriate error code + */ +CAResult_t CAConstructCoAP(CATCPSessionInfo_t *svritem, unsigned char **data, + size_t *dataLength); + +/** + * Clean socket state data + * + * @param[in/out] svritem - socket state data + */ +void CACleanData(CATCPSessionInfo_t *svritem); + +/** + * Create a mutex object. + * + * @return ::CA_STATUS_OK or Appropriate error code. + */ +CAResult_t CATCPCreateMutex(); + +/** + * Close a mutex object. + */ +void CATCPDestroyMutex(); + +/** + * Initialize a condition variable. + * + * @return ::CA_STATUS_OK or Appropriate error code. + */ +CAResult_t CATCPCreateCond(); + +/** + * Destroy condition variable state. + */ +void CATCPDestroyCond(); + #ifdef __cplusplus } #endif