b563491b018d35d12979653555f9065190f1b9ef
[platform/core/connectivity/wifi-direct-manager.git] / include / wifi-direct-session.h
1 /*
2  * Network Configuration Module
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 /**
21  * This file declares wifi direct session functions and structures.
22  *
23  * @file                wifi-direct-session.h
24  * @author      Gibyoung Kim (lastkgb.kim@samsung.com)
25  * @version     0.7
26  */
27
28 #ifndef __WIFI_DIRECT_SESSION_H__
29 #define __WIFI_DIRECT_SESSION_H__
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 typedef enum {
36         SESSION_TYPE_NORMAL,
37         SESSION_TYPE_INVITE,
38         SESSION_TYPE_JOIN,
39         SESSION_TYPE_MULTI,
40         SESSION_TYPE_ASP,
41 } session_type_e;
42
43 typedef enum {
44         SESSION_STATE_CREATED,
45         SESSION_STATE_STARTED,
46         SESSION_STATE_GO_NEG,
47         SESSION_STATE_WPS,
48         SESSION_STATE_KEY_NEG,
49         SESSION_STATE_COMPLETED,
50         SESSION_STATE_STOPPED,
51 } session_state_e;
52
53 typedef enum {
54         SESSION_DIRECTION_INCOMING,
55         SESSION_DIRECTION_OUTGOING,
56 } session_direction_e;
57
58 typedef struct {
59         int type;
60         int state;
61         int timer;
62         int connecting_120;
63         unsigned int retry_gsrc;
64         int direction;
65         wfd_device_s *peer;
66         int wps_mode;
67         int req_wps_mode;
68         int go_intent;
69         int freq;
70         char wps_pin[PINSTR_LEN+1];
71         unsigned int session_id;
72         unsigned char service_mac[MACADDR_LEN];
73         unsigned char session_mac[MACADDR_LEN];
74 } wfd_session_s;
75
76 wfd_session_s *wfd_create_session(void *data, unsigned char *peer_addr, int wps_mode, int direction);
77 int wfd_destroy_session(void *data);
78 int wfd_session_start(wfd_session_s *session);
79 int wfd_session_connect(wfd_session_s *session);
80 int wfd_session_cancel(wfd_session_s *session, unsigned char *peer_addr);
81 int wfd_session_reject(wfd_session_s *session, unsigned char *peer_addr);
82 int wfd_session_wps(wfd_session_s *session);
83 int wfd_session_invite(wfd_session_s *session);
84 int wfd_session_join(wfd_session_s *session);
85 wfd_device_s *wfd_session_get_peer(wfd_session_s *session);
86 unsigned char *wfd_session_get_peer_addr(wfd_session_s *session);
87 #if 0
88 int wfd_session_get_state(wfd_session_s *session);
89 int wfd_session_stop(wfd_session_s *session);
90 #endif
91 int wfd_session_complete(wfd_session_s *session);
92 int wfd_session_timer(wfd_session_s *session, int start);
93
94 int wfd_session_process_event(wfd_manager_s *manager, wfd_oem_event_s *event);
95 int wfd_session_asp_session_start(wfd_session_s *session, wfd_oem_asp_prov_s *params);
96 int wfd_session_asp_connect(wfd_session_s *session, int role);
97 int wfd_session_asp_persistent_connect(wfd_session_s *session, int persist_group_id);
98
99 #ifdef __cplusplus
100 }
101 #endif
102
103 #endif /* __WIFI_DIRECT_SESSION_H__ */