1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
$NetBSD: patch-ac,v 1.1 2005/03/16 12:55:02 rillig Exp $
--- radproto.h.orig Mon Jul 26 14:19:42 2004
+++ radproto.h Wed Mar 16 10:19:08 2005
@@ -225,7 +225,7 @@ public:
*/
RadiusAttr(
const RadiusAttr& attr /// atrribute to copy from
- ) { memcpy(m_data, attr.m_data, attr.m_length); }
+ ) { memcpy(m_data, attr.m_data, attr.s.m_length); }
/** Create TLV RADIUS attribute of a given type,
initializing #value# field with 'stringValue.GetLength()' bytes
@@ -329,7 +329,7 @@ public:
/** @return
Type of this attribute (see #enum AttrTypes#).
*/
- unsigned char GetType() const { return m_type; }
+ unsigned char GetType() const { return s.m_type; }
/** @return
Vendor-specific type for this attribute, assuming this
@@ -337,19 +337,19 @@ public:
(has vendorId, vendorType and vendorLength fields).
*/
unsigned char GetVsaType() const
- { return (m_length < VsaRfc2865FixedHeaderLength) ? 0 : m_vendorType; }
+ { return (s.m_length < VsaRfc2865FixedHeaderLength) ? 0 : s.s.m_vendorType; }
/** @return
Total length (bytes) of this attribute.
*/
- PINDEX GetLength() const { return m_length; }
+ PINDEX GetLength() const { return s.m_length; }
/** @return
Length of the Value field for this attribute.
*/
PINDEX GetValueLength() const
{
- const PINDEX len = m_length;
+ const PINDEX len = s.m_length;
const PINDEX headerLen = IsVsa() ? VsaFixedHeaderLength : FixedHeaderLength;
return (len <= headerLen) ? 0 : (len - headerLen);
@@ -386,7 +386,7 @@ public:
/** @return
True if this is a vendor-specific attribute (VSA).
*/
- bool IsVsa() const { return (m_type == VendorSpecific); }
+ bool IsVsa() const { return (s.m_type == VendorSpecific); }
/** @return
32 bit vendor identifier for VSA. This call is valid only
@@ -510,7 +510,7 @@ public:
*/
RadiusAttr& operator=(
const RadiusAttr& attr /// the attribute that contents will be assigned from
- ) { memcpy(m_data, attr.m_data, attr.m_length); return *this; }
+ ) { memcpy(m_data, attr.m_data, attr.s.m_length); return *this; }
/** Check whether this attribute contains valid data.
@@ -519,7 +519,7 @@ public:
*/
bool IsValid() const
{
- return ((PINDEX)m_length) >= ((m_type == VendorSpecific)
+ return ((PINDEX)s.m_length) >= ((s.m_type == VendorSpecific)
? VsaFixedHeaderLength : FixedHeaderLength
);
}
@@ -579,9 +579,9 @@ protected:
unsigned char m_vendorType;
unsigned char m_vendorLength;
unsigned char m_vendorValue[MaxLength - VsaRfc2865FixedHeaderLength];
- };
+ } s;
};
- };
+ } s;
};
};
@@ -655,35 +655,35 @@ public:
/** @return
Code for this RADIUS packet (see #enum Codes#)
*/
- unsigned char GetCode() const { return m_code; }
+ unsigned char GetCode() const { return s.m_code; }
/** Set new type (Code filed) for this PDU.
*/
void SetCode(
unsigned char newCode /// new PDU type
- ) { m_code = newCode; }
+ ) { s.m_code = newCode; }
/** @return
Identifier (Id field) of this RADIUS packet
*/
- unsigned char GetId() const { return m_id; }
+ unsigned char GetId() const { return s.m_id; }
/** Set new identifier for this RADIUS packet.
*/
void SetId(
unsigned char newId /// new packet identifier
- ) { m_id = newId; }
+ ) { s.m_id = newId; }
/** @return
Length of this RADIUS packet (bytes)
*/
PINDEX GetLength() const
- { return (((PINDEX)(m_length[0]) & 0xff) << 8) | ((PINDEX)(m_length[1]) & 0xff); }
+ { return (((PINDEX)(s.m_length[0]) & 0xff) << 8) | ((PINDEX)(s.m_length[1]) & 0xff); }
/** @return
A pointer to a memory block that holds 16 bytes authenticator.
*/
- const unsigned char* GetAuthenticator() const { return m_authenticator; }
+ const unsigned char* GetAuthenticator() const { return s.m_authenticator; }
/** Fill the array with 16 bytes #authenticator# vector
associated with this RADIUS packet.
@@ -911,8 +911,8 @@ private:
PINDEX newLen /// new packet length in bytes
)
{
- m_length[0] = (unsigned char)((newLen >> 8) & 0xff);
- m_length[1] = (unsigned char)(newLen & 0xff);
+ s.m_length[0] = (unsigned char)((newLen >> 8) & 0xff);
+ s.m_length[1] = (unsigned char)(newLen & 0xff);
}
protected:
@@ -929,7 +929,7 @@ protected:
/// RADIUS authenticator vector
unsigned char m_authenticator[AuthenticatorLength];
unsigned char m_attributes[MaxPduLength - FixedHeaderLength];
- };
+ } s;
};
};
|