summaryrefslogtreecommitdiff
path: root/include/peer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/peer.h')
-rw-r--r--include/peer.h75
1 files changed, 73 insertions, 2 deletions
diff --git a/include/peer.h b/include/peer.h
index 807c9456..8a690f5f 100644
--- a/include/peer.h
+++ b/include/peer.h
@@ -26,17 +26,88 @@
extern "C" {
#endif
+enum connman_peer_state {
+ CONNMAN_PEER_STATE_UNKNOWN = 0,
+ CONNMAN_PEER_STATE_IDLE = 1,
+ CONNMAN_PEER_STATE_ASSOCIATION = 2,
+ CONNMAN_PEER_STATE_CONFIGURATION = 3,
+ CONNMAN_PEER_STATE_READY = 4,
+ CONNMAN_PEER_STATE_DISCONNECT = 5,
+ CONNMAN_PEER_STATE_FAILURE = 6,
+};
+
+enum connman_peer_wps_method {
+ CONNMAN_PEER_WPS_UNKNOWN = 0,
+ CONNMAN_PEER_WPS_PBC = 1,
+ CONNMAN_PEER_WPS_PIN = 2,
+};
+
+enum connman_peer_service_type {
+ CONNMAN_PEER_SERVICE_UNKNOWN = 0,
+ CONNMAN_PEER_SERVICE_WIFI_DISPLAY = 1,
+};
+
struct connman_peer;
struct connman_peer *connman_peer_create(const char *identifier);
-void connman_peer_destroy(struct connman_peer *peer);
+#define connman_peer_ref(peer) \
+ connman_peer_ref_debug(peer, __FILE__, __LINE__, __func__)
+
+#define connman_peer_unref(peer) \
+ connman_peer_unref_debug(peer, __FILE__, __LINE__, __func__)
+
+struct connman_peer *connman_peer_ref_debug(struct connman_peer *peer,
+ const char *file, int line, const char *caller);
+void connman_peer_unref_debug(struct connman_peer *peer,
+ const char *file, int line, const char *caller);
+
+const char *connman_peer_get_identifier(struct connman_peer *peer);
void connman_peer_set_name(struct connman_peer *peer, const char *name);
+void connman_peer_set_device(struct connman_peer *peer,
+ struct connman_device *device);
+struct connman_device *connman_peer_get_device(struct connman_peer *peer);
+void connman_peer_set_sub_device(struct connman_peer *peer,
+ struct connman_device *device);
+void connman_peer_set_as_master(struct connman_peer *peer, bool master);
+int connman_peer_set_state(struct connman_peer *peer,
+ enum connman_peer_state new_state);
+int connman_peer_request_connection(struct connman_peer *peer);
+void connman_peer_reset_services(struct connman_peer *peer);
+void connman_peer_add_service(struct connman_peer *peer,
+ enum connman_peer_service_type type,
+ const unsigned char *data, int data_length);
+void connman_peer_services_changed(struct connman_peer *peer);
int connman_peer_register(struct connman_peer *peer);
void connman_peer_unregister(struct connman_peer *peer);
-struct connman_peer *connman_peer_get(const char *identifier);
+struct connman_peer *connman_peer_get(struct connman_device *device,
+ const char *identifier);
+
+typedef void (* peer_service_registration_cb_t) (int result, void *user_data);
+
+struct connman_peer_driver {
+ int (*connect) (struct connman_peer *peer,
+ enum connman_peer_wps_method wps_method,
+ const char *wps_pin);
+ int (*disconnect) (struct connman_peer *peer);
+ int (*register_service) (const unsigned char *specification,
+ int specification_length,
+ const unsigned char *query,
+ int query_length, int version,
+ peer_service_registration_cb_t callback,
+ void *user_data);
+ int (*unregister_service) (const unsigned char *specification,
+ int specification_length,
+ const unsigned char *query,
+ int query_length, int version);
+};
+
+int connman_peer_driver_register(struct connman_peer_driver *driver);
+void connman_peer_driver_unregister(struct connman_peer_driver *driver);
+
+bool connman_peer_service_is_master(void);
#ifdef __cplusplus
}