1/*
2 * wpa_cfg.h
3 * Platform independent config routines
4 *
5 * Copyright (C) 2014, Broadcom Corporation
6 * All Rights Reserved.
7 *
8 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
9 * the contents of this file may not be disclosed to third parties, copied
10 * or duplicated in any form, in whole or in part, without the prior
11 * written permission of Broadcom Corporation.
12 *
13 * $Id: wpa_cfg.h,v 1.2 2010-03-08 22:49:21 $
14*/
15
16#ifndef _wpa_cfg_h_
17#define _wpa_cfg_h_
18
19struct ctx;
20struct cfg_ctx;
21struct cfg_ctx_set_cfg;
22struct wpa_dat;
23struct bind_sk;
24
25/*
26 * wpa supplicant
27*/
28
29/* Top level supplicant init: called when library is starting up */
30void wpa_sup_init();
31
32/* Top level supplicant de-init: called when library is shutting down */
33int wpa_sup_deinit();
34
35/* Config a supplicant instance */
36int wpa_sup_cfg(struct wpa_dat *);
37
38/* De-init a supplicant instance */
39int wpa_sup_cleanup(struct wpa_dat *);
40
41/*
42 * wpa authenticator
43*/
44
45/* Config an auth instance */
46int wpa_auth_cfg(struct wpa_dat *);
47
48/* Top level auth init: called when library is starting up */
49int wpa_auth_init();
50
51/* De-init an auth instance */
52int wpa_auth_cleanup(struct wpa_dat *);
53
54/*
55 * wpa common
56*/
57
58/* EAPOL traffic handler */
59extern int
60wpa_handle_8021x(void *arg, void *frame, int len);
61
62/* state indication handler */
63extern int
64wpa_handle_event(void *arg, void *event, int len);
65
66/* device events */
67extern void
68wpa_events(void *ctx, void *priv);
69
70/* get ctx pointer */
71extern struct cfg_ctx *
72wpa_get_ctx(struct wpa_dat *);
73
74/* set ctx pointer */
75extern void
76wpa_set_ctx(struct wpa_dat *, struct cfg_ctx *);
77
78/* set eapol tx context */
79extern void
80wpa_set_eapol_tx(struct wpa_dat *, void *tx);
81
82/* init stacks */
83extern void
84wpa_sk_init(struct wpa_dat *, struct bind_sk **eapol_sk,
85			struct bind_sk **wlss_sk);
86
87/* deinit stacks */
88extern void
89wpa_sk_deinit(struct wpa_dat *, struct bind_sk **eapol_sk,
90			  struct bind_sk **wlss_sk);
91
92/* unpack a WPA configuration */
93extern int
94wpa_cfg(struct cfg_ctx *, struct wpa_dat *, const struct cfg_ctx_set_cfg *);
95
96
97#if defined(WPA_CFG_PRIVATE)
98
99/*
100 * wpa private
101*/
102
103
104struct wpa_dat {
105	/*
106	 * configuration
107	*/
108
109	int WPA_auth;	/* WPA authentication mode bitvec, wlioctl.h */
110	int auth_type;	/* AUTH_WPAPSK or AUTH_UNUSED, wpa_auth.h */
111	int wsec;	/* wireless security bitvec, wlioctl.h */
112	int btamp_enabled;	/* this cfg for a btamp link */
113
114	/* the end product of hashing the passphrase */
115	uint8 pmk[PMK_LEN];
116	int pmk_len;			/* uselses: always PMK_LEN? */
117
118	/* code will be TRUE (AUTHORIZED) or FALSE (DEAUTHENTICATED, for a reason)
119	 * reason is only valid for DEAUTHENTICATED code
120	 * AUTHORIZED means successful handshake & keys plumbed
121	 */
122	void (*result)(void *, unsigned char code, unsigned char reason);
123
124	int role;
125
126	/*
127	 * adaptation layer data
128	*/
129
130	struct cfg_ctx *ctx; /* back pointer */
131	struct ctx *svc_ctx;		/* contains ctx handle returned by supp/auth */
132	struct bind_sk eapol, wlss;
133	void *eapol_tx;
134	struct ether_addr cur_etheraddr;
135	struct ether_addr BSSID;
136
137}; /* struct wpa_dat */
138
139#endif /* defined(WPA_CFG_PRIVATE) */
140
141#endif /* _wpa_cfg_h_ */
142