libnwam.h revision b00044a2eb43864b8718585d21949611a2ee59ef
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LIBNWAM_H
#define _LIBNWAM_H
/*
* This file defines the programming interface for libnwam. It is a private
* (undocumented, subject to change) interface shared between the NWAM GUI and
* nwamd.
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef struct libnwam_wlan_attr_s {
const char *wla_essid;
const char *wla_bssid;
const char *wla_secmode;
const char *wla_strength;
const char *wla_mode;
const char *wla_speed;
const char *wla_auth;
const char *wla_bsstype;
int wla_channel;
/* Number of strings above; used for internal allocation purposes */
#define WLA_NUM_STRS 8
/*
* The descriptive event types shared with nwamd and with the GUI client. With
* all events other than deInitial, led_interface is always valid. The other
* fields are present when indicated, and otherwise must be left unused.
*/
typedef enum libnwam_descr_evtype_e {
deInitial, /* no other fields; new active client */
deInterfaceUp, /* led_v4address led_prefixlen */
deInterfaceDown, /* led_cause */
deWlanDisconnect, /* led_wlan */
deWlanConnected, /* led_wlan */
deLLPUnselected, /* led_cause */
deWlanKeyNeeded, /* led_wlan */
typedef enum libnwam_diag_cause_e {
dcNone = 0, /* no cause */
dcDHCP, /* DHCP left interface down or with zero addr */
dcTimer, /* gave up on DHCP; switching to next best */
dcUnplugged, /* interface lost RUNNING flag */
dcUser, /* user changed priority */
dcBetter, /* higher-priority interface became RUNNING */
dcNewAP, /* scan completed on higher-priority i/f */
dcGone, /* periodic wireless scan showed disconnect */
dcFaded, /* periodic scan showed "very weak" signal */
dcAllDown, /* all-but-one taken down (initial LLP) */
dcUnwanted, /* another higher-priority interface is up */
dcShutdown, /* daemon is being shut down */
dcRemoved, /* interface removed from system */
dcFailed /* interface bring-up failed */
typedef struct libnwam_event_data_s {
int led_prefixlen; /* deInterfaceUp only */
char *led_interface;
typedef enum libnwam_ipv4src_e {
typedef enum libnwam_interface_type_e {
typedef struct libnwam_llp_s {
const char *llp_interface;
int llp_pri; /* lower number => higher priority */
typedef struct libnwam_wlan_s {
const char *wlan_interface;
typedef struct libnwam_known_ap_s {
const char *ka_essid;
const char *ka_bssid;
extern libnwam_event_data_t *libnwam_wait_event(void);
extern void libnwam_free_event(libnwam_event_data_t *);
extern void libnwam_free_llp_list(libnwam_llp_t *);
extern int libnwam_set_llp_priority(const char *, int);
extern int libnwam_lock_llp(const char *);
extern void libnwam_free_wlan_list(libnwam_wlan_t *);
extern void libnwam_free_known_ap_list(libnwam_known_ap_t *);
extern int libnwam_add_known_ap(const char *, const char *);
extern int libnwam_delete_known_ap(const char *, const char *);
extern int libnwam_select_wlan(const char *, const char *, const char *);
extern int libnwam_wlan_key(const char *, const char *, const char *,
const char *);
extern int libnwam_start_rescan(const char *);
extern int libnwam_fini(void);
extern int libnwam_init(int);
#ifdef __cplusplus
}
#endif
#endif /* _LIBNWAM_H */