~ubuntu-branches/ubuntu/precise/rt2570/precise

« back to all changes in this revision

Viewing changes to Module/rtmp_type.h

  • Committer: Bazaar Package Importer
  • Author(s): Aurelien Jarno
  • Date: 2005-05-29 19:03:04 UTC
  • Revision ID: james.westby@ubuntu.com-20050529190304-2brtsi5bwy4wp3bo
Tags: upstream-1.1.0+cvs20060421
ImportĀ upstreamĀ versionĀ 1.1.0+cvs20060421

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*************************************************************************** 
 
2
 * RT2x00 SourceForge Project - http://rt2x00.sourceforge.net              * 
 
3
 *                                                                         * 
 
4
 *   This program is free software; you can redistribute it and/or modify  * 
 
5
 *   it under the terms of the GNU General Public License as published by  * 
 
6
 *   the Free Software Foundation; either version 2 of the License, or     * 
 
7
 *   (at your option) any later version.                                   * 
 
8
 *                                                                         * 
 
9
 *   This program is distributed in the hope that it will be useful,       * 
 
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        * 
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         * 
 
12
 *   GNU General Public License for more details.                          * 
 
13
 *                                                                         * 
 
14
 *   You should have received a copy of the GNU General Public License     * 
 
15
 *   along with this program; if not, write to the                         * 
 
16
 *   Free Software Foundation, Inc.,                                       * 
 
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             * 
 
18
 *                                                                         * 
 
19
 *   Licensed under the GNU GPL                                            * 
 
20
 *   Original code supplied under license from RaLink Inc, 2004.           * 
 
21
 ***************************************************************************/
 
22
 
 
23
/*************************************************************************** 
 
24
 *      Module Name:    rtmp_type.h
 
25
 *
 
26
 *      Abstract:
 
27
 *
 
28
 *      Revision History:
 
29
 *      Who             When            What
 
30
 *      --------        ----------      -------------------------------
 
31
 *      Name            Date            Modification logs
 
32
 *      Jan Lee         2005-06-01      Release
 
33
 *      MathiasK        04-07-2005      Endian fix
 
34
 ***************************************************************************/
 
35
 
 
36
#ifndef __RTMP_TYPE_H__
 
37
#define __RTMP_TYPE_H__
 
38
 
 
39
typedef unsigned short      UINT16;
 
40
typedef unsigned long       UINT32;
 
41
typedef unsigned long long  UINT64;
 
42
 
 
43
// Endian byte swapping codes
 
44
#define SWAP16(x) \
 
45
    ((UINT16)( \
 
46
    (((UINT16)(x) & (UINT16) 0x00ffU) << 8) | \
 
47
    (((UINT16)(x) & (UINT16) 0xff00U) >> 8) ))
 
48
 
 
49
#define SWAP32(x) \
 
50
    ((UINT32)( \
 
51
    (((UINT32)(x) & (UINT32) 0x000000ffUL) << 24) | \
 
52
    (((UINT32)(x) & (UINT32) 0x0000ff00UL) <<  8) | \
 
53
    (((UINT32)(x) & (UINT32) 0x00ff0000UL) >>  8) | \
 
54
    (((UINT32)(x) & (UINT32) 0xff000000UL) >> 24) ))
 
55
 
 
56
#define SWAP64(x) \
 
57
    ((UINT64)( \
 
58
    (UINT64)(((UINT64)(x) & (UINT64) 0x00000000000000ffULL) << 56) | \
 
59
    (UINT64)(((UINT64)(x) & (UINT64) 0x000000000000ff00ULL) << 40) | \
 
60
    (UINT64)(((UINT64)(x) & (UINT64) 0x0000000000ff0000ULL) << 24) | \
 
61
    (UINT64)(((UINT64)(x) & (UINT64) 0x00000000ff000000ULL) <<  8) | \
 
62
    (UINT64)(((UINT64)(x) & (UINT64) 0x000000ff00000000ULL) >>  8) | \
 
63
    (UINT64)(((UINT64)(x) & (UINT64) 0x0000ff0000000000ULL) >> 24) | \
 
64
    (UINT64)(((UINT64)(x) & (UINT64) 0x00ff000000000000ULL) >> 40) | \
 
65
    (UINT64)(((UINT64)(x) & (UINT64) 0xff00000000000000ULL) >> 56) ))
 
