[DA patch]Add timeout configuration
[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 timeout;
62         int timer;
63         int connecting_120;
64         unsigned int retry_gsrc;
65         int direction;
66         wfd_device_s *peer;
67         int wps_mode;
68         int req_wps_mode;
69         int go_intent;
70         int freq;
71         char wps_pin[PINSTR_LEN+1];
72         unsigned int session_id;
73         unsigned char service_mac[MACADDR_LEN];
74         unsigned char session_mac[MACADDR_LEN];
75 } wfd_session_s;
76
77 wfd_session_s *wfd_create_session(void *data, unsigned char *peer_addr, int wps_mode, int direction);
78 int wfd_destroy_session(void *data);
79 int wfd_session_start(wfd_session_s *session);
80 int wfd_session_connect(wfd_session_s *session);
81 int wfd_session_cancel(wfd_session_s *session, unsigned char *peer_addr);
82 int wfd_session_reject(wfd_session_s *session, unsigned char *peer_addr);
83 int wfd_session_wps(wfd_session_s *session);
84 int wfd_session_invite(wfd_session_s *session);
85 int wfd_session_join(wfd_session_s *session);
86 wfd_device_s *wfd_session_get_peer(wfd_session_s *session);
87 unsigned char *wfd_session_get_peer_addr(wfd_session_s *session);
88 #if 0
89 int wfd_session_get_state(wfd_session_s *session);
90 int wfd_session_stop(wfd_session_s *session);
91 #endif
92 int wfd_session_complete(wfd_session_s *session);
93 int wfd_session_timer(wfd_session_s *session, int start);
94
95 int wfd_session_process_event(wfd_manager_s *manager, wfd_oem_event_s *event);
96 int wfd_session_asp_session_start(wfd_session_s *session, wfd_oem_asp_prov_s *params);
97 int wfd_session_asp_connect(wfd_session_s *session, int role);
98 int wfd_session_asp_persistent_connect(wfd_session_s *session, int persist_group_id);
99
100 #ifdef __cplusplus
101 }
102 #endif
103
104 #endif /* __WIFI_DIRECT_SESSION_H__ */