1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup SoftBus
18  * @{
19  *
20  * @brief Provides secure, high-speed communications between devices.
21  *
22  * This module implements unified distributed communication management of nearby devices and provides link-independent
23  * device discovery and transmission interfaces to support service publishing and data transmission.
24  * @since 1.0
25  * @version 1.0
26  */
27 
28 /**
29  * @file inner_session.h
30  *
31  * @brief Declares the functions for DSoftBus identity authentication. The functions can be used to:
32  * <ul>
33  * <li>Open an identity authentication session.</li>
34  * <li>Send an authentication success notification.</li>
35  *
36  * @since 1.0
37  * @version 1.0
38  */
39 #ifndef INNER_SESSION_H
40 #define INNER_SESSION_H
41 
42 #include "softbus_common.h"
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /**
49  * @example openauthsession_demo.c
50  */
51 
52 /**
53  * @brief Opens a session for identity authentication.
54  *
55  * @param sessionName Indicates the pointer to the session name for identity authentication.
56  * The session name uniquely identifies a session service. The value cannot be empty or exceed 256 characters.
57  * @param addrInfo Indicates the pointer to the address information for the connection between devices.
58  * @param num Indicates the number of device connection records.
59  * @param mixAddr Indicates the pointer to the connection address information.
60  * If the address information passed by <b>addrInfo</b> is invalid,
61  * this parameter can be used to obtain the connection information.
62  *
63  * @return Returns <b>SOFTBUS_INVALID_PARAM</b> if invalid parameters are detected.
64  * @return Returns <b>INVALID_SESSION_ID</b> if the session ID is invalid.
65  * @return Returns the session ID (an integer greater than <b>0</b>) if the operation is successful;
66  * return an error code otherwise.
67  *
68  * @since 1.0
69  * @version 1.0
70  */
71 int OpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo, int num, const char *mixAddr);
72 
73 /**
74  * @brief Notifies the upper-layer service of the identity authentication success.
75  *
76  * @param sessionId Indicates the unique session ID.
77  *
78  * @since 1.0
79  * @version 1.0
80  */
81 void NotifyAuthSuccess(int sessionId);
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 #endif