Remove warnings
[anna.git] / source / diameter / app / dcca / Message.cpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 // Local
10 #include <anna/diameter/app/dcca/Message.hpp>
11
12
13 using namespace anna::diameter::app::dcca;
14
15
16 const qosProfile_t & Message::decode3GPPGPRSNegQoSProfile() throw(anna::RuntimeException) {
17   a_qosProfile.reset();
18   //const std::string & utf8 = get3GPPGPRSNegQoSProfile()->getValue();
19   // TODO: decode here ...
20   return a_qosProfile;
21 }
22
23
24 //
25 //
26 //      5 - 3GPP-GPRS Negotiated QoS profile
27 //
28 //          Bits
29 //      Octets    8  7  6  5  4  3  2  1
30 //      1      3GPP type = 5
31 //      2      3GPP Length= L
32 //      3 - L     UTF-8 encoded QoS profile
33 //
34 //      3GPP Type: 5
35 //      Length: For GGSN, L ? 37 (release 7 or higher) or L ? 33 (release 6 or release 5) or L ? 27 (release 4 or release 99) or L = 11 (release 98). For P-GW, the length varies depending on the value of QCI. See below for details.
36 //      QoS profile value: Text type
37 //      UTF-8 encoded QoS profile syntax:
38 //      "<Release indicator> \96 <release specific QoS IE UTF-8 encoding>"
39 //      <Release indicator> = UTF-8 encoded number (two characters) :
40 //       For GGSN:
41 //      "98" = Release 98
42 //      "99"= Release 99 or release 4
43 //      "05"= Release 5 or release 6
44 //      "07"= Release 7 or higher
45 //      For P-GW:
46 //      "08"= Release 8 or higher
47 //         <release specific QoS profile UTF-8 encoding> = UTF-8 encoded QoS profile for the release indicated by          the release indicator.
48 //       The UTF-8 encoding of a QoS IE is defined as follows: each octet is described by 2 UTF-8 encoded characters, defining its hexadecimal representation.
49 //       For GGSN:
50 //       The QoS profile definition is in 3GPP TS 24.008 [54].
51 //          The release 98 QoS profile data is 3 octets long, which then results in a 6 octets UTF-8 encoded string.
52 //          The release 99 and release 4 QoS profile data is 11 octets long, which results in a 22 octets UTF-8 encoded string.
53 //       The release 5 and release 6 QoS profile data is 14 octets long, which results in a 28 octets UTF-8 encoded string.
54 //       The release 7 (and higher) QoS profile data is 16 octets long, which results in a 32 octets UTF-8 encoded string.
55 //      For P-GW:
56 //       It contains the following QoS parameters associated with the EPS bearer:
57 //      -   QCI
58 //      -   ARP
59 //      -   GBR QoS information (UL/DL MBR, UL/DL GBR) or UL/DL APN-AMBR. In other words if the value of QCI indicates a GBR bearer, the GBR QoS information shall be present. If the value of QCI indicates a non-GBR bearer, the APN-AMBR information shall be present.
60 //      The encoding of the EPS bearer QoS profile parameters is specified in 3GPP TS 29.274 [81]: ARP is specified in Bearer QoS IE; QCI, UL MBR, DL MBR, UL MBR and DL MBR are specified in Flow QoS IE; UL APN-AMBR and DL APN-AMBR are specified in AMBR IE.
61 //      For GBR QCIs, the encoding of UTF-8 encoded QoS Profile field shall be as follows:
62 //
63 //      1-3    <Release indicator> -" = "08-" (UTF-8 encoded)
64 //      4-5    ARP (UTF-8 encoded)
65 //      6-7    QCI (UTF-8 encoded)
66 //      8-m    UL MBR (UTF-8 encoded)
67 //      (m+1)-n      DL MBR (UTF-8 encoded)
68 //      (n+1)-o      UL GBR (UTF-8 encoded)
69 //      (o+1)-p      DL GBR (UTF-8 encoded)
70 //
71 //      For non-GBR QCIs, the UL/DL MBR and UL/DL GBR fields shall not be present; UL APN-AMBR and DL APN-AMBR fields shall be encoded (in UTF-8 encoded format) respectively after the QCI field.
72 //
73 //
74 //
75 //
76 //      // Obtiene los parametros trafficClass y handlingPriority a partir de la cadena de entrada(proviene del AVP de la peticion) y según la release
77 //      std::string analisisQoS::obtenerParamQoS(const char * GPRS_Neg_QoS_Profile)
78 //      {
79 //        TRACEAR_OPERACION (TrazarMetodoEx("analisisQoS","obtenerParamQoS",  FILE_LOCATION));
80 //
81 //        // Nos llega una cadena de caracteres
82 //        // Los dos primeros octetos son la release y el tercer octeto es un '-' ,
83 //        // el resto de octetos dependen de la release, se describen segun el caso
84 //        // RELEASE 99
85 //        char str_release[2];
86 //        strncpy( str_release,GPRS_Neg_QoS_Profile,2);
87 //        //qosProfile será el resto de la cadena ( a partir del guión)
88 //        char qosProfile[MAX_CADENA_QOS+1]="";
89 //        char cadena[MAX_CADENA_QOS+1]="";
90 //        // convierte el formato UTF8 a string,
91 //        strncpy(cadena,GPRS_Neg_QoS_Profile,MAX_CADENA_QOS+1);
92 //
93 //        // RELEASE_99;
94 //
95 //          if (cadena [0] =='9' && cadena [1]=='9')
96 //          {
97 //      10.5.6.5  Quality of service
98 //      The purpose of the quality of service information element is to specify the QoS parameters for a PDP context.
99 //      The QoS IE is defined to allow backward compatibility to earlier version of Session Management Protocol.
100 //      The quality of service is a type 4 information element with a minimum length of 14 octets and a maximum length of 18 octets. The QoS requested by the MS shall be encoded both in the QoS attributes specified in octets 3-5 and in the QoS attributes specified in octets 6-14.
101 //      In the MS to network direction and in the network to MS direction the following applies:
102 //      -   Octets 15-18 are optional. If octet 15 is included, then octet 16 shall also be included, and octets 17 and 18 may be included.
103 //      -   If octet 17 is included, then octet 18 shall also be included.
104 //      -   A QoS IE received without octets 6-18, without octets 14-18, without octets 15-18, or without octets 17-18 shall be accepted by the receiving entity.
105 //      NOTE:  This behavior is required for interworking with entities supporting an earlier version of the protocol, or when the Maximum bit rate for downlink or for downlink and uplink is negotiated to a value lower than 8700 kbps.
106 //      The quality of service information element is coded as shown in figure 10.5.138/3GPP TS 24.008 and table 10.5.156/3GPP TS 24.008.
107 //
108 //      Figure 10.5.138/3GPP TS 24.008: Quality of service information element
109 //            //          8           7           6           5           4           3           2           1
110 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
111 //            //    +                                   Quality of service IEI                                      +  Octet 1
112 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
113 //            //    +                               Length of quality of service IE                                 +  Octet 2
114 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
115 //            //    |         spare(00)     +          Delay class              +     Reliability class             +  Octet 3
116 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
117 //            //    +              Peak throughput                  +   spare   +    Precedence class               +  Octet 4
118 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
119 //            //    +             spare(000)            +                  Mean throughput                          +  Octet 5
120 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
121 //            //    +          Traffic class            +     Delivery order    +     Delivery of erroneus SDU      +  Octet 6 <---
122 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
123 //            //    +                                       Maximum SDU size                                        +  Octet 7
124 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
125 //            //    +                                  Maximum bit rate for uplink                                  +  Octet 8
126 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
127 //            //    +                                 Maximum bit rate for downlink                                 +  Octet 9
128 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
129 //            //    +                  Residual BER                 +               SDU error ratio                 +  Octet 10
130 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
131 //            //    +                      Transfer delay                                   +    Traffic Handling   +  Octet 11 <--
132 //            //    +                                                                       +        priority       +
133 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
134 //            //    +                                 Guaranteed bit rate for uplink                                +  Octet 12
135 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
136 //            //    +                                Guaranteed bit rate for downlink                               +  Octet 13
137 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
138 //            //    +             spare(000)            +Signalling +             Source Statistics Descriptor      +  Octet 14
139 //            //    +                                   +Indication +                                               +
140 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
141 //            //    +                             Maximum bit rate for downlink (extended)                          +  Octet 15
142 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
143 //            //    +                            Guaranteed bit rate for downlink (extended)                        +  Octet 16
144 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
145 //            //    +                              Maximum bit rate for uplink (extended)                           +  Octet 17
146 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
147 //            //    +                             Guaranteed bit rate for uplink (extended)                          +  Octet 18
148 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
149 //
150 //      Reliability class, octet 3 (see 3GPP TS 23.107 [81])
151 //      Bits
152 //      3 2 1
153 //      In MS to network direction:
154 //      0 0 0  Subscribed reliability class
155 //      In network to MS direction:
156 //      0 0 0  Reserved
157 //      In MS to network direction and in network to MS direction:
158 //      0 0 1  Unused. If received, it shall be interpreted as '010' (Note)
159 //      0 1 0  Unacknowledged GTP; Acknowledged LLC and RLC, Protected data
160 //      0 1 1  Unacknowledged GTP and LLC; Acknowledged RLC, Protected data
161 //      1 0 0  Unacknowledged GTP, LLC, and RLC, Protected data
162 //      1 0 1  Unacknowledged GTP, LLC, and RLC, Unprotected data
163 //      1 1 1  Reserved
164 //
165 //      All other values are interpreted as Unacknowledged GTP and LLC; Acknowledged RLC, Protected data in this version of the protocol.
166 //
167 //      If network supports EPS, then it should not assign Reliability class value \91010\92.
168 //
169 //      NOTE: this value was allocated in earlier versions of the protocol.
170 //
171 //      Delay class, octet 3 (see 3GPP TS 22.060 [73] and 3GPP TS 23.107 [81])
172 //      Bits
173 //      6 5 4
174 //      In MS to network direction:
175 //      0 0 0  Subscribed delay class
176 //      In network to MS direction:
177 //      0 0 0  Reserved
178 //      In MS to network direction and in network to MS direction:
179 //      0 0 1  Delay class 1
180 //      0 1 0  Delay class 2
181 //      0 1 1  Delay class 3
182 //      1 0 0  Delay class 4 (best effort)
183 //      1 1 1  Reserved
184 //
185 //
186 //
187 //      All other values are interpreted as Delay class 4 (best effort) in this version
188 //      of the protocol.
189 //      Bit 7 and 8 of octet 3 are spare and shall be coded all 0.
190 //      Precedence class, octet 4 (see 3GPP TS 23.107 [81])
191 //      Bits
192 //      3 2 1
193 //      In MS to network direction:
194 //      0 0 0  Subscribed precedence
195 //      In network to MS direction:
196 //      0 0 0  Reserved
197 //      In MS to network direction and in network to MS direction:
198 //      0 0 1  High priority
199 //      0 1 0  Normal priority
200 //      0 1 1  Low priority
201 //      1 1 1  Reserved
202 //
203 //
204 //      All other values are interpreted as Normal priority in this version of the protocol.
205 //
206 //      Bit 4 of octet 4 is spare and shall be coded as 0.
207 //
208 //      Peak throughput, octet 4 (see 3GPP TS 23.107 [81])
209 //      This field is the binary representation of the Peak Throughput Class (1 to 9). The corresponding peak throughput to each peak throughput class is indicated.
210 //      Bits
211 //      8 7 6 5
212 //      In MS to network direction:
213 //      0 0 0 0      Subscribed peak throughput
214 //      In network to MS direction:
215 //      0 0 0 0      Reserved
216 //      In MS to network direction and in network to MS direction:
217 //      0 0 0 1      Up to 1 000 octet/s
218 //      0 0 1 0      Up to 2 000 octet/s
219 //      0 0 1 1      Up to 4 000 octet/s
220 //      0 1 0 0      Up to 8 000 octet/s
221 //      0 1 0 1      Up to 16 000 octet/s
222 //      0 1 1 0      Up to 32 000 octet/s
223 //      0 1 1 1      Up to 64 000 octet/s
224 //      1 0 0 0      Up to 128 000 octet/s
225 //      1 0 0 1      Up to 256 000 octet/s
226 //      1 1 1 1      Reserved
227 //
228 //      All other values are interpreted as Up to 1 000 octet/s in this
229 //      version of the protocol.
230 //      Mean throughput, octet 5 (see 3GPP TS 23.107 [81])
231 //      This field is the binary representation of the Mean Throughput Class (1 to 18; mean throughput class 30 is reserved and 31 is best effort). The corresponding mean throughput to each mean throughput class is indicated.
232 //      Bits
233 //      5 4 3 2 1
234 //
235 //
236 //
237 //      In MS to network direction:
238 //      0 0 0 0 0    Subscribed mean throughput
239 //      In network to MS direction:
240 //      0 0 0 0 0    Reserved
241 //      In MS to network direction and in network to MS direction:
242 //      0 0 0 0 1    100 octet/h
243 //      0 0 0 1 0    200 octet/h
244 //      0 0 0 1 1    500 octet/h
245 //      0 0 1 0 0    1 000 octet/h
246 //      0 0 1 0 1    2 000 octet/h
247 //      0 0 1 1 0    5 000 octet/h
248 //      0 0 1 1 1    10 000 octet/h
249 //      0 1 0 0 0    20 000 octet/h
250 //      0 1 0 0 1    50 000 octet/h
251 //      0 1 0 1 0    100 000 octet/h
252 //      0 1 0 1 1    200 000 octet/h
253 //      0 1 1 0 0    500 000 octet/h
254 //      0 1 1 0 1    1 000 000 octet/h
255 //      0 1 1 1 0    2 000 000 octet/h
256 //      0 1 1 1 1    5 000 000 octet/h
257 //      1 0 0 0 0    10 000 000 octet/h
258 //      1 0 0 0 1    20 000 000 octet/h
259 //      1 0 0 1 0    50 000 000 octet/h
260 //      1 1 1 1 0    Reserved
261 //      1 1 1 1 1    Best effort
262 //      The value Best effort indicates that throughput shall be made available to the MS on a per need and availability basis.
263 //      All other values are interpreted as Best effort in this
264 //      version of the protocol.
265 //
266 //      Bits 8 to 6 of octet 5 are spare and shall be coded all 0.
267 //
268 //
269 //      Delivery of erroneous SDUs, octet 6 (see 3GPP TS 23.107 [81])
270 //      Bits
271 //      3 2 1
272 //      In MS to network direction:
273 //      0 0 0     Subscribed delivery of erroneous SDUs
274 //      In network to MS direction:
275 //      0 0 0     Reserved
276 //      In MS to network direction and in network to MS direction:
277 //      0 0 1     No detect ('-')
278 //      0 1 0     Erroneous SDUs are delivered ('yes')
279 //      0 1 1     Erroneous SDUs are not delivered ('no')
280 //      1 1 1     Reserved
281 //
282 //
283 //      The network shall map all other values not explicitly defined onto one of the values defined in this version of the protocol. The network shall return a negotiated value which is explicitly defined in this version of this protocol.
284 //
285 //      The MS shall consider all other values as reserved.
286 //
287 //      Delivery order, octet 6 (see 3GPP TS 23.107 [81])
288 //      Bits
289 //      5 4 3
290 //      In MS to network direction:
291 //      0 0    Subscribed delivery order
292 //      In network to MS direction:
293 //      0 0    Reserved
294 //      In MS to network direction and in network to MS direction:
295 //      0 1    With delivery order ('yes')
296 //      1 0    Without delivery order ('no')
297 //      1 1    Reserved
298 //
299 //
300 //
301 //
302 //      Traffic class, octet 6 (see 3GPP TS 23.107 [81])
303 //      Bits
304 //      8 7 6
305 //      In MS to network direction:
306 //      0 0 0     Subscribed traffic class
307 //      In network to MS direction:
308 //      0 0 0     Reserved
309 //      In MS to network direction and in network to MS direction:
310 //      0 0 1     Conversational class
311 //      0 1 0     Streaming class
312 //      0 1 1     Interactive class
313 //      1 0 0     Background class
314 //      1 1 1     Reserved
315 //
316 //      The network shall map all other values not explicitly defined onto one of the values defined in this version of the protocol. The network shall return a negotiated value which is explicitly defined in this version of this protocol.
317 //
318 //
319 //      The MS shall consider all other values as reserved.
320 //
321 //      Maximum SDU size, octet 7 (see 3GPP TS 23.107 [81])
322 //      In MS to network direction:
323 //      0 0 0 0 0 0 0 0    Subscribed maximum SDU size
324 //      1 1 1 1 1 1 1 1    Reserved
325 //      In network to MS direction:
326 //      0 0 0 0 0 0 0 0    Reserved
327 //      1 1 1 1 1 1 1 1    Reserved
328 //      In MS to network direction and in network to MS direction:
329 //
330 //      For values in the range 00000001 to 10010110 the Maximum SDU size value is binary coded in 8 bits, using a granularity of 10 octets, giving a range of values from 10 octets to 1500 octets.
331 //      Values above 10010110 are as below:
332 //      1 0 0 1 0 1 1 1    1502 octets
333 //      1 0 0 1 1 0 0 0    1510 octets
334 //      1 0 0 1 1 0 0 1    1520 octets
335 //
336 //
337 //      The network shall map all other values not explicitly defined onto one of the values defined in this version of the protocol. The network shall return a negotiated value which is explicitly defined in this version of this protocol.
338 //
339 //      The MS shall consider all other values as reserved.
340 //
341 //
342 //      Maximum bit rate for uplink, octet 8
343 //      Bits
344 //      8 7 6 5 4 3 2 1
345 //      In MS to network direction:
346 //      0 0 0 0 0 0 0 0 Subscribed maximum bit rate for uplink
347 //      In network to MS direction:
348 //      0 0 0 0 0 0 0 0 Reserved
349 //      In MS to network direction and in network to MS direction:
350 //      0 0 0 0 0 0 0 1    The maximum bit rate is binary coded in 8 bits, using a granularity of 1 kbps
351 //      0 0 1 1 1 1 1 1 giving a range of values from 1 kbps to 63 kbps in 1 kbps increments.
352 //
353 //      0 1 0 0 0 0 0 0    The maximum bit rate is 64 kbps + ((the binary coded value in 8 bits \9601000000) * 8 kbps)
354 //      0 1 1 1 1 1 1 1 giving a range of values from 64 kbps to 568 kbps in 8 kbps increments.
355 //
356 //      1 0 0 0 0 0 0 0    The maximum bit rate is 576 kbps + ((the binary coded value in 8 bits \9610000000) * 64 kbps)
357 //      1 1 1 1 1 1 1 0 giving a range of values from 576 kbps to 8640 kbps in 64 kbps increments.
358 //
359 //      1 1 1 1 1 1 1 1 0kbps
360 //
361 //      If the sending entity wants to indicate a Maximum bit rate for uplink higher than 8640 kbps, it shall set octet 8 to \9411111110\94, i.e. 8640 kbps, and shall encode the value for the Maximum bit rate in octet 17.
362 //
363 //
364 //      Maximum bit rate for downlink, octet 9 (see 3GPP TS 23.107 [81])
365 //
366 //      Coding is identical to that of Maximum bit rate for uplink.
367 //
368 //      If the sending entity wants to indicate a Maximum bit rate for downlink higher than 8640 kbps, it shall set octet 9 to \9411111110\94, i.e. 8640 kbps, and shall encode the value for the Maximum bit rate in octet 15.
369 //
370 //      In this version of the protocol, for messages specified in the present document, the sending entity shall not request 0 kbps for both the Maximum bitrate for downlink and the Maximum bitrate for uplink at the same time. Any entity receiving a request for 0 kbps in both the Maximum bitrate for downlink and the Maximum bitrate for uplink shall consider that as a syntactical error (see clause 8).
371 //
372 //
373 //
374 //      Residual Bit Error Rate (BER), octet 10 (see 3GPP TS 23.107 [81])
375 //      Bits
376 //      8 7 6 5
377 //      In MS to network direction:
378 //      0 0 0 0      Subscribed residual BER
379 //      In network to MS direction:
380 //      0 0 0 0      Reserved
381 //      In MS to network direction and in network to MS direction:
382 //      The Residual BER value consists of 4 bits. The range is from 5*10-2 to 6*10-8.
383 //      0 0 0 1      5*10-2
384 //      0 0 1 0      1*10-2
385 //      0 0 1 1      5*10-3
386 //      0 1 0 0      4*10-3
387 //      0 1 0 1      1*10-3
388 //      0 1 1 0      1*10-4
389 //      0 1 1 1      1*10-5
390 //      1 0 0 0      1*10-6
391 //      1 0 0 1      6*10-8
392 //      1 1 1 1      Reserved
393 //
394 //      The network shall map all other values not explicitly defined onto one of the values defined in this version of the protocol. The network shall return a negotiated value which is explicitly defined in this version of the protocol.
395 //
396 //      The MS shall consider all other values as reserved.
397 //
398 //      SDU error ratio, octet 10 (see 3GPP TS 23.107 [81])
399 //      Bits
400 //      4 3 2 1
401 //      In MS to network direction:
402 //      0 0 0 0      Subscribed SDU error ratio
403 //      In network to MS direction:
404 //      0 0 0 0      Reserved
405 //      In MS to network direction and in network to MS direction:
406 //      The SDU error ratio value consists of 4 bits. The range is is from 1*10-1 to 1*10-6.
407 //      0 0 0 1      1*10-2
408 //      0 0 1 0      7*10-3
409 //      0 0 1 1      1*10-3
410 //      0 1 0 0      1*10-4
411 //      0 1 0 1      1*10-5
412 //      0 1 1 0      1*10-6
413 //      0 1 1 1      1*10-1
414 //      1 1 1 1      Reserved
415 //
416 //      The network shall map all other values not explicitly defined onto one of the values defined in this version of the protocol. The network shall return a negotiated value which is explicitly defined in this version of the protocol.
417 //
418 //      The MS shall consider all other values as reserved.
419 //
420 //      Traffic handling priority, octet 11 (see 3GPP TS 23.107 [81])
421 //      Bits
422 //      2 1
423 //      In MS to network direction:
424 //      0 0    Subscribed traffic handling priority
425 //      In network to MS direction:
426 //      0 0    Reserved
427 //      In MS to network direction and in network to MS direction:
428 //      0 1    Priority level 1
429 //      1 0    Priority level 2
430 //      1 1    Priority level 3
431 //
432 //      The Traffic handling priority value is ignored if the Traffic Class is Conversational class, Streaming class or Background class.
433 //
434 //      Transfer delay, octet 11 (See 3GPP TS 23.107 [81])
435 //      Bits
436 //      8 7 6 5 4 3
437 //
438 //
439 //
440 //      In MS to network direction:
441 //      0 0 0 0 0 0     Subscribed transfer delay
442 //      In network to MS direction:
443 //      0 0 0 0 0 0     Reserved
444 //      In MS to network direction and in network to MS direction:
445 //
446 //
447 //      0 0 0 0 0 1  The Transfer delay is binary coded in 6 bits, using a granularity of 10 ms
448 //      0 0 1 1 1 1     giving a range of values from 10 ms to 150 ms in 10 ms increments
449 //
450 //      0 1 0 0 0 0  The transfer delay is 200 ms + ((the binary coded value in 6 bits \96 010000) * 50 ms)
451 //      0 1 1 1 1 1     giving a range of values from 200 ms to 950 ms in 50ms increments
452 //
453 //      1 0 0 0 0 0  The transfer delay is 1000 ms + ((the binary coded value in 6 bits \96 100000) * 100 ms)
454 //      1 1 1 1 1 0     giving a range of values from 1000 ms to 4000 ms in 100ms increments
455 //
456 //      1 1 1 1 1 1     Reserved
457 //
458 //      The Transfer delay value is ignored if the Traffic Class is Interactive class or Background class.
459 //
460 //      Guaranteed bit rate for uplink, octet 12 (See 3GPP TS 23.107 [81])
461 //
462 //      Coding is identical to that of Maximum bit rate for uplink.
463 //
464 //      If the sending entity wants to indicate a Guaranteed bit rate for uplink higher than 8640 kbps, it shall set octet 12 to \9411111110\94, i.e. 8640 kbps, and shall encode the value for the Guaranteed bit rate in octet 18.
465 //
466 //      The Guaranteed bit rate for uplink value is ignored if the Traffic Class is Interactive class or Background class, or Maximum bit rate for uplink is set to 0 kbps.
467 //
468 //      Guaranteed bit rate for downlink, octet 13(See 3GPP TS 23.107 [81])
469 //
470 //      Coding is identical to that of Maximum bit rate for uplink.
471 //
472 //      If the sending entity wants to indicate a Guaranteed bit rate for downlink higher than 8640 kbps, it shall set octet 13 to \9411111110\94, i.e. 8640 kbps, and shall encode the value for the Guaranteed bit rate in octet 16.
473 //
474 //      The Guaranteed bit rate for downlink value is ignored if the Traffic Class is Interactive class or Background class, or Maximum bit rate for downlink is set to 0 kbps.
475 //
476 //      Source Statistics Descriptor, octet 14 (see 3GPP TS 23.107 [81])
477 //      Bits
478 //      4 3 2 1
479 //      In MS to network direction
480 //      0 0 0 0   unknown
481 //      0 0 0 1      speech
482 //
483 //      The network shall consider all other values as unknown.
484 //
485 //      In network to MS direction
486 //      Bits 4 to 1 of octet 14 are spare and shall be coded all 0.
487 //
488 //      The Source Statistics Descriptor value is ignored if the Traffic Class is Interactive class or Background class.
489 //
490 //      Signalling Indication, octet 14 (see 3GPP TS 23.107 [81])
491 //      Bit
492 //      5
493 //      In MS to network direction and in network to MS direction:
494 //      0      Not optimised for signalling traffic
495 //      1      Optimised for signalling traffic
496 //
497 //      If set to '1' the QoS of the PDP context is optimised for signalling
498 //
499 //      The Signalling Indication value is ignored if the Traffic Class is Conversational class, Streaming class or Background class.
500 //
501 //      Bits 8 to 6 of octet 14 are spare and shall be coded all 0.
502 //
503 //      Maximum bit rate for downlink (extended), octet 15
504 //      Bits
505 //      8 7 6 5 4 3 2 1
506 //      In MS to network direction and in network to MS direction:
507 //      0 0 0 0 0 0 0 0 Use the value indicated by the Maximum bit rate for downlink in octet 9.
508 //
509 //                   For all other values: Ignore the value indicated by the Maximum bit rate for downlink in octet 9
510 //                   and use the following value:
511 //      0 0 0 0 0 0 0 1 The maximum bit rate is 8600 kbps + ((the binary coded value in 8 bits) * 100 kbps),
512 //      0 1 0 0 1 0 1 0 giving a range of values from 8700 kbps
513 //      to 16000 kbps in 100 kbps increments.
514 //
515 //      0 1 0 0 1 0 1 1 The maximum bit rate is 16 Mbps + ((the binary coded value in 8 bits - 01001010) * 1 Mbps),
516 //      1 0 1 1 1 0 1 0 giving a range of values from 17 Mbps to 128 Mbps in 1 Mbps increments.
517 //
518 //      1 0 1 1 1 0 1 1 The maximum bit rate is 128 Mbps + ((the binary coded value in 8 bits - 10111010) * 2 Mbps),
519 //      1 1 1 1 1 0 1 0 giving a range of values from 130 Mbps to 256 Mbps in 2 Mbps increments.
520 //
521 //      The network shall map all other values not explicitly defined onto one of the values defined in this version of the protocol. The network shall return a negotiated value which is explicitly defined in this version of the protocol.
522 //
523 //      The MS shall map all other values not explicitly defined onto the maximum value defined in this version of the protocol.
524 //
525 //      Guaranteed bit rate for downlink (extended), octet 16
526 //      Bits
527 //      8 7 6 5 4 3 2 1
528 //      In MS to network direction and in network to MS direction:
529 //      0 0 0 0 0 0 0 0 Use the value indicated by the Guaranteed bit rate for downlink in octet 13.
530 //
531 //                   For all other values: Ignore the value indicated by the Guaranteed bit rate for downlink in octet 9
532 //                   and use the following value:
533 //      0 0 0 0 0 0 0 1 The guaranteed bit rate is 8600 kbps + ((the binary coded value in 8 bits) * 100 kbps),
534 //      0 1 0 0 1 0 1 0 giving a range of values from 8700 kbps to 16000 kbps in 100 kbps increments.
535 //
536 //      0 1 0 0 1 0 1 1 The guaranteed bit rate is 16 Mbps + ((the binary coded value in 8 bits - 01001010) * 1 Mbps),
537 //      1 0 1 1 1 0 1 0 giving a range of values from 17 Mbps to 128 Mbps in 1 Mbps increments.
538 //
539 //      1 0 1 1 1 0 1 1 The guaranteed bit rate is 128 Mbps + ((the binary coded value in 8 bits - 10111010) * 2 Mbps),
540 //      1 1 1 1 1 0 1 0 giving a range of values from 130 Mbps to 256 Mbps in 2 Mbps increments.
541 //
542 //
543 //      The network shall map all other values not explicitly defined onto one of the values defined in this version of the protocol. The network shall return a negotiated value which is explicitly defined in this version of the protocol.
544 //
545 //      The MS shall map all other values not explicitly defined onto the maximum value defined in this version of the protocol.
546 //
547 //      Maximum bit rate for uplink (extended), octet 17
548 //
549 //      This field is an extension of the Maximum bit rate for uplink in octet 8. The coding is identical to that of the Maximum bit rate for downlink (extended).
550 //
551 //      The network shall map all other values not explicitly defined onto one of the values defined in this version of the protocol. The network shall return a negotiated value which is explicitly defined in this version of the protocol.
552 //
553 //      The MS shall map all other values not explicitly defined onto the maximum value defined in this version of the protocol.
554 //
555 //      Guaranteed bit rate for uplink (extended), octet 18
556 //
557 //      This field is an extension of the Guaranteed bit rate for uplink in octet 12. The coding is identical to that of the Guaranteed bit rate for downlink (extended).
558 //
559 //      The network shall map all other values not explicitly defined onto one of the values defined in this version of the protocol. The network shall return a negotiated value which is explicitly defined in this version of the protocol.
560 //
561 //      The MS shall map all other values not explicitly defined onto the maximum value defined in this version of the protocol.
562 //
563 //
564 //            //trafficClass: Octeto 4 , //strtok(cadena,"-");
565 //            //--------------------------------------------------------------------
566 //            a_release = 99;
567 //            char octeto4[3]= "\0";
568 //            // CADENA: caracteres 0,1, release, caracter 2 " - ", car. 3,4: octeto1, 4,5: octeto2....12,13: octeto11
569 //            //octetoi  se obtiene de cadena[2i+1] , cadena[2i+2], dos caracteres en hexadecimal
570 //
571 //            octeto4[0]=cadena[9];
572 //            octeto4[1]=cadena[10];
573 //            octeto4[2]='\0';
574 //            long i_octeto4;
575 //            // pasamos de hexadecimal a decimal
576 //            sscanf(octeto4,"%x",&i_octeto4);
577 //            a_trafficClass = (i_octeto4 & 0xE0)>>5;
578 //            TRACEAR_DEPURACION
579 //       (
580 //        trazaDebInt("Parametro TrafficClass recibido", a_trafficClass);
581 //        );
582 //            //trafficHandlingPriority : octeto 9, bits 1,2
583 //            //------------------------------------------------------------------
584 //            char octeto9[3]= "\0";
585 //            octeto9[0]=cadena[19];
586 //            octeto9[1]=cadena[20];
587 //            octeto9[2]='\0';
588 //            long i_octeto9;
589 //
590 //            // lo paso a decimal
591 //            sscanf(octeto9,"%x",&i_octeto9);
592 //            a_handlingPriority = (i_octeto9 & 0x03);
593 //            TRACEAR_DEPURACION
594 //       (
595 //        trazaDebInt("Parametro TrafficHandlingPriority recibido",a_handlingPriority);
596 //        );
597 //
598 //              //Maximum bit rate for uplink : octeto 6 completo
599 //            //------------------------------------------------------------------
600 //
601 //             char octeto6[3]= "\0";
602 //
603 //             octeto6[0]=cadena[13];
604 //             octeto6[1]=cadena[14];
605 //             octeto6[2]='\0';
606 //
607 //             a_maximumUplink = decodificaBitRate(octeto6);
608 //
609 //             trazaDebInt("Parametro Maximum bit rate for uplink recibido(en Kbps)",a_maximumUplink);
610 //
611 //              //Maximum bit rate for downlink : octeto 7 completo
612 //            //------------------------------------------------------------------
613 //
614 //             char octeto7[3]= "\0";
615 //
616 //             octeto7[0]=cadena[15];
617 //             octeto7[1]=cadena[16];
618 //             octeto7[2]='\0';
619 //
620 //             a_maximumDownlink = decodificaBitRate(octeto7);
621 //
622 //             trazaDebInt("Parametro Maximum bit rate for downlink recibido(en Kbps)",a_maximumDownlink);
623 //
624 //
625 //
626 //            // qosProfile es la cadena a quitando la release (tres primeros caracteres) 98-qosProfile o 99-qosProfile
627 //            //-----------------
628 //            strncpy(qosProfile,cadena+3,MAX_CADENA_QOS-2);
629 //            TRACEAR_DEPURACION
630 //       (
631 //        trazaDebStr("Parametro qosProfile recibido",qosProfile);
632 //        );
633 //
634 //            return std::string(qosProfile);
635 //          }
636 //
637 //        //RELEASE_98;
638 //        else if (cadena [0] =='9' && cadena [1]=='8')
639 //          {
640 //
641 //            //           8          7            6            5           4           3           2             1
642 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
643 //            //    |         spare        +          Delay class          +     Reliability class         +  Octeto 1
644 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
645 //            //    +              Peak throughput           + spare +    Precedence class        +  Octeto 2
646 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - -       +
647 //            //    +        spare(000)            +                  Mean throughput                    +  Octeto 3
648 //            //    + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - +
649 //
650 //            //Delay Class . Octeto 1 , bits 6,5,4
651 //            //------------------
652 //            a_release = 98;
653 //            char octeto1[3]= "\0";
654 //            //octetoi  es cadena[2i+1],cadena[2i+2] en hexadecimal
655 //            octeto1[0]=cadena[3];
656 //            octeto1[1]=cadena[4];
657 //            octeto1[2]='\0';
658 //            // lo paso a decimal
659 //            long i_octeto1=0;
660 //            sscanf(octeto1,"%x",&i_octeto1);
661 //            int delayClass = (i_octeto1 & 0x38)>>3;
662 //            TRACEAR_DEPURACION
663 //       (
664 //        trazaDebInt("Parametro DelayClass recibido",delayClass);
665 //        );
666 //            a_trafficClass = delayClass; // Devolvemos el valor en la var trafficClass
667 //            //Precedence Class . Octeto 2, bits 1,2,3
668 //            //--------------------------
669 //            char octeto2[3]= "\0";
670 //            octeto2[0]=cadena[5];
671 //            octeto2[1]=cadena[6];
672 //            octeto2[2]='\0';
673 //            //en decimal
674 //            long i_octeto2;
675 //            sscanf(octeto2,"%x",&i_octeto2);
676 //
677 //            int precedenceClass = i_octeto2 & 0x07;
678 //
679 //             TRACEAR_DEPURACION
680 //       (
681 //        trazaDebInt("Parametro precedenceClass recibido: ",precedenceClass);
682 //        );
683 //
684 //            a_handlingPriority =  precedenceClass; // Devolvemos el valor en la var trafficHandPriority
685 //            // qosProfile
686 //            strcpy(qosProfile, cadena+3);// qosProfile, es la cadena quitandole la release, ->"98-qosProfile"
687 //            TRACEAR_DEPURACION
688 //       (
689 //        trazaDebStr( "Parametro qosProfile recibido",qosProfile);
690 //        );
691 //
692 //            return std::string(qosProfile);
693 //          }//fin release98
694 //        else
695 //          {
696 //             TRACEAR_ERROR
697 //       (
698 //        trazaErrStr(TR("El parametro Release no es valido ( debe esr 98 o 99)"),str_release);
699 //        );
700 //             return std::string("");
701 //          }
702 //      }
703 //
704 //      int analisisQoS::decodificaBitRate(char * dato)
705 //      {
706 //       int cabecera=0;
707 //       int salida=0;
708 //       char octeto[3]= "\0";
709 //       long i_octeto;
710 //
711 //       strcpy(octeto,dato);
712 //
713 //           /*Codificacion de los bits de maxima tasa de bit
714 //          Maximum bit rate for uplink, octet 8
715 //          Bits
716 //          8 7 6 5 4 3 2 1
717 //          In MS to network direction:
718 //          0 0 0 0 0 0 0 0   Subscribed maximum bit rate for uplink
719 //          In network to MS direction:
720 //          0 0 0 0 0 0 0 0   Reserved
721 //          In MS to network direction and in network to MS direction :
722 //          0 0 0 0 0 0 0 1   The maximum bit rate is binary coded in 8 bits, using a granularity of 1 kbps
723 //          0 0 1 1 1 1 1 1   giving a range of values from 1 kbps to 63 kbps in 1 kbps increments.
724 //
725 //          0 1 0 0 0 0 0 0   The maximum bit rate is 64 kbps +  ((the binary coded value in 8 bits \9601000000) * 8 kbps)
726 //          0 1 1 1 1 1 1 1   giving a range of values from 64 kbps to 568 kbps in 8 kbps increments.
727 //
728 //          1 0 0 0 0 0 0 0   The maximum bit rate is 576 kbps + ((the binary coded value in 8 bits \9610000000) * 64 kbps)
729 //          1 1 1 1 1 1 1 0   giving a range of values from 576 kbps to 8640 kbps in 64 kbps increments.
730 //
731 //          1 1 1 1 1 1 1 1   0kbps
732 //
733 //
734 //          Maximum bit rate for downlink, octet 9 (see 3GPP TS 23.107)
735 //
736 //          Coding is identical to that of Maximum bit rate for uplink.
737 //
738 //         */
739 //
740 //       // lo paso a decimal
741 //       sscanf(octeto,"%x",&i_octeto);
742 //       cabecera = (i_octeto & 0xC0)>>6;
743 //
744 //       trazaDebStr("QoS, octeto: ", octeto);
745 //       trazaDebInt("QoS, i_octeto: ", i_octeto);
746 //       trazaDebInt("QoS, cabecera: ", cabecera);
747 //
748 //       //Casos especiales: El caso 00000000 se considera 0, por no poder definir ninguno de los dos
749 //       // casos de la especificacion(mirar codificacion arriba)
750 //
751 //       if(i_octeto != 255 && i_octeto != 0)
752 //       {
753 //          switch(cabecera)
754 //          {
755 //             case 0:
756 //                trazaDeb("Bitrate con granuralidad de 1 Kbps");
757 //                salida = (i_octeto & 0x3F);
758 //             break;
759 //
760 //             case 1:
761 //                trazaDeb("Bitrate con granuralidad de 8 Kbps");
762 //                salida = 64 + (i_octeto & 0x3F) * 8;
763 //             break;
764 //
765 //             case 2:
766 //             case 3:
767 //                trazaDeb("Bitrate con granuralidad de 64 Kbps");
768 //                salida = 576 + (i_octeto & 0x7E) * 64;
769 //             break;
770 //
771 //             default:
772 //                trazaErr("Valor de bitrate no contemplado. Revisar codificacion");
773 //                salida = 0;
774 //             break;
775 //          }
776 //       }
777 //       else
778 //       {
779 //          trazaDeb("Bitrate vale 255 o 0, valores no contemplados");
780 //          salida = 0;
781 //       }
782 //       return salida;
783 //      }
784