[BACK]Return to ieee80211_node.h CVS log [TXT][DIR] Up to [local] / sys / net80211

Annotation of sys/net80211/ieee80211_node.h, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: ieee80211_node.h,v 1.21 2007/08/03 16:51:06 damien Exp $      */
        !             2: /*     $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $        */
        !             3:
        !             4: /*-
        !             5:  * Copyright (c) 2001 Atsushi Onoe
        !             6:  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
        !             7:  * All rights reserved.
        !             8:  *
        !             9:  * Redistribution and use in source and binary forms, with or without
        !            10:  * modification, are permitted provided that the following conditions
        !            11:  * are met:
        !            12:  * 1. Redistributions of source code must retain the above copyright
        !            13:  *    notice, this list of conditions and the following disclaimer.
        !            14:  * 2. Redistributions in binary form must reproduce the above copyright
        !            15:  *    notice, this list of conditions and the following disclaimer in the
        !            16:  *    documentation and/or other materials provided with the distribution.
        !            17:  * 3. The name of the author may not be used to endorse or promote products
        !            18:  *    derived from this software without specific prior written permission.
        !            19:  *
        !            20:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
        !            21:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
        !            22:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
        !            23:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
        !            24:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
        !            25:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
        !            26:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
        !            27:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        !            28:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
        !            29:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        !            30:  *
        !            31:  * $FreeBSD: src/sys/net80211/ieee80211_node.h,v 1.10 2004/04/05 22:10:26 sam Exp $
        !            32:  */
        !            33: #ifndef _NET80211_IEEE80211_NODE_H_
        !            34: #define _NET80211_IEEE80211_NODE_H_
        !            35:
        !            36: #define        IEEE80211_PSCAN_WAIT    5               /* passive scan wait */
        !            37: #define        IEEE80211_TRANS_WAIT    5               /* transition wait */
        !            38: #define        IEEE80211_INACT_WAIT    5               /* inactivity timer interval */
        !            39: #define        IEEE80211_INACT_MAX     (300/IEEE80211_INACT_WAIT)
        !            40: #define        IEEE80211_CACHE_SIZE    100
        !            41:
        !            42: struct ieee80211_rateset {
        !            43:        u_int8_t                rs_nrates;
        !            44:        u_int8_t                rs_rates[IEEE80211_RATE_MAXSIZE];
        !            45: };
        !            46:
        !            47: extern const struct ieee80211_rateset ieee80211_std_rateset_11a;
        !            48: extern const struct ieee80211_rateset ieee80211_std_rateset_11b;
        !            49: extern const struct ieee80211_rateset ieee80211_std_rateset_11g;
        !            50:
        !            51: enum ieee80211_node_state {
        !            52:        IEEE80211_STA_CACHE,    /* cached node */
        !            53:        IEEE80211_STA_BSS,      /* ic->ic_bss, the network we joined */
        !            54:        IEEE80211_STA_AUTH,     /* successfully authenticated */
        !            55:        IEEE80211_STA_ASSOC,    /* successfully associated */
        !            56:        IEEE80211_STA_COLLECT   /* This node remains in the cache while
        !            57:                                 * the driver sends a de-auth message;
        !            58:                                 * afterward it should be freed to make room
        !            59:                                 * for a new node.
        !            60:                                 */
        !            61: };
        !            62:
        !            63: #define        ieee80211_node_newstate(__ni, __state)  \
        !            64:        do {                                    \
        !            65:                (__ni)->ni_state = (__state);   \
        !            66:        } while (0)
        !            67:
        !            68: /*
        !            69:  * Node specific information.  Note that drivers are expected
        !            70:  * to derive from this structure to add device-specific per-node
        !            71:  * state.  This is done by overriding the ic_node_* methods in
        !            72:  * the ieee80211com structure.
        !            73:  */
        !            74: struct ieee80211_node {
        !            75:        RB_ENTRY(ieee80211_node)        ni_node;
        !            76:
        !            77:        u_int                   ni_refcnt;
        !            78:        u_int                   ni_scangen;     /* gen# for timeout scan */
        !            79:
        !            80:        /* hardware */
        !            81:        u_int32_t               ni_rstamp;      /* recv timestamp */
        !            82:        u_int8_t                ni_rssi;        /* recv ssi */
        !            83:
        !            84:        /* header */
        !            85:        u_int8_t                ni_macaddr[IEEE80211_ADDR_LEN];
        !            86:        u_int8_t                ni_bssid[IEEE80211_ADDR_LEN];
        !            87:
        !            88:        /* beacon, probe response */
        !            89:        u_int8_t                ni_tstamp[8];   /* from last rcv'd beacon */
        !            90:        u_int16_t               ni_intval;      /* beacon interval */
        !            91:        u_int16_t               ni_capinfo;     /* capabilities */
        !            92:        u_int8_t                ni_esslen;
        !            93:        u_int8_t                ni_essid[IEEE80211_NWID_LEN];
        !            94:        struct ieee80211_rateset ni_rates;      /* negotiated rate set */
        !            95:        u_int8_t                *ni_country;    /* country information XXX */
        !            96:        struct ieee80211_channel *ni_chan;
        !            97:        u_int16_t               ni_fhdwell;     /* FH only */
        !            98:        u_int8_t                ni_fhindex;     /* FH only */
        !            99:        u_int8_t                ni_erp;         /* 11g only */
        !           100:
        !           101: #ifdef notyet
        !           102:        /* DTIM and contention free period (CFP) */
        !           103:        u_int8_t                ni_dtimperiod;
        !           104:        u_int8_t                ni_cfpperiod;   /* # of DTIMs between CFPs */
        !           105:        u_int16_t               ni_cfpduremain; /* remaining cfp duration */
        !           106:        u_int16_t               ni_cfpmaxduration;/* max CFP duration in TU */
        !           107:        u_int16_t               ni_nextdtim;    /* time to next DTIM */
        !           108:        u_int16_t               ni_timoffset;
        !           109: #endif
        !           110:
        !           111:        /* power saving mode */
        !           112:        u_int8_t                ni_pwrsave;
        !           113:        struct ifqueue          ni_savedq;      /* packets queued for pspoll */
        !           114:
        !           115:        /* RSN */
        !           116:        u_int                   ni_group_cipher;
        !           117:        enum ieee80211_cipher   ni_pairwise_cipher;
        !           118:        u_int                   ni_pairwise_cipherset;
        !           119:        enum ieee80211_akm      ni_akm;
        !           120:        u_int                   ni_akmset;
        !           121:        u_int16_t               ni_rsncaps;
        !           122:        int                     ni_port_valid;
        !           123:        u_int8_t                ni_eapol_desc;
        !           124:        u_int8_t                ni_nonce[EAPOL_KEY_NONCE_LEN];
        !           125:        u_int64_t               ni_replaycnt;
        !           126:        u_int8_t                ni_replaycnt_ok;
        !           127:        u_int8_t                *ni_rsnie;
        !           128:        struct ieee80211_key    ni_pairwise_key;
        !           129:        struct ieee80211_ptk    ni_ptk;
        !           130:        u_int8_t                ni_ptk_ok;
        !           131:        u_int8_t                ni_key_count;
        !           132:
        !           133:        /* others */
        !           134:        u_int16_t               ni_associd;     /* assoc response */
        !           135:        u_int16_t               ni_txseq;       /* seq to be transmitted */
        !           136:        u_int16_t               ni_rxseq;       /* seq previous received */
        !           137:        u_int16_t               ni_qos_txseqs[IEEE80211_NUM_TID];
        !           138:        u_int16_t               ni_qos_rxseqs[IEEE80211_NUM_TID];
        !           139:        int                     ni_fails;       /* failure count to associate */
        !           140:        int                     ni_inact;       /* inactivity mark count */
        !           141:        int                     ni_txrate;      /* index to ni_rates[] */
        !           142:        int                     ni_state;
        !           143:
        !           144:        u_int8_t                ni_flags;       /* special-purpose state */
        !           145: #define IEEE80211_NODE_ERP     0x01
        !           146: #define IEEE80211_NODE_QOS     0x02
        !           147: };
        !           148:
        !           149: RB_HEAD(ieee80211_tree, ieee80211_node);
        !           150:
        !           151: #define ieee80211_node_incref(ni)                      \
        !           152:        do {                                            \
        !           153:                int _s = splnet();                      \
        !           154:                (ni)->ni_refcnt++;                      \
        !           155:                splx(_s);                               \
        !           156:        } while (0)
        !           157:
        !           158: static __inline int
        !           159: ieee80211_node_decref(struct ieee80211_node *ni)
        !           160: {
        !           161:        int refcnt, s;
        !           162:        s = splnet();
        !           163:        refcnt = --ni->ni_refcnt;
        !           164:        splx(s);
        !           165:        return refcnt;
        !           166: }
        !           167:
        !           168: static __inline struct ieee80211_node *
        !           169: ieee80211_ref_node(struct ieee80211_node *ni)
        !           170: {
        !           171:        ieee80211_node_incref(ni);
        !           172:        return ni;
        !           173: }
        !           174:
        !           175: static __inline void
        !           176: ieee80211_unref_node(struct ieee80211_node **ni)
        !           177: {
        !           178:        ieee80211_node_decref(*ni);
        !           179:        *ni = NULL;                     /* guard against use */
        !           180: }
        !           181:
        !           182: struct ieee80211com;
        !           183:
        !           184: #ifdef MALLOC_DECLARE
        !           185: MALLOC_DECLARE(M_80211_NODE);
        !           186: #endif
        !           187:
        !           188: extern void ieee80211_node_attach(struct ifnet *);
        !           189: extern void ieee80211_node_lateattach(struct ifnet *);
        !           190: extern void ieee80211_node_detach(struct ifnet *);
        !           191:
        !           192: extern void ieee80211_begin_scan(struct ifnet *);
        !           193: extern void ieee80211_next_scan(struct ifnet *);
        !           194: extern void ieee80211_end_scan(struct ifnet *);
        !           195: extern void ieee80211_reset_scan(struct ifnet *);
        !           196: extern struct ieee80211_node *ieee80211_alloc_node(struct ieee80211com *,
        !           197:                const u_int8_t *);
        !           198: extern struct ieee80211_node *ieee80211_dup_bss(struct ieee80211com *,
        !           199:                const u_int8_t *);
        !           200: extern struct ieee80211_node *ieee80211_find_node(struct ieee80211com *,
        !           201:                const u_int8_t *);
        !           202: extern struct ieee80211_node *ieee80211_find_rxnode(struct ieee80211com *,
        !           203:                const struct ieee80211_frame *);
        !           204: extern struct ieee80211_node *ieee80211_find_txnode(struct ieee80211com *,
        !           205:                const u_int8_t *);
        !           206: extern struct ieee80211_node *
        !           207:                ieee80211_find_node_for_beacon(struct ieee80211com *,
        !           208:                const u_int8_t *, const struct ieee80211_channel *,
        !           209:                const char *, u_int8_t);
        !           210: extern void ieee80211_release_node(struct ieee80211com *,
        !           211:                struct ieee80211_node *);
        !           212: extern void ieee80211_free_allnodes(struct ieee80211com *);
        !           213: typedef void ieee80211_iter_func(void *, struct ieee80211_node *);
        !           214: extern void ieee80211_iterate_nodes(struct ieee80211com *ic,
        !           215:                ieee80211_iter_func *, void *);
        !           216: extern void ieee80211_clean_nodes(struct ieee80211com *);
        !           217: extern  int ieee80211_iserp_sta(const struct ieee80211_node *);
        !           218:
        !           219: extern void ieee80211_node_join(struct ieee80211com *,
        !           220:                struct ieee80211_node *, int);
        !           221: extern void ieee80211_node_leave(struct ieee80211com *,
        !           222:                struct ieee80211_node *);
        !           223: extern int ieee80211_match_bss(struct ieee80211com *,
        !           224:                struct ieee80211_node *);
        !           225: extern void ieee80211_create_ibss(struct ieee80211com* ,
        !           226:                struct ieee80211_channel *);
        !           227:
        !           228: extern int ieee80211_node_cmp(const struct ieee80211_node *,
        !           229:                const struct ieee80211_node *);
        !           230: RB_PROTOTYPE(ieee80211_tree, ieee80211_node, ni_node, ieee80211_node_cmp);
        !           231:
        !           232: #endif /* _NET80211_IEEE80211_NODE_H_ */

CVSweb