66
 
 
67
#ifdef BIG_ENDIAN
 
68
 
 
69
#define cpu2le64(x) SWAP64((x))
 
70
#define le2cpu64(x) SWAP64((x))
 
71
#define cpu2le32(x) SWAP32((x))
 
72
#define le2cpu32(x) SWAP32((x))
 
73
#define cpu2le16(x) SWAP16((x))
 
74
#define le2cpu16(x) SWAP16((x))
 
75
#define cpu2be64(x) ((UINT64)(x))
 
76
#define be2cpu64(x) ((UINT64)(x))
 
77
#define cpu2be32(x) ((UINT32)(x))
 
78
#define be2cpu32(x) ((UINT32)(x))
 
79
#define cpu2be16(x) ((UINT16)(x))
 
80
#define be2cpu16(x) ((UINT16)(x))
 
81
 
 
82
#else   // Little_Endian
 
83
 
 
84
#define cpu2le64(x) ((UINT64)(x))
 
85
#define le2cpu64(x) ((UINT64)(x))
 
86
#define cpu2le32(x) ((UINT32)(x))
 
87
#define le2cpu32(x) ((UINT32)(x))
 
88
#define cpu2le16(x) ((UINT16)(x))
 
89
#define le2cpu16(x) ((UINT16)(x))
 
90
#define cpu2be64(x) SWAP64((x))
 
91
#define be2cpu64(x) SWAP64((x))
 
92
#define cpu2be32(x) SWAP32((x))
 
93
#define be2cpu32(x) SWAP32((x))
 
94
#define cpu2be16(x) SWAP16((x))
 
95
#define be2cpu16(x) SWAP16((x))
 
96
 
 
97
#endif  // BIG_ENDIAN
 
98
 
 
99
// Ralink timer control block
 
100
typedef struct  _RALINK_TIMER_STRUCT    {
 
101
        struct timer_list        Timer;
 
102
        ULONG                           TimerValue;             // Timer value in milliseconds
 
103
        BOOLEAN                         State;                  // True if timer cancelled
 
104
}   RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT;
 
105
 
 
106
typedef struct  _RSN_IE_HEADER_STRUCT   {
 
107
        UCHAR           Eid;
 
108
        UCHAR           Length;
 
109
        USHORT          Version;        // Little endian format
 
110
}       RSN_IE_HEADER_STRUCT, *PRSN_IE_HEADER_STRUCT;
 
111
 
 
112
// Cipher suite selector types
 
113
typedef struct _CIPHER_SUITE_STRUCT     {
 
114
        UCHAR           Oui[3];
 
115
        UCHAR           Type;
 
116
}       CIPHER_SUITE_STRUCT, *PCIPHER_SUITE_STRUCT;
 
117
 
 
118
// Authentication and Key Management suite selector
 
119
typedef struct _AKM_SUITE_STRUCT        {
 
120
        UCHAR           Oui[3];
 
121
        UCHAR           Type;
 
122
}       AKM_SUITE_STRUCT, *PAKM_SUITE_STRUCT;
 
123
 
 
124
// RSN capability
 
125
typedef struct  _RSN_CAPABILITY {
 
126
        USHORT          Rsv:10;
 
127
        USHORT          GTKSAReplayCnt:2;
 
128
        USHORT          PTKSAReplayCnt:2;
 
129
        USHORT          NoPairwise:1;
 
130
        USHORT          PreAuth:1;
 
131
}       RSN_CAPABILITY, *PRSN_CAPABILITY;
 
132
 
 
133
#endif  // __RTMP_TYPE_H__