1 //******************************************************************
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 /// @file OCHeaderOption.h
23 /// @brief This file contains the declaration of classes and its members related to
26 #ifndef __OCHEADEROPTION_H
27 #define __OCHEADEROPTION_H
29 #include <OCException.h>
30 #include <StringConstants.h>
33 namespace HeaderOption
36 * @brief OCHeaderOption class allows to create instances which comprises optionID
37 * and optionData as members. These are used in setting Header options.
38 * After creating instances of OCHeaderOptions, use setHeaderOptions API
39 * (in OCResource.h) to set header Options.
40 * NOTE: HeaderOptionID is an unsigned integer value which MUST be within
41 * range of 2048 to 3000 inclusive of lower and upper bound.
42 * HeaderOptions instance creation fails if above condition is not satisfied.
44 const uint16_t MIN_HEADER_OPTIONID = 2048;
45 const uint16_t MAX_HEADER_OPTIONID = 3000;
51 std::string m_optionData;
55 * OCHeaderOption constructor
57 OCHeaderOption(uint16_t optionID, std::string optionData):
59 m_optionData(optionData)
61 if(!(optionID >= MIN_HEADER_OPTIONID && optionID <= MAX_HEADER_OPTIONID))
63 throw OCException(OC::Exception::OPTION_ID_RANGE_INVALID);
68 * API to get Option ID
69 * @return unsigned integer option ID
71 uint16_t getOptionID() const
77 * API to get Option data
78 * @return std::string of option data
80 std::string getOptionData() const
85 } // namespace HeaderOption
88 #endif //__OCHEADEROPTION_H