#include <memory>
#include <iterator>
-#include "ocstack.h"
+#include "octypes.h"
#include "OCHeaderOption.h"
#include <OCException.h>
#include "StringConstants.h"
* Data structure to provide the configuration.
* ServiceType: indicate InProc or OutOfProc
* ModeType : indicate whether we want to do server, client or both
- * ipAddress : ip address of server.
- * if you speecifiy 0.0.0.0 : it listens on any interface.
- * port : port of server.
- * : if you specifiy 0 : next available random port is used.
- * : if you specify 5683 : client discovery can work even if they don't specify port.
- * QoS : Quality of Service : CONFIRMABLE or NON CONFIRMABLE.
+ * ServerConnectivity : default flags for server
+ * ClientConnectivity : default flags for client
+ * QoS : indicate Quality of Service : LowQos, MidQos,HighQos and NaQos(No quality Defined).
+ * ps : persistant storage Handler structure (open/read/write/close/unlink)
*/
struct PlatformConfig
{
ServiceType serviceType;
ModeType mode;
- std::string ipAddress;
- uint16_t port;
-
+ OCConnectivityType serverConnectivity;
+ OCConnectivityType clientConnectivity;
+ std::string ipAddress; // not used
+ uint16_t port; // not used
QualityOfService QoS;
+ OCPersistentStorage *ps;
public:
PlatformConfig()
: serviceType(ServiceType::InProc),
mode(ModeType::Both),
+ serverConnectivity(CT_DEFAULT),
+ clientConnectivity(CT_DEFAULT),
ipAddress("0.0.0.0"),
port(0),
- QoS(QualityOfService::NaQos)
+ QoS(QualityOfService::NaQos),
+ ps(nullptr)
+ {}
+ PlatformConfig(const ServiceType serviceType_,
+ const ModeType mode_,
+ OCConnectivityType serverConnectivity_,
+ OCConnectivityType clientConnectivity_,
+ const QualityOfService QoS_,
+ OCPersistentStorage *ps_ = nullptr)
+ : serviceType(serviceType_),
+ mode(mode_),
+ serverConnectivity(serverConnectivity_),
+ clientConnectivity(clientConnectivity_),
+ ipAddress(""),
+ port(0),
+ QoS(QoS_),
+ ps(ps_)
{}
+ // for backward compatibility
PlatformConfig(const ServiceType serviceType_,
const ModeType mode_,
const std::string& ipAddress_,
const uint16_t port_,
- const QualityOfService QoS_)
+ const QualityOfService QoS_,
+ OCPersistentStorage *ps_ = nullptr)
: serviceType(serviceType_),
mode(mode_),
+ serverConnectivity(CT_DEFAULT),
+ clientConnectivity(CT_DEFAULT),
ipAddress(ipAddress_),
port(port_),
- QoS(QoS_)
+ QoS(QoS_),
+ ps(ps_)
{}
};
enum RequestHandlerFlag
{
- InitFlag = 1 << 0,
RequestFlag = 1 << 1,
ObserverFlag = 1 << 2
};
// const strings for different interfaces
// Default interface
- const std::string DEFAULT_INTERFACE = "oc.mi.def";
+ const std::string DEFAULT_INTERFACE = "oic.if.baseline";
// Used in discovering (GET) links to other resources of a collection.
- const std::string LINK_INTERFACE = "oc.mi.ll";
+ const std::string LINK_INTERFACE = "oic.if.ll";
// Used in GET, PUT, POST, DELETE methods on links to other resources of a collection.
- const std::string BATCH_INTERFACE = "oc.mi.b";
+ const std::string BATCH_INTERFACE = "oic.if.b";
// Used in GET, PUT, POST methods on links to other remote resources of a group.
- const std::string GROUP_INTERFACE = "oc.mi.c";
+ const std::string GROUP_INTERFACE = "oic.mi.grp";
typedef std::function<void(std::shared_ptr<OCResource>)> FindCallback;
typedef std::function<void(const OCRepresentation&)> FindDeviceCallback;
+ typedef std::function<void(const OCRepresentation&)> FindPlatformCallback;
+
typedef std::function<OCEntityHandlerResult(
const std::shared_ptr<OCResourceRequest>)> EntityHandler;