Add basic support for a location detection framework
[platform/upstream/connman.git] / include / location.h
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2007-2010  Intel Corporation. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21
22 #ifndef __CONNMAN_LOCATION_H
23 #define __CONNMAN_LOCATION_H
24
25 #include <connman/service.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 /**
32  * SECTION:location
33  * @title: Location premitives
34  * @short_description: Functions for detecting locations
35  */
36
37 enum connman_location_result {
38         CONNMAN_LOCATION_RESULT_UNKNOWN = 0,
39         CONNMAN_LOCATION_RESULT_PORTAL  = 1,
40         CONNMAN_LOCATION_RESULT_ONLINE  = 2,
41 };
42
43 struct connman_location;
44
45 struct connman_location *connman_location_ref(struct connman_location *location);
46 void connman_location_unref(struct connman_location *location);
47
48 enum connman_service_type connman_location_get_type(struct connman_location *location);
49 char *connman_location_get_interface(struct connman_location *location);
50 void connman_location_report_result(struct connman_location *location,
51                                         enum connman_location_result result);
52
53 void *connman_location_get_data(struct connman_location *location);
54 void connman_location_set_data(struct connman_location *location, void *data);
55
56 struct connman_location_driver {
57         const char *name;
58         enum connman_service_type type;
59         int priority;
60         int (*detect) (struct connman_location *location);
61         int (*finish) (struct connman_location *location);
62 };
63
64 int connman_location_driver_register(struct connman_location_driver *driver);
65 void connman_location_driver_unregister(struct connman_location_driver *driver);
66
67 #ifdef __cplusplus
68 }
69 #endif
70
71 #endif /* __CONNMAN_LOCATION_H */