WPS ER: Add preliminary PBC support
[libeap.git] / src / wps / wps.h
index 2661e94..14c6c58 100644 (file)
@@ -32,6 +32,7 @@ enum wsc_op_code {
 
 struct wps_registrar;
 struct upnp_wps_device_sm;
+struct wps_er;
 
 /**
  * struct wps_credential - WPS Credential
@@ -252,6 +253,24 @@ struct wps_registrar_config {
                               const u8 *uuid_e);
 
        /**
+        * set_sel_reg_cb - Callback for reporting selected registrar changes
+        * @ctx: Higher layer context data (cb_ctx)
+        * @sel_reg: Whether the Registrar is selected
+        * @dev_passwd_id: Device Password ID to indicate with method or
+        *      specific password the Registrar intends to use
+        * @sel_reg_config_methods: Bit field of active config methods
+        *
+        * This callback is called whenever the Selected Registrar state
+        * changes (e.g., a new PIN becomes available or PBC is invoked). This
+        * callback is only used by External Registrar implementation;
+        * set_ie_cb() is used by AP implementation in similar caes, but it
+        * provides the full WPS IE data instead of just the minimal Registrar
+        * state information.
+        */
+       void (*set_sel_reg_cb)(void *ctx, int sel_reg, u16 dev_passwd_id,
+                              u16 sel_reg_config_methods);
+
+       /**
         * cb_ctx: Higher layer context data for Registrar callbacks
         */
        void *cb_ctx;
@@ -332,7 +351,27 @@ enum wps_event {
        /**
         * WPS_EV_PBC_TIMEOUT - PBC walktime expired before protocol run start
         */
-       WPS_EV_PBC_TIMEOUT
+       WPS_EV_PBC_TIMEOUT,
+
+       /**
+        * WPS_EV_ER_AP_ADD - ER: AP added
+        */
+       WPS_EV_ER_AP_ADD,
+
+       /**
+        * WPS_EV_ER_AP_REMOVE - ER: AP removed
+        */
+       WPS_EV_ER_AP_REMOVE,
+
+       /**
+        * WPS_EV_ER_ENROLLEE_ADD - ER: Enrollee added
+        */
+       WPS_EV_ER_ENROLLEE_ADD,
+
+       /**
+        * WPS_EV_ER_ENROLLEE_REMOVE - ER: Enrollee removed
+        */
+       WPS_EV_ER_ENROLLEE_REMOVE
 };
 
 /**
@@ -371,6 +410,33 @@ union wps_event_data {
                int enrollee;
                int part;
        } pwd_auth_fail;
+
+       struct wps_event_er_ap {
+               const u8 *uuid;
+               const char *friendly_name;
+               const char *manufacturer;
+               const char *manufacturer_url;
+               const char *model_description;
+               const char *model_name;
+               const char *model_number;
+               const char *model_url;
+               const char *serial_number;
+               const char *upc;
+       } ap;
+
+       struct wps_event_er_enrollee {
+               const u8 *uuid;
+               const u8 *mac_addr;
+               int m1_received;
+               u16 config_methods;
+               u16 dev_passwd_id;
+               const u8 *pri_dev_type;
+               const char *dev_name;
+               const char *manufacturer;
+               const char *model_name;
+               const char *model_number;
+               const char *serial_number;
+       } enrollee;
 };
 
 /**
@@ -606,4 +672,10 @@ int wps_process_oob(struct wps_context *wps, struct oob_device_data *oob_dev,
                    int registrar);
 int wps_attr_text(struct wpabuf *data, char *buf, char *end);
 
+struct wps_er * wps_er_init(struct wps_context *wps, const char *ifname);
+void wps_er_deinit(struct wps_er *er);
+void wps_er_set_sel_reg(struct wps_er *er, int sel_reg, u16 dev_passwd_id,
+                       u16 sel_reg_config_methods);
+int wps_er_pbc(struct wps_er *er, const u8 *uuid);
+
 #endif /* WPS_H */