Remove service_type from search_result
[platform/core/connectivity/asp-manager.git] / include / asp-service.h
1 /*
2  * Copyright (c) 20126 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __ASP_SERVICE_H__
18 #define __ASP_SERVICE_H__
19
20 #include <glib.h>
21
22 #include "asp-manager-util.h"
23
24 #define ASP_SERVICE_MACSTR_LEN 18
25 #define ASP_SERVICE_DEVICE_NAME_LEN 33
26 #define ASP_SERVICE_MACADDR_LEN 6
27 #define ASP_SERVICE_IPADDR_LEN 4
28 #define ASP_SERVICE_DEV_NAME_LEN 32
29 #define ASP_SERVICE_IFACE_NAME_LEN 16
30 #define ASP_SERVICE_ADV_ID_LEN 10
31
32 typedef enum {
33         ASP_SERVICE_P2P_ROLE_NONE = 0x00,  /**< Session network role none */
34         ASP_SERVICE_P2P_ROLE_NEW = 0x01,  /**< Session network role new */
35         ASP_SERVICE_P2P_ROLE_CLIENT = 0x02,  /**< Session network role client */
36         ASP_SERVICE_P2P_ROLE_GO = 0x04,  /**< Session network role GO */
37 } asp_service_p2p_role_e;
38
39 typedef enum {
40         ASP_SERVICE_ADV_STATUS_ADVERTISED,
41         ASP_SERVICE_ADV_STATUS_NOT_ADVERTISED,
42 } asp_service_advertise_status_e;
43
44 typedef enum {
45         ASP_SERVICE_ADVERTISE_REASON_SUCCESS,
46         ASP_SERVICE_ADVERTISE_REASON_DUP,
47         ASP_SERVICE_ADVERTISE_REASON_OTHER,
48 } asp_service_advertise_reason_e;
49
50 typedef enum {
51         ASP_SERVICE_STATUS_NOT_AVAILABLE = 0,
52         ASP_SERVICE_STATUS_AVAILABLE = 1,
53 } asp_service_status_e;
54
55 typedef struct {
56         unsigned int adv_id;
57         unsigned int search_id;
58         int auto_accept;
59         int discovery_tech;
60         unsigned char preferred_connection;
61
62         unsigned char status;
63         unsigned char role;
64         unsigned int config_method;
65
66         char *instance_name;
67         char *service_type;
68         GHashTable *service_info_map;
69         char *rsp_info;
70 } asp_service_advertise_s;
71
72 typedef struct {
73         unsigned int adv_id;
74         unsigned int search_id;
75         int auto_accept;
76         int discovery_tech;
77         unsigned char preferred_connection;
78
79         unsigned char status;
80         unsigned char role;
81         unsigned int config_method;
82
83         char *instance_name;
84         char *service_type;
85         GHashTable *service_info_map;
86         char *rsp_info;
87 } asp_service_seek_s;
88
89 int asp_service_init();
90 int asp_service_deinit();
91 int asp_service_advertise(asp_service_advertise_s *service, int replace);
92 int asp_service_cancel_advertise(asp_service_advertise_s *service);
93 int asp_service_seek(asp_service_seek_s *service, unsigned long long *search_id);
94 int asp_service_cancel_seek(asp_service_seek_s *service);
95
96 int asp_service_event_cb(void *event);
97 int asp_service_notify_advertise_status(unsigned int adv_id,
98                                                                                 asp_service_advertise_status_e status,
99                                                                                 asp_service_advertise_reason_e reason);
100 int asp_service_notify_search_result(unsigned int search_id,
101                                                                         const gchar *service_mac,
102                                                                         const gchar *service_device_name,
103                                                                         unsigned int adv_id,
104                                                                         const gchar *instance_name,
105                                                                         GHashTable *service_info,
106                                                                         asp_service_status_e service_status);
107
108 #endif /* __ASP_SERVICE_H__ */