-
Notifications
You must be signed in to change notification settings - Fork 39
/
NAS_GUTI5G.go
209 lines (177 loc) · 5.37 KB
/
NAS_GUTI5G.go
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
package nasType
// GUTI5G 9.11.3.4
// Spare2 Row, sBit, len = [0, 0], 8 , 4
// Spare Row, sBit, len = [0, 0], 4 , 1
// TypeOfIdentity Row, sBit, len = [0, 0], 3 , 3
// MCCDigit2 Row, sBit, len = [1, 1], 8 , 4
// MCCDigit1 Row, sBit, len = [1, 1], 4 , 4
// MNCDigit3 Row, sBit, len = [2, 2], 8 , 4
// MCCDigit3 Row, sBit, len = [2, 2], 4 , 4
// MNCDigit2 Row, sBit, len = [3, 3], 8 , 4
// MNCDigit1 Row, sBit, len = [3, 3], 4 , 4
// AMFRegionID Row, sBit, len = [4, 4], 8 , 8
// AMFSetID Row, sBit, len = [5, 6], 8 , 10
// AMFPointer Row, sBit, len = [6, 6], 6 , 6
// TMSI5G Row, sBit, len = [7, 10], 8 , 32
type GUTI5G struct {
Iei uint8
Len uint16
Octet [11]uint8
}
func NewGUTI5G(iei uint8) (gUTI5G *GUTI5G) {
gUTI5G = &GUTI5G{}
gUTI5G.SetIei(iei)
return gUTI5G
}
// GUTI5G 9.11.3.4
// Iei Row, sBit, len = [], 8, 8
func (a *GUTI5G) GetIei() (iei uint8) {
return a.Iei
}
// GUTI5G 9.11.3.4
// Iei Row, sBit, len = [], 8, 8
func (a *GUTI5G) SetIei(iei uint8) {
a.Iei = iei
}
// GUTI5G 9.11.3.4
// Len Row, sBit, len = [], 8, 16
func (a *GUTI5G) GetLen() (len uint16) {
return a.Len
}
// GUTI5G 9.11.3.4
// Len Row, sBit, len = [], 8, 16
func (a *GUTI5G) SetLen(len uint16) {
a.Len = len
}
// GUTI5G 9.11.3.4
// Spare2 Row, sBit, len = [0, 0], 8 , 4
func (a *GUTI5G) GetSpare2() (spare uint8) {
return a.Octet[0] & GetBitMask(8, 4) >> (4)
}
// GUTI5G 9.11.3.4
// Spare2 Row, sBit, len = [0, 0], 8 , 4
func (a *GUTI5G) SetSpare2(spare uint8) {
a.Octet[0] = (a.Octet[0] & 15) + ((spare & 15) << 4)
}
// GUTI5G 9.11.3.4
// Spare Row, sBit, len = [0, 0], 4 , 1
func (a *GUTI5G) GetSpare() (spare uint8) {
return a.Octet[0] & GetBitMask(4, 3) >> (3)
}
// GUTI5G 9.11.3.4
// Spare Row, sBit, len = [0, 0], 4 , 1
func (a *GUTI5G) SetSpare(spare uint8) {
a.Octet[0] = (a.Octet[0] & 247) + ((spare & 1) << 3)
}
// GUTI5G 9.11.3.4
// TypeOfIdentity Row, sBit, len = [0, 0], 3 , 3
func (a *GUTI5G) GetTypeOfIdentity() (typeOfIdentity uint8) {
return a.Octet[0] & GetBitMask(3, 0)
}
// GUTI5G 9.11.3.4
// TypeOfIdentity Row, sBit, len = [0, 0], 3 , 3
func (a *GUTI5G) SetTypeOfIdentity(typeOfIdentity uint8) {
a.Octet[0] = (a.Octet[0] & 248) + (typeOfIdentity & 7)
}
// GUTI5G 9.11.3.4
// MCCDigit2 Row, sBit, len = [1, 1], 8 , 4
func (a *GUTI5G) GetMCCDigit2() (mCCDigit2 uint8) {
return a.Octet[1] & GetBitMask(8, 4) >> (4)
}
// GUTI5G 9.11.3.4
// MCCDigit2 Row, sBit, len = [1, 1], 8 , 4
func (a *GUTI5G) SetMCCDigit2(mCCDigit2 uint8) {
a.Octet[1] = (a.Octet[1] & 15) + ((mCCDigit2 & 15) << 4)
}
// GUTI5G 9.11.3.4
// MCCDigit1 Row, sBit, len = [1, 1], 4 , 4
func (a *GUTI5G) GetMCCDigit1() (mCCDigit1 uint8) {
return a.Octet[1] & GetBitMask(4, 0)
}
// GUTI5G 9.11.3.4
// MCCDigit1 Row, sBit, len = [1, 1], 4 , 4
func (a *GUTI5G) SetMCCDigit1(mCCDigit1 uint8) {
a.Octet[1] = (a.Octet[1] & 240) + (mCCDigit1 & 15)
}
// GUTI5G 9.11.3.4
// MNCDigit3 Row, sBit, len = [2, 2], 8 , 4
func (a *GUTI5G) GetMNCDigit3() (mNCDigit3 uint8) {
return a.Octet[2] & GetBitMask(8, 4) >> (4)
}
// GUTI5G 9.11.3.4
// MNCDigit3 Row, sBit, len = [2, 2], 8 , 4
func (a *GUTI5G) SetMNCDigit3(mNCDigit3 uint8) {
a.Octet[2] = (a.Octet[2] & 15) + ((mNCDigit3 & 15) << 4)
}
// GUTI5G 9.11.3.4
// MCCDigit3 Row, sBit, len = [2, 2], 4 , 4
func (a *GUTI5G) GetMCCDigit3() (mCCDigit3 uint8) {
return a.Octet[2] & GetBitMask(4, 0)
}
// GUTI5G 9.11.3.4
// MCCDigit3 Row, sBit, len = [2, 2], 4 , 4
func (a *GUTI5G) SetMCCDigit3(mCCDigit3 uint8) {
a.Octet[2] = (a.Octet[2] & 240) + (mCCDigit3 & 15)
}
// GUTI5G 9.11.3.4
// MNCDigit2 Row, sBit, len = [3, 3], 8 , 4
func (a *GUTI5G) GetMNCDigit2() (mNCDigit2 uint8) {
return a.Octet[3] & GetBitMask(8, 4) >> (4)
}
// GUTI5G 9.11.3.4
// MNCDigit2 Row, sBit, len = [3, 3], 8 , 4
func (a *GUTI5G) SetMNCDigit2(mNCDigit2 uint8) {
a.Octet[3] = (a.Octet[3] & 15) + ((mNCDigit2 & 15) << 4)
}
// GUTI5G 9.11.3.4
// MNCDigit1 Row, sBit, len = [3, 3], 4 , 4
func (a *GUTI5G) GetMNCDigit1() (mNCDigit1 uint8) {
return a.Octet[3] & GetBitMask(4, 0)
}
// GUTI5G 9.11.3.4
// MNCDigit1 Row, sBit, len = [3, 3], 4 , 4
func (a *GUTI5G) SetMNCDigit1(mNCDigit1 uint8) {
a.Octet[3] = (a.Octet[3] & 240) + (mNCDigit1 & 15)
}
// GUTI5G 9.11.3.4
// AMFRegionID Row, sBit, len = [4, 4], 8 , 8
func (a *GUTI5G) GetAMFRegionID() (aMFRegionID uint8) {
return a.Octet[4]
}
// GUTI5G 9.11.3.4
// AMFRegionID Row, sBit, len = [4, 4], 8 , 8
func (a *GUTI5G) SetAMFRegionID(aMFRegionID uint8) {
a.Octet[4] = aMFRegionID
}
// GUTI5G 9.11.3.4
// AMFSetID Row, sBit, len = [5, 6], 8 , 10
func (a *GUTI5G) GetAMFSetID() (aMFSetID uint16) {
return (uint16(a.Octet[5])<<2 + uint16((a.Octet[6])&GetBitMask(8, 2))>>6)
}
// GUTI5G 9.11.3.4
// AMFSetID Row, sBit, len = [5, 6], 8 , 10
func (a *GUTI5G) SetAMFSetID(aMFSetID uint16) {
a.Octet[5] = uint8((aMFSetID)>>2) & 255
a.Octet[6] = a.Octet[6]&GetBitMask(6, 6) + uint8(aMFSetID&3)<<6
}
// GUTI5G 9.11.3.4
// AMFPointer Row, sBit, len = [6, 6], 6 , 6
func (a *GUTI5G) GetAMFPointer() (aMFPointer uint8) {
return a.Octet[6] & GetBitMask(6, 0)
}
// GUTI5G 9.11.3.4
// AMFPointer Row, sBit, len = [6, 6], 6 , 6
func (a *GUTI5G) SetAMFPointer(aMFPointer uint8) {
a.Octet[6] = (a.Octet[6] & 192) + (aMFPointer & 63)
}
// GUTI5G 9.11.3.4
// TMSI5G Row, sBit, len = [7, 10], 8 , 32
func (a *GUTI5G) GetTMSI5G() (tMSI5G [4]uint8) {
copy(tMSI5G[:], a.Octet[7:11])
return tMSI5G
}
// GUTI5G 9.11.3.4
// TMSI5G Row, sBit, len = [7, 10], 8 , 32
func (a *GUTI5G) SetTMSI5G(tMSI5G [4]uint8) {
copy(a.Octet[7:11], tMSI5G[:])
}