Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; |
michael@0 | 8 | |
michael@0 | 9 | let WSP = {}; |
michael@0 | 10 | Cu.import("resource://gre/modules/WspPduHelper.jsm", WSP); |
michael@0 | 11 | let WBXML = {}; |
michael@0 | 12 | Cu.import("resource://gre/modules/WbxmlPduHelper.jsm", WBXML); |
michael@0 | 13 | |
michael@0 | 14 | Cu.import("resource://services-crypto/utils.js"); |
michael@0 | 15 | Cu.import("resource://services-common/utils.js"); |
michael@0 | 16 | |
michael@0 | 17 | // set to true to see debug messages |
michael@0 | 18 | let DEBUG = WBXML.DEBUG_ALL | false; |
michael@0 | 19 | |
michael@0 | 20 | /** |
michael@0 | 21 | * Public identifier for CP |
michael@0 | 22 | * |
michael@0 | 23 | * @see http://technical.openmobilealliance.org/tech/omna/omna-wbxml-public-docid.aspx |
michael@0 | 24 | */ |
michael@0 | 25 | const PUBLIC_IDENTIFIER_CP = "-//WAPFORUM//DTD PROV 1.0//EN"; |
michael@0 | 26 | |
michael@0 | 27 | this.PduHelper = { |
michael@0 | 28 | |
michael@0 | 29 | /** |
michael@0 | 30 | * @param data |
michael@0 | 31 | * A wrapped object containing raw PDU data. |
michael@0 | 32 | * @param contentType |
michael@0 | 33 | * Content type of incoming CP message, should be "text/vnd.wap.connectivity-xml" |
michael@0 | 34 | * or "application/vnd.wap.connectivity-wbxml". |
michael@0 | 35 | * |
michael@0 | 36 | * @return A message object containing attribute content and contentType. |
michael@0 | 37 | * |content| will contain string of decoded CP message if successfully |
michael@0 | 38 | * decoded, or raw data if failed. |
michael@0 | 39 | * |contentType| will be string representing corresponding type of |
michael@0 | 40 | * content. |
michael@0 | 41 | */ |
michael@0 | 42 | parse: function parse_cp(data, contentType) { |
michael@0 | 43 | // We only need content and contentType |
michael@0 | 44 | let msg = { |
michael@0 | 45 | contentType: contentType |
michael@0 | 46 | }; |
michael@0 | 47 | |
michael@0 | 48 | /** |
michael@0 | 49 | * Message is compressed by WBXML, decode into string. |
michael@0 | 50 | * |
michael@0 | 51 | * @see WAP-192-WBXML-20010725-A |
michael@0 | 52 | */ |
michael@0 | 53 | if (contentType === "application/vnd.wap.connectivity-wbxml") { |
michael@0 | 54 | let appToken = { |
michael@0 | 55 | publicId: PUBLIC_IDENTIFIER_CP, |
michael@0 | 56 | tagTokenList: CP_TAG_FIELDS, |
michael@0 | 57 | attrTokenList: CP_ATTRIBUTE_FIELDS, |
michael@0 | 58 | valueTokenList: CP_VALUE_FIELDS, |
michael@0 | 59 | globalTokenOverride: null |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | try { |
michael@0 | 63 | let parseResult = WBXML.PduHelper.parse(data, appToken, msg); |
michael@0 | 64 | msg.content = parseResult.content; |
michael@0 | 65 | msg.contentType = "text/vnd.wap.connectivity-xml"; |
michael@0 | 66 | } catch (e) { |
michael@0 | 67 | // Provide raw data if we failed to parse. |
michael@0 | 68 | msg.content = data.array; |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | return msg; |
michael@0 | 72 | } |
michael@0 | 73 | |
michael@0 | 74 | /** |
michael@0 | 75 | * Message is plain text, transform raw to string. |
michael@0 | 76 | */ |
michael@0 | 77 | try { |
michael@0 | 78 | let stringData = WSP.Octet.decodeMultiple(data, data.array.length); |
michael@0 | 79 | msg.content = WSP.PduHelper.decodeStringContent(stringData, "UTF-8"); |
michael@0 | 80 | } catch (e) { |
michael@0 | 81 | // Provide raw data if we failed to parse. |
michael@0 | 82 | msg.content = data.array; |
michael@0 | 83 | } |
michael@0 | 84 | return msg; |
michael@0 | 85 | |
michael@0 | 86 | } |
michael@0 | 87 | }; |
michael@0 | 88 | |
michael@0 | 89 | /** |
michael@0 | 90 | * SEC type values |
michael@0 | 91 | * |
michael@0 | 92 | * @see WAP-183-ProvCont-20010724-A, clause 5.3 |
michael@0 | 93 | */ |
michael@0 | 94 | const AUTH_SEC_TYPE = (function () { |
michael@0 | 95 | let names = {}; |
michael@0 | 96 | function add(name, number) { |
michael@0 | 97 | names[number] = name; |
michael@0 | 98 | } |
michael@0 | 99 | |
michael@0 | 100 | add("NETWPIN", 0); |
michael@0 | 101 | add("USERPIN", 1); |
michael@0 | 102 | add("USERNETWPIN", 2); |
michael@0 | 103 | add("USERPINMAC", 3); |
michael@0 | 104 | |
michael@0 | 105 | return names; |
michael@0 | 106 | })(); |
michael@0 | 107 | |
michael@0 | 108 | this.Authenticator = { |
michael@0 | 109 | /** |
michael@0 | 110 | * Format IMSI string into GSM format |
michael@0 | 111 | * |
michael@0 | 112 | * @param imsi |
michael@0 | 113 | * IMSI string |
michael@0 | 114 | * |
michael@0 | 115 | * @return IMSI in GSM format as string object |
michael@0 | 116 | */ |
michael@0 | 117 | formatImsi: function formatImsi(imsi) { |
michael@0 | 118 | let parityByte = ((imsi.length & 1) ? 9 : 1); |
michael@0 | 119 | |
michael@0 | 120 | // Make sure length of IMSI is 15 digits. |
michael@0 | 121 | // @see GSM 11.11, clause 10.2.2 |
michael@0 | 122 | let i = 0; |
michael@0 | 123 | for (i = 15 - imsi.length; i > 0; i--) { |
michael@0 | 124 | imsi += "F"; |
michael@0 | 125 | } |
michael@0 | 126 | |
michael@0 | 127 | // char-by-char atoi |
michael@0 | 128 | let imsiValue = []; |
michael@0 | 129 | imsiValue.push(parityByte); |
michael@0 | 130 | for (i = 0; i < imsi.length; i++) { |
michael@0 | 131 | imsiValue.push(parseInt(imsi.substr(i, 1), 10)); |
michael@0 | 132 | } |
michael@0 | 133 | |
michael@0 | 134 | // encoded IMSI |
michael@0 | 135 | let imsiEncoded = ""; |
michael@0 | 136 | for (i = 0; i < imsiValue.length; i += 2) { |
michael@0 | 137 | imsiEncoded += String.fromCharCode(imsiValue[i] | (imsiValue[i+1] << 4)); |
michael@0 | 138 | } |
michael@0 | 139 | |
michael@0 | 140 | return imsiEncoded; |
michael@0 | 141 | }, |
michael@0 | 142 | |
michael@0 | 143 | /** |
michael@0 | 144 | * Perform HMAC check |
michael@0 | 145 | * |
michael@0 | 146 | * @param wbxml |
michael@0 | 147 | * Uint8 typed array of raw WBXML data. |
michael@0 | 148 | * @param key |
michael@0 | 149 | * key string for HMAC check. |
michael@0 | 150 | * @param mac |
michael@0 | 151 | * Expected MAC value. |
michael@0 | 152 | * |
michael@0 | 153 | * @return true for valid, false for invalid. |
michael@0 | 154 | */ |
michael@0 | 155 | isValid: function isValid(wbxml, key, mac) { |
michael@0 | 156 | let hasher = CryptoUtils.makeHMACHasher(Ci.nsICryptoHMAC.SHA1, |
michael@0 | 157 | CryptoUtils.makeHMACKey(key)); |
michael@0 | 158 | hasher.update(wbxml, wbxml.length); |
michael@0 | 159 | let result = CommonUtils.bytesAsHex(hasher.finish(false)).toUpperCase(); |
michael@0 | 160 | return mac == result; |
michael@0 | 161 | }, |
michael@0 | 162 | |
michael@0 | 163 | /** |
michael@0 | 164 | * Perform HMAC authentication. |
michael@0 | 165 | * |
michael@0 | 166 | * @param wbxml |
michael@0 | 167 | * Uint8 typed array of raw WBXML data. |
michael@0 | 168 | * @param sec |
michael@0 | 169 | * Security method for HMAC check. |
michael@0 | 170 | * @param mac |
michael@0 | 171 | * Expected MAC value. |
michael@0 | 172 | * @param getNetworkPin |
michael@0 | 173 | * Callback function for getting network pin. |
michael@0 | 174 | * |
michael@0 | 175 | * @return true for valid, false for invalid. |
michael@0 | 176 | */ |
michael@0 | 177 | check: function check_hmac(wbxml, sec, mac, getNetworkPin) { |
michael@0 | 178 | // No security set. |
michael@0 | 179 | if (sec == null || !mac) { |
michael@0 | 180 | return null; |
michael@0 | 181 | } |
michael@0 | 182 | |
michael@0 | 183 | let authInfo = { |
michael@0 | 184 | pass: false, |
michael@0 | 185 | checked: false, |
michael@0 | 186 | sec: AUTH_SEC_TYPE[sec], |
michael@0 | 187 | mac: mac.toUpperCase(), |
michael@0 | 188 | data: wbxml |
michael@0 | 189 | }; |
michael@0 | 190 | |
michael@0 | 191 | switch (authInfo.sec) { |
michael@0 | 192 | case "NETWPIN": |
michael@0 | 193 | let key = getNetworkPin(); |
michael@0 | 194 | authInfo.pass = this.isValid(wbxml, key, authInfo.mac); |
michael@0 | 195 | authInfo.checked = true; |
michael@0 | 196 | return authInfo; |
michael@0 | 197 | |
michael@0 | 198 | case "USERPIN": |
michael@0 | 199 | case "USERPINMAC": |
michael@0 | 200 | // We can't check without USER PIN |
michael@0 | 201 | return authInfo; |
michael@0 | 202 | |
michael@0 | 203 | case "USERNETWPIN": |
michael@0 | 204 | default: |
michael@0 | 205 | return null; |
michael@0 | 206 | } |
michael@0 | 207 | } |
michael@0 | 208 | }; |
michael@0 | 209 | |
michael@0 | 210 | /** |
michael@0 | 211 | * Tag tokens |
michael@0 | 212 | * |
michael@0 | 213 | * @see OMA-WAP-TS-ProvCont-V1_1-20090421-C, clause 7.1 |
michael@0 | 214 | */ |
michael@0 | 215 | const CP_TAG_FIELDS = (function () { |
michael@0 | 216 | let names = {}; |
michael@0 | 217 | function add(name, codepage, number) { |
michael@0 | 218 | let entry = { |
michael@0 | 219 | name: name, |
michael@0 | 220 | number: number, |
michael@0 | 221 | }; |
michael@0 | 222 | if (!names[codepage]) { |
michael@0 | 223 | names[codepage] = {}; |
michael@0 | 224 | } |
michael@0 | 225 | names[codepage][number] = entry; |
michael@0 | 226 | } |
michael@0 | 227 | |
michael@0 | 228 | // Code page 0 |
michael@0 | 229 | add("wap-provisioningdoc", 0, 0x05); |
michael@0 | 230 | add("characteristic", 0, 0x06); |
michael@0 | 231 | add("parm", 0, 0x07); |
michael@0 | 232 | // Code page 1 |
michael@0 | 233 | add("characteristic", 1, 0x06); |
michael@0 | 234 | add("parm", 1, 0x07); |
michael@0 | 235 | |
michael@0 | 236 | return names; |
michael@0 | 237 | })(); |
michael@0 | 238 | |
michael@0 | 239 | /** |
michael@0 | 240 | * Attribute Tokens |
michael@0 | 241 | * |
michael@0 | 242 | * @see OMA-WAP-TS-ProvCont-V1_1-20090421-C, clause 7.2 |
michael@0 | 243 | */ |
michael@0 | 244 | const CP_ATTRIBUTE_FIELDS = (function () { |
michael@0 | 245 | let names = {}; |
michael@0 | 246 | function add(name, value, codepage, number) { |
michael@0 | 247 | let entry = { |
michael@0 | 248 | name: name, |
michael@0 | 249 | value: value, |
michael@0 | 250 | number: number, |
michael@0 | 251 | }; |
michael@0 | 252 | if (!names[codepage]) { |
michael@0 | 253 | names[codepage] = {}; |
michael@0 | 254 | } |
michael@0 | 255 | names[codepage][number] = entry; |
michael@0 | 256 | } |
michael@0 | 257 | |
michael@0 | 258 | // Code page 0 |
michael@0 | 259 | add("name", "", 0, 0x05); |
michael@0 | 260 | add("value", "", 0, 0x06); |
michael@0 | 261 | add("name", "NAME", 0, 0x07); |
michael@0 | 262 | add("name", "NAP-ADDRESS", 0, 0x08); |
michael@0 | 263 | add("name", "NAP-ADDRTYPE", 0, 0x09); |
michael@0 | 264 | add("name", "CALLTYPE", 0, 0x0A); |
michael@0 | 265 | add("name", "VALIDUNTIL", 0, 0x0B); |
michael@0 | 266 | add("name", "AUTHTYPE", 0, 0x0C); |
michael@0 | 267 | add("name", "AUTHNAME", 0, 0x0D); |
michael@0 | 268 | add("name", "AUTHSECRET", 0, 0x0E); |
michael@0 | 269 | add("name", "LINGER", 0, 0x0F); |
michael@0 | 270 | add("name", "BEARER", 0, 0x10); |
michael@0 | 271 | add("name", "NAPID", 0, 0x11); |
michael@0 | 272 | add("name", "COUNTRY", 0, 0x12); |
michael@0 | 273 | add("name", "NETWORK", 0, 0x13); |
michael@0 | 274 | add("name", "INTERNET", 0, 0x14); |
michael@0 | 275 | add("name", "PROXY-ID", 0, 0x15); |
michael@0 | 276 | add("name", "PROXY-PROVIDER-ID", 0, 0x16); |
michael@0 | 277 | add("name", "DOMAIN", 0, 0x17); |
michael@0 | 278 | add("name", "PROVURL", 0, 0x18); |
michael@0 | 279 | add("name", "PXAUTH-TYPE", 0, 0x19); |
michael@0 | 280 | add("name", "PXAUTH-ID", 0, 0x1A); |
michael@0 | 281 | add("name", "PXAUTH-PW", 0, 0x1B); |
michael@0 | 282 | add("name", "STARTPAGE", 0, 0x1C); |
michael@0 | 283 | add("name", "BASAUTH-ID", 0, 0x1D); |
michael@0 | 284 | add("name", "BASAUTH-PW", 0, 0x1E); |
michael@0 | 285 | add("name", "PUSHENABLED", 0, 0x1F); |
michael@0 | 286 | add("name", "PXADDR", 0, 0x20); |
michael@0 | 287 | add("name", "PXADDRTYPE", 0, 0x21); |
michael@0 | 288 | add("name", "TO-NAPID", 0, 0x22); |
michael@0 | 289 | add("name", "PORTNBR", 0, 0x23); |
michael@0 | 290 | add("name", "SERVICE", 0, 0x24); |
michael@0 | 291 | add("name", "LINKSPEED", 0, 0x25); |
michael@0 | 292 | add("name", "DNLINKSPEED", 0, 0x26); |
michael@0 | 293 | add("name", "LOCAL-ADDR", 0, 0x27); |
michael@0 | 294 | add("name", "LOCAL-ADDRTYPE", 0, 0x28); |
michael@0 | 295 | add("name", "CONTEXT-ALLOW", 0, 0x29); |
michael@0 | 296 | add("name", "TRUST", 0, 0x2A); |
michael@0 | 297 | add("name", "MASTER", 0, 0x2B); |
michael@0 | 298 | add("name", "SID", 0, 0x2C); |
michael@0 | 299 | add("name", "SOC", 0, 0x2D); |
michael@0 | 300 | add("name", "WSP-VERSION", 0, 0x2E); |
michael@0 | 301 | add("name", "PHYSICAL-PROXY-ID", 0, 0x2F); |
michael@0 | 302 | add("name", "CLIENT-ID", 0, 0x30); |
michael@0 | 303 | add("name", "DELIVERY-ERR-PDU", 0, 0x31); |
michael@0 | 304 | add("name", "DELIVERY-ORDER", 0, 0x32); |
michael@0 | 305 | add("name", "TRAFFIC-CLASS", 0, 0x33); |
michael@0 | 306 | add("name", "MAX-SDU-SIZE", 0, 0x34); |
michael@0 | 307 | add("name", "MAX-BITRATE-UPLINK", 0, 0x35); |
michael@0 | 308 | add("name", "MAX-BITRATE-DNLINK", 0, 0x36); |
michael@0 | 309 | add("name", "RESIDUAL-BER", 0, 0x37); |
michael@0 | 310 | add("name", "SDU-ERROR-RATIO", 0, 0x38); |
michael@0 | 311 | add("name", "TRAFFIC-HANDL-PRIO", 0, 0x39); |
michael@0 | 312 | add("name", "TRANSFER-DELAY", 0, 0x3A); |
michael@0 | 313 | add("name", "GUARANTEED-BITRATE-UPLINK", 0, 0x3B); |
michael@0 | 314 | add("name", "GUARANTEED-BITRATE-DNLINK", 0, 0x3C); |
michael@0 | 315 | add("name", "PXADDR-FQDN", 0, 0x3D); |
michael@0 | 316 | add("name", "PROXY-PW", 0, 0x3E); |
michael@0 | 317 | add("name", "PPGAUTH-TYPE", 0, 0x3F); |
michael@0 | 318 | add("version", "", 0, 0x45); |
michael@0 | 319 | add("version", "1.0", 0, 0x46); |
michael@0 | 320 | add("name", "PULLENABLED", 0, 0x47); |
michael@0 | 321 | add("name", "DNS-ADDR", 0, 0x48); |
michael@0 | 322 | add("name", "MAX-NUM-RETRY", 0, 0x49); |
michael@0 | 323 | add("name", "FIRST-RETRY-TIMEOUT", 0, 0x4A); |
michael@0 | 324 | add("name", "REREG-THRESHOLD", 0, 0x4B); |
michael@0 | 325 | add("name", "T-BIT", 0, 0x4C); |
michael@0 | 326 | add("name", "AUTH-ENTITY", 0, 0x4E); |
michael@0 | 327 | add("name", "SPI", 0, 0x4F); |
michael@0 | 328 | add("type", "", 0, 0x50); |
michael@0 | 329 | add("type", "PXLOGICAL", 0, 0x51); |
michael@0 | 330 | add("type", "PXPHYSICAL", 0, 0x52); |
michael@0 | 331 | add("type", "PORT", 0, 0x53); |
michael@0 | 332 | add("type", "VALIDITY", 0, 0x54); |
michael@0 | 333 | add("type", "NAPDEF", 0, 0x55); |
michael@0 | 334 | add("type", "BOOTSTRAP", 0, 0x56); |
michael@0 | 335 | /* |
michael@0 | 336 | * Mark out VENDORCONFIG so if it is contained in message, parse |
michael@0 | 337 | * will failed and raw data is returned. |
michael@0 | 338 | */ |
michael@0 | 339 | // add("type", "VENDORCONFIG", 0, 0x57); |
michael@0 | 340 | add("type", "CLIENTIDENTITY", 0, 0x58); |
michael@0 | 341 | add("type", "PXAUTHINFO", 0, 0x59); |
michael@0 | 342 | add("type", "NAPAUTHINFO", 0, 0x5A); |
michael@0 | 343 | add("type", "ACCESS", 0, 0x5B); |
michael@0 | 344 | |
michael@0 | 345 | // Code page 1 |
michael@0 | 346 | add("name", "", 1, 0x05); |
michael@0 | 347 | add("value", "", 1, 0x06); |
michael@0 | 348 | add("name", "NAME", 1, 0x07); |
michael@0 | 349 | add("name", "INTERNET", 1, 0x14); |
michael@0 | 350 | add("name", "STARTPAGE", 1, 0x1C); |
michael@0 | 351 | add("name", "TO-NAPID", 1, 0x22); |
michael@0 | 352 | add("name", "PORTNBR", 1, 0x23); |
michael@0 | 353 | add("name", "SERVICE", 1, 0x24); |
michael@0 | 354 | add("name", "AACCEPT", 1, 0x2E); |
michael@0 | 355 | add("name", "AAUTHDATA", 1, 0x2F); |
michael@0 | 356 | add("name", "AAUTHLEVEL", 1, 0x30); |
michael@0 | 357 | add("name", "AAUTHNAME", 1, 0x31); |
michael@0 | 358 | add("name", "AAUTHSECRET", 1, 0x32); |
michael@0 | 359 | add("name", "AAUTHTYPE", 1, 0x33); |
michael@0 | 360 | add("name", "ADDR", 1, 0x34); |
michael@0 | 361 | add("name", "ADDRTYPE", 1, 0x35); |
michael@0 | 362 | add("name", "APPID", 1, 0x36); |
michael@0 | 363 | add("name", "APROTOCOL", 1, 0x37); |
michael@0 | 364 | add("name", "PROVIDER-ID", 1, 0x38); |
michael@0 | 365 | add("name", "TO-PROXY", 1, 0x39); |
michael@0 | 366 | add("name", "URI", 1, 0x3A); |
michael@0 | 367 | add("name", "RULE", 1, 0x3B); |
michael@0 | 368 | add("type", "", 1, 0x50); |
michael@0 | 369 | add("type", "PORT", 1, 0x53); |
michael@0 | 370 | add("type", "APPLICATION", 1, 0x55); |
michael@0 | 371 | add("type", "APPADDR", 1, 0x56); |
michael@0 | 372 | add("type", "APPAUTH", 1, 0x57); |
michael@0 | 373 | add("type", "CLIENTIDENTITY", 1, 0x58); |
michael@0 | 374 | add("type", "RESOURCE", 1, 0x59); |
michael@0 | 375 | |
michael@0 | 376 | return names; |
michael@0 | 377 | })(); |
michael@0 | 378 | |
michael@0 | 379 | /** |
michael@0 | 380 | * Value Tokens |
michael@0 | 381 | * |
michael@0 | 382 | * @see OMA-WAP-TS-ProvCont-V1_1-20090421-C, clause 7.3 |
michael@0 | 383 | */ |
michael@0 | 384 | const CP_VALUE_FIELDS = (function () { |
michael@0 | 385 | let names = {}; |
michael@0 | 386 | function add(value, codepage, number) { |
michael@0 | 387 | let entry = { |
michael@0 | 388 | value: value, |
michael@0 | 389 | number: number, |
michael@0 | 390 | }; |
michael@0 | 391 | if (!names[codepage]) { |
michael@0 | 392 | names[codepage] = {}; |
michael@0 | 393 | } |
michael@0 | 394 | names[codepage][number] = entry; |
michael@0 | 395 | } |
michael@0 | 396 | |
michael@0 | 397 | // Code page 0 |
michael@0 | 398 | add("IPV4", 0, 0x85); |
michael@0 | 399 | add("IPV6", 0, 0x86); |
michael@0 | 400 | add("E164", 0, 0x87); |
michael@0 | 401 | add("ALPHA", 0, 0x88); |
michael@0 | 402 | add("APN", 0, 0x89); |
michael@0 | 403 | add("SCODE", 0, 0x8A); |
michael@0 | 404 | add("TETRA-ITSI", 0, 0x8B); |
michael@0 | 405 | add("MAN", 0, 0x8C); |
michael@0 | 406 | add("ANALOG-MODEM", 0, 0x90); |
michael@0 | 407 | add("V.120", 0, 0x91); |
michael@0 | 408 | add("V.110", 0, 0x92); |
michael@0 | 409 | add("X.31", 0, 0x93); |
michael@0 | 410 | add("BIT-TRANSPARENT", 0, 0x94); |
michael@0 | 411 | add("DIRECT-ASYNCHRONOUS-DATA-SERVICE", 0, 0x95); |
michael@0 | 412 | add("PAP", 0, 0x9A); |
michael@0 | 413 | add("CHAP", 0, 0x9B); |
michael@0 | 414 | add("HTTP-BASIC", 0, 0x9C); |
michael@0 | 415 | add("HTTP-DIGEST", 0, 0x9D); |
michael@0 | 416 | add("WTLS-SS", 0, 0x9E); |
michael@0 | 417 | add("MD5", 0, 0x9F); // Added in OMA, 7.3.3 |
michael@0 | 418 | add("GSM-USSD", 0, 0xA2); |
michael@0 | 419 | add("GSM-SMS", 0, 0xA3); |
michael@0 | 420 | add("ANSI-136-GUTS", 0, 0xA4); |
michael@0 | 421 | add("IS-95-CDMA-SMS", 0, 0xA5); |
michael@0 | 422 | add("IS-95-CDMA-CSD", 0, 0xA6); |
michael@0 | 423 | add("IS-95-CDMA-PAC", 0, 0xA7); |
michael@0 | 424 | add("ANSI-136-CSD", 0, 0xA8); |
michael@0 | 425 | add("ANSI-136-GPRS", 0, 0xA9); |
michael@0 | 426 | add("GSM-CSD", 0, 0xAA); |
michael@0 | 427 | add("GSM-GPRS", 0, 0xAB); |
michael@0 | 428 | add("AMPS-CDPD", 0, 0xAC); |
michael@0 | 429 | add("PDC-CSD", 0, 0xAD); |
michael@0 | 430 | add("PDC-PACKET", 0, 0xAE); |
michael@0 | 431 | add("IDEN-SMS", 0, 0xAF); |
michael@0 | 432 | add("IDEN-CSD", 0, 0xB0); |
michael@0 | 433 | add("IDEN-PACKET", 0, 0xB1); |
michael@0 | 434 | add("FLEX/REFLEX", 0, 0xB2); |
michael@0 | 435 | add("PHS-SMS", 0, 0xB3); |
michael@0 | 436 | add("PHS-CSD", 0, 0xB4); |
michael@0 | 437 | add("TETRA-SDS", 0, 0xB5); |
michael@0 | 438 | add("TETRA-PACKET", 0, 0xB6); |
michael@0 | 439 | add("ANSI-136-GHOST", 0, 0xB7); |
michael@0 | 440 | add("MOBITEX-MPAK", 0, 0xB8); |
michael@0 | 441 | add("CDMA2000-1X-SIMPLE-IP", 0, 0xB9); // Added in OMA, 7.3.4 |
michael@0 | 442 | add("CDMA2000-1X-MOBILE-IP", 0, 0xBA); // Added in OMA, 7.3.4 |
michael@0 | 443 | add("AUTOBOUDING", 0, 0xC5); |
michael@0 | 444 | add("CL-WSP", 0, 0xCA); |
michael@0 | 445 | add("CO-WSP", 0, 0xCB); |
michael@0 | 446 | add("CL-SEC-WSP", 0, 0xCC); |
michael@0 | 447 | add("CO-SEC-WSP", 0, 0xCD); |
michael@0 | 448 | add("CL-SEC-WTA", 0, 0xCE); |
michael@0 | 449 | add("CO-SEC-WTA", 0, 0xCF); |
michael@0 | 450 | add("OTA-HTTP-TO", 0, 0xD0); // Added in OMA, 7.3.6 |
michael@0 | 451 | add("OTA-HTTP-TLS-TO", 0, 0xD1); // Added in OMA, 7.3.6 |
michael@0 | 452 | add("OTA-HTTP-PO", 0, 0xD2); // Added in OMA, 7.3.6 |
michael@0 | 453 | add("OTA-HTTP-TLS-PO", 0, 0xD3); // Added in OMA, 7.3.6 |
michael@0 | 454 | add("AAA", 0, 0xE0); // Added in OMA, 7.3.8 |
michael@0 | 455 | add("HA", 0, 0xE1); // Added in OMA, 7.3.8 |
michael@0 | 456 | |
michael@0 | 457 | // Code page 1 |
michael@0 | 458 | add("IPV6", 1, 0x86); |
michael@0 | 459 | add("E164", 1, 0x87); |
michael@0 | 460 | add("ALPHA", 1, 0x88); |
michael@0 | 461 | add("APPSRV", 1, 0x8D); |
michael@0 | 462 | add("OBEX", 1, 0x8E); |
michael@0 | 463 | add(",", 1, 0x90); |
michael@0 | 464 | add("HTTP-", 1, 0x91); |
michael@0 | 465 | add("BASIC", 1, 0x92); |
michael@0 | 466 | add("DIGEST", 1, 0x93); |
michael@0 | 467 | |
michael@0 | 468 | return names; |
michael@0 | 469 | })(); |
michael@0 | 470 | |
michael@0 | 471 | let debug; |
michael@0 | 472 | if (DEBUG) { |
michael@0 | 473 | debug = function (s) { |
michael@0 | 474 | dump("-$- CpPduHelper: " + s + "\n"); |
michael@0 | 475 | }; |
michael@0 | 476 | } else { |
michael@0 | 477 | debug = function (s) {}; |
michael@0 | 478 | } |
michael@0 | 479 | |
michael@0 | 480 | this.EXPORTED_SYMBOLS = [ |
michael@0 | 481 | // Parser |
michael@0 | 482 | "PduHelper", |
michael@0 | 483 | // HMAC Authenticator |
michael@0 | 484 | "Authenticator", |
michael@0 | 485 | ]; |