5 * Copyright (C) 2014 Intel Corporation. All rights reserved.
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.
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.
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
22 #ifndef __CONNMAN_PEER_H
23 #define __CONNMAN_PEER_H
29 enum connman_peer_state {
30 CONNMAN_PEER_STATE_UNKNOWN = 0,
31 CONNMAN_PEER_STATE_IDLE = 1,
32 CONNMAN_PEER_STATE_ASSOCIATION = 2,
33 CONNMAN_PEER_STATE_CONFIGURATION = 3,
34 CONNMAN_PEER_STATE_READY = 4,
35 CONNMAN_PEER_STATE_DISCONNECT = 5,
36 CONNMAN_PEER_STATE_FAILURE = 6,
39 enum connman_peer_wps_method {
40 CONNMAN_PEER_WPS_UNKNOWN = 0,
41 CONNMAN_PEER_WPS_PBC = 1,
42 CONNMAN_PEER_WPS_PIN = 2,
45 enum connman_peer_service_type {
46 CONNMAN_PEER_SERVICE_UNKNOWN = 0,
47 CONNMAN_PEER_SERVICE_WIFI_DISPLAY = 1,
52 struct connman_peer *connman_peer_create(const char *identifier);
54 #define connman_peer_ref(peer) \
55 connman_peer_ref_debug(peer, __FILE__, __LINE__, __func__)
57 #define connman_peer_unref(peer) \
58 connman_peer_unref_debug(peer, __FILE__, __LINE__, __func__)
60 struct connman_peer *connman_peer_ref_debug(struct connman_peer *peer,
61 const char *file, int line, const char *caller);
62 void connman_peer_unref_debug(struct connman_peer *peer,
63 const char *file, int line, const char *caller);
65 const char *connman_peer_get_identifier(struct connman_peer *peer);
66 void connman_peer_set_name(struct connman_peer *peer, const char *name);
67 void connman_peer_set_iface_address(struct connman_peer *peer,
68 const unsigned char *iface_address);
69 void connman_peer_set_device(struct connman_peer *peer,
70 struct connman_device *device);
71 struct connman_device *connman_peer_get_device(struct connman_peer *peer);
72 void connman_peer_set_sub_device(struct connman_peer *peer,
73 struct connman_device *device);
74 void connman_peer_set_as_master(struct connman_peer *peer, bool master);
75 int connman_peer_set_state(struct connman_peer *peer,
76 enum connman_peer_state new_state);
77 int connman_peer_request_connection(struct connman_peer *peer);
78 void connman_peer_reset_services(struct connman_peer *peer);
79 void connman_peer_add_service(struct connman_peer *peer,
80 enum connman_peer_service_type type,
81 const unsigned char *data, int data_length);
82 void connman_peer_services_changed(struct connman_peer *peer);
84 int connman_peer_register(struct connman_peer *peer);
85 void connman_peer_unregister(struct connman_peer *peer);
87 struct connman_peer *connman_peer_get(struct connman_device *device,
88 const char *identifier);
90 typedef void (* peer_service_registration_cb_t) (int result, void *user_data);
92 struct connman_peer_driver {
93 int (*connect) (struct connman_peer *peer,
94 enum connman_peer_wps_method wps_method,
96 int (*disconnect) (struct connman_peer *peer);
97 int (*register_service) (const unsigned char *specification,
98 int specification_length,
99 const unsigned char *query,
100 int query_length, int version,
101 peer_service_registration_cb_t callback,
103 int (*unregister_service) (const unsigned char *specification,
104 int specification_length,
105 const unsigned char *query,
106 int query_length, int version);
109 int connman_peer_driver_register(struct connman_peer_driver *driver);
110 void connman_peer_driver_unregister(struct connman_peer_driver *driver);
112 bool connman_peer_service_is_master(void);
118 #endif /* __CONNMAN_PEER_H */