wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Functions
dbus_new.c File Reference

WPA Supplicant / dbus-based control interface Copyright (c) 2009-2010, Witold Sowa witol.nosp@m.d.so.nosp@m.wa@gm.nosp@m.ail..nosp@m.com Copyright (c) 2009, Jouni Malinen j@w1..nosp@m.fi More...

#include "includes.h"
#include "common.h"
#include "common/ieee802_11_defs.h"
#include "wps/wps.h"
#include "../config.h"
#include "../wpa_supplicant_i.h"
#include "../bss.h"
#include "../wpas_glue.h"
#include "dbus_new_helpers.h"
#include "dbus_dict_helpers.h"
#include "dbus_new.h"
#include "dbus_new_handlers.h"
#include "dbus_common_i.h"
#include "dbus_new_handlers_p2p.h"
#include "p2p/p2p.h"
#include "../p2p_supplicant.h"

Data Structures

struct  group_changed_data
 

Functions

void wpas_dbus_signal_scan_done (struct wpa_supplicant *wpa_s, int success)
 send scan done signal More...
 
void wpas_dbus_signal_blob_added (struct wpa_supplicant *wpa_s, const char *name)
 Send a blob added signal. More...
 
void wpas_dbus_signal_blob_removed (struct wpa_supplicant *wpa_s, const char *name)
 Send a blob removed signal. More...
 
void wpas_dbus_signal_network_selected (struct wpa_supplicant *wpa_s, int id)
 Send a network selected signal. More...
 
void wpas_dbus_signal_network_request (struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, enum wpa_ctrl_req_type rtype, const char *default_txt)
 Indicate that additional information (EAP password, etc.) is required to complete the association to this SSID. More...
 
