merge master code to build iotivity
[platform/upstream/iotivity.git] / resource / csdk / security / include / pinoxmcommon.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 PIN_CALLBACK_DEF_H_
22 #define PIN_CALLBACK_DEF_H_
23
24 #ifdef __cplusplus
25  extern "C" {
26 #endif // __cplusplus
27
28 #define OXM_RANDOM_PIN_SIZE 8
29
30 /**
31  * Function pointer to print pin code
32  */
33 typedef void (*GeneratePinCallback)(char* pinData, size_t pinSize);
34
35 /**
36  * Function pointer to input pin code
37  */
38 typedef void (*InputPinCallback)(char* pinBuf, size_t bufSize);
39
40 /**
41  * Function to setting generate PIN callback from user
42  *
43  * @param[in] pinCB implementation of generate PIN callback
44  */
45 void SetGeneratePinCB(GeneratePinCallback pinCB);
46
47 /**
48  * Function to setting input PIN callback from user
49  *
50  * @param[in] pinCB implementation of input PIN callback
51  */
52 void SetInputPinCB(InputPinCallback pinCB);
53
54 /**
55  * Function to generate random PIN.
56  * This function will send generated PIN to user via callback.
57  *
58  * @param[in,out] pinBuffer   Buffer to store the generated PIN data.
59  * @param[in] bufferSize   Size of buffer
60  * @return OC_STACK_SUCCESS in case of success and other value otherwise.
61  */
62 OCStackResult GeneratePin(char* pinBuffer, size_t bufferSize);
63
64 /**
65  * Function to input PIN callback via input callback
66  *
67  * @param[in,out] pinBuffer Buffer to store the inputed PIN data.
68  * @param[in] bufferSize Size of buffer
69  * @return OC_STACK_SUCCESS in case of success and other value otherwise.
70  */
71 OCStackResult InputPin(char* pinBuffer, size_t bufferSize);
72
73
74 #ifdef __cplusplus
75 }
76 #endif
77
78 #endif //PIN_CALLBACK_DEF_H_