X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Finclude%2FOCApi.h;h=493012aecb18254eb7bbb9086a553fa8502f32e9;hb=37544f38dedd2bc679968ec70da20357608b8504;hp=0af7727580e58ed8b0ef7d00a207d2652e633c76;hpb=8aef8174a0af1e70f0952bf08bb9df5f14864b82;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/include/OCApi.h b/resource/include/OCApi.h index 0af7727..493012a 100644 --- a/resource/include/OCApi.h +++ b/resource/include/OCApi.h @@ -59,7 +59,7 @@ namespace OC /* We'll want to provide some sort of explicit hook for custom logging at some point; until then, this should do nicely (note that since these are lambdas, later a special target could be captured, allowing much flexibility): */ - auto oclog_target = []() -> log_target_t& + inline auto oclog_target = []() -> log_target_t& { static OC::oc_log_stream ols(oc_make_ostream_logger); static log_target_t os(ols); @@ -68,7 +68,7 @@ namespace OC }; } // namespace OC::detail - auto oclog = []() -> boost::iostreams::stream& + inline auto oclog = []() -> boost::iostreams::stream& { return detail::oclog_target(); }; @@ -126,7 +126,9 @@ namespace OC HighQos = OC_HIGH_QOS, /** No Quality is defined, let the stack decide. */ - NaQos = OC_NA_QOS + NaQos = OC_NA_QOS, + + LowQosWithTcp = OC_LOW_QOS_WITH_TCP }; /** @@ -146,6 +148,9 @@ namespace OC /** default flags for client. */ OCConnectivityType clientConnectivity; + /** transport type to initialize. */ + OCTransportAdapter transportType; + /** not used. */ std::string ipAddress; @@ -158,31 +163,52 @@ namespace OC /** persistant storage Handler structure (open/read/write/close/unlink). */ OCPersistentStorage *ps; + /** persistant storage Handler structure (open/read/write/close/unlink). */ + OCPersistentStorage *psEnc; + + /** persistant storage Handler structure (open/read/write/close/unlink). */ + OCPersistentStorage *psRescue; + + /** pointer to save key. */ + unsigned char* key; + public: PlatformConfig() : serviceType(ServiceType::InProc), mode(ModeType::Both), serverConnectivity(CT_DEFAULT), clientConnectivity(CT_DEFAULT), + transportType(OC_DEFAULT_ADAPTER), ipAddress("0.0.0.0"), port(0), - QoS(QualityOfService::NaQos), - ps(nullptr) + QoS(QualityOfService::NaQos), + ps(nullptr), + psEnc(nullptr), + psRescue(nullptr), + key(nullptr) {} PlatformConfig(const ServiceType serviceType_, const ModeType mode_, OCConnectivityType serverConnectivity_, OCConnectivityType clientConnectivity_, const QualityOfService QoS_, - OCPersistentStorage *ps_ = nullptr) + OCPersistentStorage *ps_ = nullptr, + OCPersistentStorage *psEnc_ = nullptr, + OCPersistentStorage *psRescue_ = nullptr, + unsigned char *key_ = nullptr) : serviceType(serviceType_), mode(mode_), serverConnectivity(serverConnectivity_), clientConnectivity(clientConnectivity_), + transportType(OC_DEFAULT_ADAPTER), ipAddress(""), port(0), - QoS(QoS_), - ps(ps_) + QoS(QoS_), + ps(ps_), + psEnc(psEnc_), + psRescue(psRescue_), + key(key_) + {} // for backward compatibility PlatformConfig(const ServiceType serviceType_, @@ -190,16 +216,92 @@ namespace OC const std::string& ipAddress_, const uint16_t port_, const QualityOfService QoS_, - OCPersistentStorage *ps_ = nullptr) + OCPersistentStorage *ps_ = nullptr, + OCPersistentStorage *psEnc_ = nullptr, + OCPersistentStorage *psRescue_ = nullptr, + unsigned char *key_ = nullptr) : serviceType(serviceType_), mode(mode_), serverConnectivity(CT_DEFAULT), clientConnectivity(CT_DEFAULT), + transportType(OC_DEFAULT_ADAPTER), + ipAddress(ipAddress_), + port(port_), + QoS(QoS_), + ps(ps_), + psEnc(psEnc_), + psRescue(psRescue_), + key(key_) + + {} + + PlatformConfig(const ServiceType serviceType_, + const ModeType mode_, + const std::string& ipAddress_, + const uint16_t port_, + const OCTransportAdapter transportType_, + const QualityOfService QoS_, + unsigned char *key_, + OCPersistentStorage *ps_ = nullptr, + OCPersistentStorage *psEnc_ = nullptr, + OCPersistentStorage *psRescue_ = nullptr) + : serviceType(serviceType_), + mode(mode_), + transportType(transportType_), ipAddress(ipAddress_), port(port_), + QoS(QoS_), + ps(ps_), + psEnc(psEnc_), + psRescue(psRescue_), + key(key_) + {} + + PlatformConfig(const ServiceType serviceType_, + const ModeType mode_, + OCTransportAdapter transportType_, + const QualityOfService QoS_, + OCPersistentStorage *ps_ = nullptr, + OCPersistentStorage *psEnc_ = nullptr, + OCPersistentStorage *psRescue_ = nullptr, + unsigned char *key_ = nullptr) + : serviceType(serviceType_), + mode(mode_), + serverConnectivity(CT_DEFAULT), + clientConnectivity(CT_DEFAULT), + transportType(transportType_), + ipAddress(""), + port(0), QoS(QoS_), - ps(ps_) + ps(ps_), + psEnc(psEnc_), + psRescue(psRescue_), + key(key_) {} + PlatformConfig(const ServiceType serviceType_, + const ModeType mode_, + OCConnectivityType serverConnectivity_, + OCConnectivityType clientConnectivity_, + OCTransportAdapter transportType_, + const QualityOfService QoS_, + OCPersistentStorage *ps_ = nullptr, + OCPersistentStorage *psEnc_ = nullptr, + OCPersistentStorage *psRescue_ = nullptr, + unsigned char *key_ = nullptr) + : serviceType(serviceType_), + mode(mode_), + serverConnectivity(serverConnectivity_), + clientConnectivity(clientConnectivity_), + transportType(transportType_), + ipAddress(""), + port(0), + QoS(QoS_), + ps(ps_), + psEnc(psEnc_), + psRescue(psRescue_), + key(key_) + {} + }; enum RequestHandlerFlag @@ -269,6 +371,8 @@ namespace OC typedef std::function FindErrorCallback; + typedef std::function>)> FindResListCallback; + typedef std::function FindDeviceCallback; typedef std::function FindPlatformCallback; @@ -297,13 +401,10 @@ namespace OC typedef std::function GetDirectPairedCallback; - typedef std::function)> MQCreateTopicCallback; -#ifdef RD_CLIENT - typedef std::function PublishResourceCallback; - - typedef std::function DeleteResourceCallback; + typedef std::function)> MQTopicCallback; +#ifdef TCP_ADAPTER + typedef std::function KeepAliveCallback; #endif } // namespace OC