13cf464d44d5973c118435f9ab5c3aba07d3d59f
[platform/upstream/iotivity.git] / service / basis / resourceBroker / include / BrokerTypes.h
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #ifndef BROKERTYPES_H_
22 #define BROKERTYPES_H_
23
24 #include <iostream>
25 #include <functional>
26
27 #include "OCPlatform.h"
28 #include "octypes.h"
29
30 #include "PrimitiveResource.h"
31
32 #define BROKER_TAG PCF("BROKER")
33 #define BASE_LAYER_C 0
34 #define BROKER_TRANSPORT OCConnectivityType::OC_IPV4
35
36 typedef std::function<void(std::shared_ptr<OC::OCResource>)> FindCB;
37
38 typedef std::function<OCStackResult(BROKER_STATE)> BrokerCB;
39
40 typedef std::function<DISCOVER_TRANSACTION(std::shared_ptr<PrimitiveResource> resource)> DiscoverCB;
41
42 enum class DISCOVER_TRANSACTION
43 {
44     KEEP = 0,
45     DELETE
46 };
47
48 enum class BROKER_STATE
49 {
50     ALIVE = 0,
51     REQUESTED,
52     LOST_SIGNAL,
53     DESTROYED
54 };
55
56 typedef OC::OCPlatform::OCPresenceHandle BasePresenceHandle;
57 typedef std::function<void(OCStackResult, const unsigned int,
58         const std::string&)> SubscribeCallback;
59
60 typedef std::function<void(const HeaderOptions&, const ResponseStatement&, int)> GetCallback;
61
62 #endif // BROKERTYPES_H_