void wpas_dbus_signal_network_enabled_changed (struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
 Signals Enabled property changes. More...
 
void wpas_dbus_signal_certification (struct wpa_supplicant *wpa_s, int depth, const char *subject, const char *altsubject[], int num_altsubject, const char *cert_hash, const struct wpabuf *cert)
 
void wpas_dbus_signal_eap_status (struct wpa_supplicant *wpa_s, const char *status, const char *parameter)
 
void wpas_dbus_signal_sta_authorized (struct wpa_supplicant *wpa_s, const u8 *sta)
 Send a STA authorized signal. More...
 
void wpas_dbus_signal_sta_deauthorized (struct wpa_supplicant *wpa_s, const u8 *sta)
 Send a STA deauthorized signal. More...
 
void wpas_dbus_signal_p2p_group_removed (struct wpa_supplicant *wpa_s, const char *role)
 Signals P2P group was removed. More...
 
void wpas_dbus_signal_p2p_provision_discovery (struct wpa_supplicant *wpa_s, const u8 *dev_addr, int request, enum p2p_prov_disc_status status, u16 config_methods, unsigned int generated_pin)
 Signals various PD events. More...
 
void wpas_dbus_signal_p2p_go_neg_req (struct wpa_supplicant *wpa_s, const u8 *src, u16 dev_passwd_id, u8 go_intent)
 Signal P2P GO Negotiation Request RX. More...
 
void wpas_dbus_signal_p2p_group_started (struct wpa_supplicant *wpa_s, const struct wpa_ssid *ssid, int client, int network_id)
 Signals P2P group has started. Emitted when a group is successfully started irrespective of the role (client/GO) of the current device. More...
 
void wpas_dbus_signal_p2p_go_neg_resp (struct wpa_supplicant *wpa_s, struct p2p_go_neg_results *res)
 Emit GONegotiation Success/Failure signal. More...
 
void wpas_dbus_signal_p2p_invitation_result (struct wpa_supplicant *wpa_s, int status, const u8 *bssid)
 Emit InvitationResult signal. More...
 
void wpas_dbus_signal_p2p_peer_joined (struct wpa_supplicant *wpa_s, const u8 *peer_addr)
 
void wpas_dbus_signal_p2p_peer_disconnected (struct wpa_supplicant *wpa_s, const u8 *peer_addr)
 
void wpas_dbus_signal_p2p_sd_request (struct wpa_supplicant *wpa_s, int freq, const u8 *sa, u8 dialog_token, u16 update_indic, const u8 *tlvs, size_t tlvs_len)
 
void wpas_dbus_signal_p2p_sd_response (struct wpa_supplicant *wpa_s, const u8 *sa, u16 update_indic, const u8 *tlvs, size_t tlvs_len)
 
void wpas_dbus_signal_p2p_wps_failed (struct wpa_supplicant *wpa_s, struct wps_event_fail *fail)
 Signals WpsFailed event. More...
 
void wpas_dbus_signal_p2p_group_formation_failure (struct wpa_supplicant *wpa_s, const char *reason)
 Signals GroupFormationFailure event. More...
 
void wpas_dbus_signal_p2p_invitation_received (struct wpa_supplicant *wpa_s, const u8 *sa, const u8 *dev_addr, const u8 *bssid, int id, int op_freq)
 Emit InvitationReceived signal. More...
 
void wpas_dbus_signal_prop_changed (struct wpa_supplicant *wpa_s, enum wpas_dbus_prop property)
 Signals change of property. More...
 
void wpas_dbus_bss_signal_prop_changed (struct wpa_supplicant *wpa_s, enum wpas_dbus_bss_prop property, unsigned int id)
 Signals change of BSS property. More...
 
void wpas_dbus_signal_debug_level_changed (struct wpa_global *global)
 Signals change of debug param. More...
 
void wpas_dbus_signal_debug_timestamp_changed (struct wpa_global *global)
 Signals change of debug param. More...
 
void wpas_dbus_signal_debug_show_keys_changed (struct wpa_global *global)
 Signals change of debug param. More...
 
int wpas_dbus_ctrl_iface_init (struct wpas_dbus_priv *priv)
 Initialize dbus control interface. More...
 
void wpas_dbus_ctrl_iface_deinit (struct wpas_dbus_priv *iface)
 Deinitialize dbus ctrl interface for wpa_supplicant. More...
 
int wpas_dbus_register_network (struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
 Register a configured network with dbus. More...
 
int wpas_dbus_unregister_network (struct wpa_supplicant *wpa_s, int nid)
 Unregister a configured network from dbus. More...
 
int wpas_dbus_unregister_bss (struct wpa_supplicant *wpa_s, u8 bssid[ETH_ALEN], unsigned int id)
 Unregister a scanned BSS from dbus. More...
 
int wpas_dbus_register_bss (struct wpa_supplicant *wpa_s, u8 bssid[ETH_ALEN], unsigned int id)
 Register a scanned BSS with dbus. More...
 
int wpas_dbus_register_interface (struct wpa_supplicant *wpa_s)
 Register an interface with D-Bus. More...
 
int wpas_dbus_unregister_interface (struct wpa_supplicant *wpa_s)
 Unregister the interface from D-Bus. More...
 
void wpas_dbus_signal_peer_device_found (struct wpa_supplicant *wpa_s, const u8 *dev_addr)
 Send a peer found signal. More...
 
void wpas_dbus_signal_peer_device_lost (struct wpa_supplicant *wpa_s, const u8 *dev_addr)
 Send a peer lost signal. More...
 
int wpas_dbus_register_peer (struct wpa_supplicant *wpa_s, const u8 *dev_addr)
 Register a discovered peer object with dbus. More...
 
int wpas_dbus_unregister_peer (struct wpa_supplicant *wpa_s, const u8 *dev_addr)
 Unregister a peer object with dbus. More...
 
void wpas_dbus_signal_p2p_find_stopped (struct wpa_supplicant *wpa_s)
 Send P2P Find stopped signal. More...
 
void wpas_dbus_signal_peer_groups_changed (struct wpa_supplicant *wpa_s, const u8 *dev_addr)
 Send peer group change property signal. More...
 
void wpas_dbus_register_p2p_group (struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
 Register a p2p group object with dbus. More...
 
void wpas_dbus_unregister_p2p_group (struct wpa_supplicant *wpa_s, const struct wpa_ssid *ssid)
 Unregister a p2p group object from dbus. More...
 
int wpas_dbus_register_persistent_group (struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
 Register a configured(saved) More...
 
int wpas_dbus_unregister_persistent_group (struct wpa_supplicant *wpa_s, int nid)
 Unregister a persistent_group. More...
 

Detailed Description

WPA Supplicant / dbus-based control interface Copyright (c) 2009-2010, Witold Sowa witol.nosp@m.d.so.nosp@m.wa@gm.nosp@m.ail..nosp@m.com Copyright (c) 2009, Jouni Malinen j@w1..nosp@m.fi

Function Documentation

void wpas_dbus_bss_signal_prop_changed ( struct wpa_supplicant wpa_s,
enum wpas_dbus_bss_prop  property,
unsigned int  id 
)

Signals change of BSS property.

Parameters
wpa_swpa_supplicant network interface data
propertyindicates which property has changed
idunique BSS identifier

Sends PropertyChanged signals with path, interface, and arguments depending on which property has changed.

void wpas_dbus_ctrl_iface_deinit ( struct wpas_dbus_priv iface)

Deinitialize dbus ctrl interface for wpa_supplicant.

Parameters
ifacePointer to dbus private data from wpas_dbus_init()

Deinitialize the dbus control interface that was initialized with wpas_dbus_ctrl_iface_init().

int wpas_dbus_ctrl_iface_init ( struct wpas_dbus_priv priv)

Initialize dbus control interface.

Parameters
globalPointer to global data from wpa_supplicant_init()
Returns
0 on success or -1 on failure

Initialize the dbus control interface for wpa_supplicantand and start receiving commands from external programs over the bus.

int wpas_dbus_register_bss ( struct wpa_supplicant wpa_s,
u8  bssid[ETH_ALEN],
unsigned int  id 
)

Register a scanned BSS with dbus.

Parameters
wpa_swpa_supplicant interface structure
bssidscanned network bssid
idunique BSS identifier
Returns
0 on success, -1 on failure

Registers BSS representing object with dbus

int wpas_dbus_register_interface ( struct wpa_supplicant wpa_s)

Register an interface with D-Bus.

Parameters
wpa_swpa_supplicant interface structure
Returns
0 on success, -1 on failure
int wpas_dbus_register_network ( struct wpa_supplicant wpa_s,
struct wpa_ssid ssid 
)

Register a configured network with dbus.

Parameters
wpa_swpa_supplicant interface structure
ssidnetwork configuration data
Returns
0 on success, -1 on failure

Registers network representing object with dbus

void wpas_dbus_register_p2p_group ( struct wpa_supplicant wpa_s,
struct wpa_ssid ssid 
)

Register a p2p group object with dbus.

Parameters
wpa_swpa_supplicant interface structure
ssidSSID struct
Returns
0 on success, -1 on failure

Registers p2p group representing object with dbus

int wpas_dbus_register_peer ( struct wpa_supplicant wpa_s,
const u8 *  dev_addr 
)

Register a discovered peer object with dbus.

Parameters
wpa_swpa_supplicant interface structure
dev_addrP2P Device Address of the peer
Returns
0 on success, -1 on failure

Registers network representing object with dbus

int wpas_dbus_register_persistent_group ( struct wpa_supplicant wpa_s,
struct wpa_ssid ssid 
)

Register a configured(saved)

persistent group with dbus

Parameters
wpa_swpa_supplicant interface structure
ssidpersistent group (still represented as a network within wpa) configuration data
Returns
0 on success, -1 on failure

Registers a persistent group representing object with dbus.

void wpas_dbus_signal_blob_added ( struct wpa_supplicant wpa_s,
const char *  name 
)

Send a blob added signal.

Parameters
wpa_swpa_supplicant network interface data
nameblob name

Notify listeners about adding a new blob

void wpas_dbus_signal_blob_removed ( struct wpa_supplicant wpa_s,
const char *  name 
)

Send a blob removed signal.

Parameters
wpa_swpa_supplicant network interface data
nameblob name

Notify listeners about removing blob

void wpas_dbus_signal_debug_level_changed ( struct wpa_global global)

Signals change of debug param.

Parameters
globalwpa_global structure

Sends PropertyChanged signals informing that debug level has changed.

void wpas_dbus_signal_debug_show_keys_changed ( struct wpa_global global)

Signals change of debug param.

Parameters
globalwpa_global structure

Sends PropertyChanged signals informing that debug show_keys has changed.

void wpas_dbus_signal_debug_timestamp_changed ( struct wpa_global global)

Signals change of debug param.

Parameters
globalwpa_global structure

Sends PropertyChanged signals informing that debug timestamp has changed.

void wpas_dbus_signal_network_enabled_changed ( struct wpa_supplicant wpa_s,
struct wpa_ssid ssid 
)

Signals Enabled property changes.

Parameters
wpa_swpa_supplicant network interface data
ssidconfigured network which Enabled property has changed

Sends PropertyChanged signals containing new value of Enabled property for specified network

void wpas_dbus_signal_network_request ( struct wpa_supplicant wpa_s,
struct wpa_ssid ssid,
enum wpa_ctrl_req_type  rtype,
const char *  default_txt 
)

Indicate that additional information (EAP password, etc.) is required to complete the association to this SSID.

Parameters
wpa_swpa_supplicant network interface data
rtypeThe specific additional information required
default_textOptional description of required information

Request additional information or passwords to complete an association request.

void wpas_dbus_signal_network_selected ( struct wpa_supplicant wpa_s,
int  id 
)

Send a network selected signal.

Parameters
wpa_swpa_supplicant network interface data
idnetwork id

Notify listeners about selecting a network

void wpas_dbus_signal_p2p_find_stopped ( struct wpa_supplicant wpa_s)

Send P2P Find stopped signal.

Parameters
wpa_swpa_supplicant network interface data

Notify listeners about P2P Find stopped

void wpas_dbus_signal_p2p_go_neg_req ( struct wpa_supplicant wpa_s,
const u8 *  src,
u16  dev_passwd_id,
u8  go_intent 
)

Signal P2P GO Negotiation Request RX.

Parameters
wpa_swpa_supplicant network interface data
srcSource address of the message triggering this notification
dev_passwd_idWPS Device Password Id
go_intentPeer's GO Intent value

Sends signal to notify that a peer P2P Device is requesting group owner negotiation with us.

void wpas_dbus_signal_p2p_go_neg_resp ( struct wpa_supplicant wpa_s,
struct p2p_go_neg_results res 
)

Emit GONegotiation Success/Failure signal.

Parameters
wpa_swpa_supplicant network interface data
resResult of the GO Neg Request
void wpas_dbus_signal_p2p_group_formation_failure ( struct wpa_supplicant wpa_s,
const char *  reason 
)

Signals GroupFormationFailure event.

Parameters
wpa_swpa_supplicant network interface data
reasonindicates the reason code for group formation failure

Sends Event dbus signal and string reason code when available.

void wpas_dbus_signal_p2p_group_removed ( struct wpa_supplicant wpa_s,
const char *  role 
)

Signals P2P group was removed.

Parameters
wpa_swpa_supplicant network interface data
rolerole of this device (client or GO) Sends signal with i/f name and role as string arguments
void wpas_dbus_signal_p2p_group_started ( struct wpa_supplicant wpa_s,
const struct wpa_ssid ssid,
int  client,
int  network_id 
)

Signals P2P group has started. Emitted when a group is successfully started irrespective of the role (client/GO) of the current device.

Parameters
wpa_swpa_supplicant network interface data
ssidSSID object
clientthis device is P2P client
network_idnetwork id of the group started, use instead of ssid->id to account for persistent groups
void wpas_dbus_signal_p2p_invitation_received ( struct wpa_supplicant wpa_s,
const u8 *  sa,
const u8 *  dev_addr,
const u8 *  bssid,
int  id,
int  op_freq 
)

Emit InvitationReceived signal.

Parameters
wpa_swpa_supplicant network interface data
saSource address of the Invitation Request
dev_addGO Device Address
bssidP2P Group BSSID or NULL if not received
idPersistent group id or %0 if not persistent group
op_freqOperating frequency for the group
void wpas_dbus_signal_p2p_invitation_result ( struct wpa_supplicant wpa_s,
int  status,
const u8 *  bssid 
)

Emit InvitationResult signal.

Parameters
wpa_swpa_supplicant network interface data
statusStatus of invitation process
bssidBasic Service Set Identifier
void wpas_dbus_signal_p2p_peer_disconnected ( struct wpa_supplicant wpa_s,
const u8 *  peer_addr 
)

Method to emit a signal for a peer disconnecting the group. The signal will carry path to the group member object constructed using the P2P Device Address of the peer.

: wpa_supplicant network interface data : P2P Device Address of the peer joining the group

void wpas_dbus_signal_p2p_peer_joined ( struct wpa_supplicant wpa_s,
const u8 *  peer_addr 
)

Method to emit a signal for a peer joining the group. The signal will carry path to the group member object constructed using p2p i/f addr used for connecting.

: wpa_supplicant network interface data : P2P Device Address of the peer joining the group

void wpas_dbus_signal_p2p_provision_discovery ( struct wpa_supplicant wpa_s,
const u8 *  dev_addr,
int  request,
enum p2p_prov_disc_status  status,
u16  config_methods,
unsigned int  generated_pin 
)

Signals various PD events.

Parameters
dev_addr- who sent the request or responded to our request.
request- Will be 1 if request, 0 for response.
status- valid only in case of response
config_methods- wps config methods
generated_pin- pin to be displayed in case of WPS_CONFIG_DISPLAY method

Sends following provision discovery related events: ProvisionDiscoveryRequestDisplayPin ProvisionDiscoveryResponseDisplayPin ProvisionDiscoveryRequestEnterPin ProvisionDiscoveryResponseEnterPin ProvisionDiscoveryPBCRequest ProvisionDiscoveryPBCResponse

TODO:: ProvisionDiscoveryFailure (timeout case)

void wpas_dbus_signal_p2p_sd_request ( struct wpa_supplicant wpa_s,
int  freq,
const u8 *  sa,
u8  dialog_token,
u16  update_indic,
const u8 *  tlvs,
size_t  tlvs_len 
)

Method to emit a signal for a service discovery request. The signal will carry station address, frequency, dialog token, update indicator and it tlvs

: wpa_supplicant network interface data

See Also
: station addr (p2p i/f) of the peer : service discovery request dialog token : service discovery request update indicator : service discovery request genrated byte array of tlvs : service discovery request tlvs length
void wpas_dbus_signal_p2p_sd_response ( struct wpa_supplicant wpa_s,
const u8 *  sa,
u16  update_indic,
const u8 *  tlvs,
size_t  tlvs_len 
)

Method to emit a signal for a service discovery response. The signal will carry station address, update indicator and it tlvs

: wpa_supplicant network interface data

See Also
: station addr (p2p i/f) of the peer : service discovery request update indicator : service discovery request genrated byte array of tlvs : service discovery request tlvs length
void wpas_dbus_signal_p2p_wps_failed ( struct wpa_supplicant wpa_s,
struct wps_event_fail *  fail 
)

Signals WpsFailed event.

Parameters
wpa_swpa_supplicant network interface data
failWPS failure information

Sends Event dbus signal with name "fail" and dictionary containing "msg" field with fail message number (int32) as arguments

void wpas_dbus_signal_peer_device_found ( struct wpa_supplicant wpa_s,
const u8 *  dev_addr 
)

Send a peer found signal.

Parameters
wpa_swpa_supplicant network interface data
dev_addrPeer P2P Device Address

Notify listeners about find a p2p peer device found

void wpas_dbus_signal_peer_device_lost ( struct wpa_supplicant wpa_s,
const u8 *  dev_addr 
)

Send a peer lost signal.

Parameters
wpa_swpa_supplicant network interface data
dev_addrPeer P2P Device Address

Notify listeners about lost a p2p peer device

void wpas_dbus_signal_peer_groups_changed ( struct wpa_supplicant wpa_s,
const u8 *  dev_addr 
)

Send peer group change property signal.

Parameters
wpa_swpa_supplicant network interface data
dev_addrP2P Device Address

Notify listeners about peer Groups property changes.

void wpas_dbus_signal_prop_changed ( struct wpa_supplicant wpa_s,
enum wpas_dbus_prop  property 
)

Signals change of property.

Parameters
wpa_swpa_supplicant network interface data
propertyindicates which property has changed

Sends PropertyChanged signals with path, interface and arguments depending on which property has changed.

void wpas_dbus_signal_scan_done ( struct wpa_supplicant wpa_s,
int  success 
)

send scan done signal

Parameters
wpa_swpa_supplicant network interface data
successindicates if scanning succeed or failed

Notify listeners about finishing a scan

void wpas_dbus_signal_sta_authorized ( struct wpa_supplicant wpa_s,
const u8 *  sta 
)

Send a STA authorized signal.

Parameters
wpa_swpa_supplicant network interface data
stastation mac address

Notify listeners a new station has been authorized

void wpas_dbus_signal_sta_deauthorized ( struct wpa_supplicant wpa_s,
const u8 *  sta 
)

Send a STA deauthorized signal.

Parameters
wpa_swpa_supplicant network interface data
stastation mac address

Notify listeners a station has been deauthorized

int wpas_dbus_unregister_bss ( struct wpa_supplicant wpa_s,
u8  bssid[ETH_ALEN],
unsigned int  id 
)

Unregister a scanned BSS from dbus.

Parameters
wpa_swpa_supplicant interface structure
bssidscanned network bssid
idunique BSS identifier
Returns
0 on success, -1 on failure

Unregisters BSS representing object from dbus

int wpas_dbus_unregister_interface ( struct wpa_supplicant wpa_s)

Unregister the interface from D-Bus.

Parameters
wpa_swpa_supplicant interface structure
Returns
0 on success, -1 on failure
int wpas_dbus_unregister_network ( struct wpa_supplicant wpa_s,
int  nid 
)

Unregister a configured network from dbus.

Parameters
wpa_swpa_supplicant interface structure
nidnetwork id
Returns
0 on success, -1 on failure

Unregisters network representing object from dbus

void wpas_dbus_unregister_p2p_group ( struct wpa_supplicant wpa_s,
const struct wpa_ssid ssid 
)

Unregister a p2p group object from dbus.

Parameters
wpa_swpa_supplicant interface structure
ssidnetwork name of the p2p group started
int wpas_dbus_unregister_peer ( struct wpa_supplicant wpa_s,
const u8 *  dev_addr 
)

Unregister a peer object with dbus.

Parameters
wpa_swpa_supplicant interface structure
dev_addrp2p device addr
Returns
0 on success, -1 on failure

Registers network representing object with dbus

int wpas_dbus_unregister_persistent_group ( struct wpa_supplicant wpa_s,
int  nid 
)

Unregister a persistent_group.

from dbus

Parameters
wpa_swpa_supplicant interface structure
nidnetwork id
Returns
0 on success, -1 on failure

Unregisters persistent group representing object from dbus

NOTE: There is a slight issue with the semantics here. While the implementation simply means the persistent group is unloaded from memory, it should not get interpreted as the group is actually being erased/removed from persistent storage as well.