summaryrefslogtreecommitdiff
path: root/usr/src/cmd/cmd-inet/lib/nwamd/structures.h
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/cmd-inet/lib/nwamd/structures.h')
-rw-r--r--usr/src/cmd/cmd-inet/lib/nwamd/structures.h159
1 files changed, 115 insertions, 44 deletions
diff --git a/usr/src/cmd/cmd-inet/lib/nwamd/structures.h b/usr/src/cmd/cmd-inet/lib/nwamd/structures.h
index caf0815d32..94d750a3fe 100644
--- a/usr/src/cmd/cmd-inet/lib/nwamd/structures.h
+++ b/usr/src/cmd/cmd-inet/lib/nwamd/structures.h
@@ -27,34 +27,45 @@
#ifndef _STRUCTURES_H
#define _STRUCTURES_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
+#include <search.h>
#include <net/if.h>
#include <libscf.h>
#include <libdlwlan.h>
+#include <libnwam.h>
/*
* XXX More work on the state machine is needed. In the future,
* events will be more like EV_NEWADDR, identifying the actual
* event that we care about, rather than the source of the event
- * that we originally implemented. For example, EV_ROUTING should
- * be split into EV_LINK_UP and EV_LINK_DOWN. It's a bit of a mix
+ * that we originally implemented. It's a bit of a mix
* right now.
*/
enum np_event_type {
- EV_ROUTING,
- EV_SYS,
- EV_TIMER,
- EV_SHUTDOWN,
- EV_NEWADDR
+ EV_LINKDROP, /* IFF_RUNNING flag dropped */
+ EV_LINKUP, /* Wired link is up */
+ EV_LINKFADE, /* Wireless link has poor signal */
+ EV_LINKDISC, /* Wireless link has disconnected */
+ EV_NEWAP, /* New AP in list / wireless link up */
+ EV_USER, /* User altered interface priority */
+ EV_TIMER, /* Timer(s) have expired */
+ EV_SHUTDOWN, /* Nwamd is shutting down */
+ EV_NEWADDR, /* Address established on interface */
+ EV_RESELECT, /* Client disconnect; retry operations */
+ EV_DOOR_TIME, /* Door server needs new timer */
+ EV_ADDIF, /* New interface detected */
+ EV_REMIF, /* Old interface removed */
+ EV_TAKEDOWN /* Take interface down; AP reselected */
};
-enum interface_type {
- IF_UNKNOWN,
- IF_WIRED,
- IF_WIRELESS,
- IF_TUN
-};
+/*
+ * Three-valued return types; used for cases where the processing terminates in
+ * a wait for the user.
+ */
+typedef enum {
+ SUCCESS = 0,
+ FAILURE,
+ WAITING
+} return_vals_t;
struct np_event {
enum np_event_type npe_type;
@@ -88,14 +99,17 @@ struct np_event {
* only 'down' the v4 interface.
*/
struct interface {
- char *if_name;
- datalink_id_t if_linkid;
+ char if_name[LIFNAMSIZ];
sa_family_t if_family;
uint64_t if_flags;
uint32_t if_lflags;
- enum interface_type if_type;
+ libnwam_interface_type_t if_type;
uint32_t if_timer_expire;
- struct sockaddr *if_ipaddr;
+ boolean_t if_v6onlink;
+ boolean_t if_up_attempted;
+ dladm_wlan_strength_t if_strength;
+ in_addr_t if_ipv4addr;
+ pthread_t if_thr;
struct interface *if_next;
};
@@ -122,25 +136,6 @@ struct interface {
#define IF_DHCPFLAGS (IF_DHCPFAILED | IF_DHCPSTARTED | IF_DHCPACQUIRED)
/*
- * visited_wlans are stored on visited_wlan_list of type visisted_wlans_list.
- * Access is protected by wifi_mutex.
- */
-struct visited_wlans {
- struct wireless_lan *wifi_net;
- struct visited_wlans *next;
-};
-
-struct visited_wlans_list {
- struct visited_wlans *head;
- int total;
-};
-
-typedef enum {
- IPV4SRC_STATIC,
- IPV4SRC_DHCP
-} ipv4src_t;
-
-/*
* This structure contains the intended configuration of the system as
* differentiated from the actual IPv4 configuration of the system represented
* by the interface structures.
@@ -149,28 +144,57 @@ typedef enum {
* protected by llp_lock.
*/
typedef struct llp {
- struct llp *llp_next;
+ struct qelem llp_links;
char llp_lname[LIFNAMSIZ];
int llp_pri; /* lower number => higher priority */
- enum interface_type llp_type;
- ipv4src_t llp_ipv4src;
+ int llp_fileorder;
+ libnwam_interface_type_t llp_type;
+ boolean_t llp_failed; /* interface bringup failed */
+ boolean_t llp_waiting; /* waiting for user interface */
+ libnwam_ipv4src_t llp_ipv4src;
char *llp_ipv4addrstr; /* if ipsrc is STATIC */
char *llp_ipv6addrstr; /* if the user provided a static addr */
boolean_t llp_ipv6onlink; /* true if we plumb up a v6 interface */
+
+ /* These are used only with door communication */
+ boolean_t llp_dhcp_failed;
+ boolean_t llp_link_up;
+ boolean_t llp_need_wlan;
+ boolean_t llp_need_key;
} llp_t;
/*
- * These entries are user allocated and should be managed by whomever
+ * The wireless module uses a separate thread to check AP status and scan for
+ * AP changes. Some wireless operations (such as scanning) may take a long
+ * time. For that reason, we maintain our own wireless interface structure to
+ * keep interface-specific wireless state.
+ */
+typedef struct wireless_if_s {
+ struct qelem wi_links;
+ char wi_name[LIFNAMSIZ];
+ datalink_id_t wi_linkid;
+ boolean_t wi_scan_running;
+ boolean_t wi_wireless_done;
+ boolean_t wi_need_key;
+ dladm_wlan_strength_t wi_strength;
+} wireless_if_t;
+
+/*
+ * These entries are user allocated and should be managed by whoever
* originates the structure.
*/
struct wireless_lan {
+ dladm_wlan_attr_t attrs;
+ boolean_t known;
+ boolean_t connected;
+ boolean_t scanned;
+ boolean_t rescan;
char *essid;
char *bssid;
char *signal_strength;
char *raw_key;
dladm_wlan_key_t *cooked_key;
- dladm_wlan_secmode_t sec_mode;
- char *wl_if_name;
+ char wl_if_name[LIFNAMSIZ];
};
/*
@@ -186,5 +210,52 @@ typedef struct scf_resources {
scf_value_t *sr_val;
} scf_resources_t;
+/*
+ * These are used to deliver events to the GUI. See door.c and libnwam.
+ */
+typedef struct nwam_descr_event_s {
+ libnwam_descr_evtype_t nde_type;
+ libnwam_diag_cause_t nde_cause;
+ struct in_addr nde_v4address;
+ int nde_prefixlen;
+ dladm_wlan_attr_t nde_attrs;
+ struct wireless_lan *nde_wlans;
+ size_t nde_wlansize;
+ char nde_interface[LIFNAMSIZ];
+} nwam_descr_event_t;
+
+typedef enum nwam_door_cmd_type_e {
+ ndcNull,
+ ndcWaitEvent,
+ ndcGetLLPList,
+ ndcSetLLPPriority,
+ ndcLockLLP,
+ ndcGetWlanList,
+ ndcSelectWlan,
+ ndcWlanKey,
+ ndcStartRescan,
+ ndcGetKnownAPList,
+ ndcAddKnownAP,
+ ndcDeleteKnownAP
+} nwam_door_cmd_type_t;
+
+typedef struct nwam_door_cmd_s {
+ nwam_door_cmd_type_t ndc_type;
+ char ndc_interface[LIFNAMSIZ];
+ int ndc_priority;
+ char ndc_essid[DLADM_STRSIZE];
+ char ndc_bssid[DLADM_STRSIZE];
+ char ndc_key[DLADM_STRSIZE];
+} nwam_door_cmd_t;
+
+typedef struct nwam_llp_data_s {
+ uint_t nld_count; /* number of llp_t struct following */
+ char nld_selected[LIFNAMSIZ];
+ char nld_locked[LIFNAMSIZ];
+} nwam_llp_data_t;
+
+typedef struct nwam_known_ap_s {
+ uint_t nka_count; /* number of libnwam_known_ap_t */
+} nwam_known_ap_t;
#endif /* _STRUCTURES_H */