|
reSIProcate/rutil
9694
|
#include <algorithm>#include <cassert>#include <ctype.h>#include <math.h>#include <limits.h>#include "rutil/Data.hxx"#include "rutil/ParseBuffer.hxx"#include "rutil/vmd5.hxx"#include "rutil/Coders.hxx"#include "rutil/WinLeakCheck.hxx"
Go to the source code of this file.
Defines | |
| #define | get16bits(d) |
| #define | get32bits(d) ((get16bits(d+2) << 16) + get16bits(d)) |
| #define | compUnalignedRemainder(d1, d2, size) |
Functions | |
| int | hexpair2int (char high, char low) |
| bool | urlNonEncodedCharsInitFn () |
| Data | bits (size_t v) |
| HashValueImp (resip::Data, data.hash()) | |
Variables | |
| static const char | hexmap [] = "0123456789abcdef" |
| static const int | IntMaxSize = 12 |
| static const int | MaxLongSize = (sizeof(unsigned long)/sizeof(int))*IntMaxSize |
| static const int | DoubleMaxSize = MaxLongSize + Data::MaxDigitPrecision |
| static const int | UInt64MaxSize = 20 |
| static const int | CharMaxSize = 1 |
| bool | urlNonEncodedChars [256] = {false} |
| static bool | dummy = urlNonEncodedCharsInitFn() |
| static const unsigned char | randomPermutation [256] |
| static signed char | base64Lookup [128] |
| static unsigned char | codeCharUnsafe [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" |
| static unsigned char | codeCharSafe [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_." |
| #define compUnalignedRemainder | ( | d1, | |
| d2, | |||
| size | |||
| ) |
switch(size) \ {\ case 3: \ if( (*d1 ^ *d2) & 0xDF) \ { \ return false; \ } \ d1++; \ d2++; \ /* fallthrough */ \ case 2: \ if((get16bits(d1) ^ get16bits(d2)) & 0xDFDF) \ { \ return false; \ } \ d1+=2; \ d2+=2; \ break; \ case 1: \ if( (*d1 ^ *d2) & 0xDF) \ { \ return false; \ } \ d1++; \ d2++; \ /* fallthrough */ \ default: \ ; \ }\
Definition at line 2121 of file Data.cxx.
Referenced by resip::Data::sizeEqualCaseInsensitiveTokenCompare().
| #define get16bits | ( | d | ) |
| #define get32bits | ( | d | ) | ((get16bits(d+2) << 16) + get16bits(d)) |
Definition at line 1988 of file Data.cxx.
Referenced by resip::Data::rawCaseInsensitiveTokenHash(), and resip::Data::sizeEqualCaseInsensitiveTokenCompare().
| Data bits | ( | size_t | v | ) |
| HashValueImp | ( | resip::Data | , |
| data. | hash() | ||
| ) |
| int hexpair2int | ( | char | high, |
| char | low | ||
| ) |
Definition at line 56 of file Data.cxx.
Referenced by resip::Data::urlDecode().
{
int val;
switch(high)
{
case '0':
val = 0x00;
break;
case '1':
val = 0x10;
break;
case '2':
val = 0x20;
break;
case '3':
val = 0x30;
break;
case '4':
val = 0x40;
break;
case '5':
val = 0x50;
break;
case '6':
val = 0x60;
break;
case '7':
val = 0x70;
break;
case '8':
val = 0x80;
break;
case '9':
val = 0x90;
break;
case 'A':
case 'a':
val = 0xA0;
break;
case 'B':
case 'b':
val = 0xB0;
break;
case 'C':
case 'c':
val = 0xC0;
break;
case 'D':
case 'd':
val = 0xD0;
break;
case 'E':
case 'e':
val = 0xE0;
break;
case 'F':
case 'f':
val = 0xF0;
break;
default:
return '?';
break;
}
switch(low)
{
case '0':
if (!val)
{
return '?';
}
break;
case '1':
val += 0x01;
break;
case '2':
val += 0x02;
break;
case '3':
val += 0x03;
break;
case '4':
val += 0x04;
break;
case '5':
val += 0x05;
break;
case '6':
val += 0x06;
break;
case '7':
val += 0x07;
break;
case '8':
val += 0x08;
break;
case '9':
val += 0x09;
break;
case 'A':
case 'a':
val += 0x0A;
break;
case 'B':
case 'b':
val += 0x0B;
break;
case 'C':
case 'c':
val += 0x0C;
break;
case 'D':
case 'd':
val += 0x0D;
break;
case 'E':
case 'e':
val += 0x0E;
break;
case 'F':
case 'f':
val += 0x0F;
break;
default:
return '?';
break;
}
return val;
}
| bool urlNonEncodedCharsInitFn | ( | ) |
Definition at line 1325 of file Data.cxx.
References urlNonEncodedChars.
{
// query part of HTTP URL can be a pchar, slash, or question
// pchar is unreserved, subdelims, colon, at-sign
for (int i = 0; i < 256; ++i)
{
unsigned char c(i);
urlNonEncodedChars[c] = (isalpha(c) || // unreserved
isdigit(c) || // unreserved
c == '-' || // these first 4 are unreserved
c == '_' ||
c == '.' ||
c == '~' ||
c == '!' || // these are subdelims (allowed in pchars)
c == '$' ||
// c == '&' || // while these are allowed subdelims, this is an error
// c == '+' || // I believe this is an error as well.
c == '\'' ||
c == '(' ||
c == ')' ||
c == '*' ||
c == ',' ||
c == ';' ||
c == '=' ||
c == ':' || // next two explicitly allowed in pchar
c == '@' ||
c == '/' || // next two explicitly allowed in query in addition to pchar
c == '?');
}
return false;
}
signed char base64Lookup[128] [static] |
{
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,62,-1,62,-2,63,52,53,
54,55,56,57,58,59,60,61,-1,-1,
-1,-2,-1,-1,-1,0, 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,-1,-1,-1,-1,63,-1,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,-1,-1,-1,-1,-1
}
Definition at line 2277 of file Data.cxx.
Referenced by resip::Data::base64decode().
const int CharMaxSize = 1 [static] |
unsigned char codeCharSafe[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_." [static] |
Definition at line 2366 of file Data.cxx.
Referenced by resip::Data::base64encode().
unsigned char codeCharUnsafe[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" [static] |
Definition at line 2364 of file Data.cxx.
Referenced by resip::Data::base64encode().
const int DoubleMaxSize = MaxLongSize + Data::MaxDigitPrecision [static] |
const char hexmap[] = "0123456789abcdef" [static] |
Definition at line 53 of file Data.cxx.
Referenced by resip::Data::charEncoded(), resip::Data::charUnencoded(), resip::Data::escaped(), resip::Data::hex(), toHex(), and resip::Data::urlEncode().
const int IntMaxSize = 12 [static] |
const int MaxLongSize = (sizeof(unsigned long)/sizeof(int))*IntMaxSize [static] |
const unsigned char randomPermutation[256] [static] |
{
44, 9, 46, 184, 21, 30, 92, 231, 79, 7, 166, 237, 173, 72, 91, 123,
212, 183, 16, 99, 85, 45, 190, 130, 118, 107, 169, 119, 100, 179, 251, 177,
23, 125, 12, 101, 121, 246, 61, 38, 156, 114, 159, 57, 181, 145, 198, 182,
58, 215, 174, 225, 82, 178, 150, 161, 63, 103, 32, 203, 68, 151, 139, 55,
143, 2, 36, 110, 209, 154, 204, 89, 62, 17, 187, 226, 31, 105, 195, 208,
49, 56, 238, 172, 37, 3, 234, 206, 134, 233, 19, 148, 64, 4, 10, 224,
144, 88, 93, 191, 20, 131, 138, 199, 243, 244, 39, 50, 214, 87, 6, 84,
185, 112, 171, 75, 192, 193, 239, 69, 106, 43, 194, 1, 78, 67, 116, 200,
83, 70, 213, 25, 59, 137, 52, 13, 153, 42, 232, 0, 133, 210, 76, 33,
255, 236, 124, 104, 65, 201, 53, 155, 140, 254, 54, 196, 120, 146, 216, 29,
28, 86, 245, 90, 98, 26, 81, 115, 180, 66, 102, 136, 167, 51, 109, 132,
77, 175, 14, 202, 222, 48, 223, 188, 40, 242, 157, 5, 128, 229, 71, 127,
164, 207, 247, 8, 80, 149, 94, 160, 47, 117, 135, 176, 129, 142, 189, 97,
11, 250, 221, 218, 96, 220, 35, 197, 152, 126, 219, 74, 170, 252, 163, 41,
95, 27, 34, 22, 205, 230, 241, 186, 168, 228, 253, 249, 113, 108, 111, 211,
235, 217, 165, 122, 15, 141, 158, 147, 240, 24, 162, 18, 60, 73, 227, 248
}
Definition at line 1890 of file Data.cxx.
Referenced by resip::Data::rawCaseInsensitiveHash(), and resip::Data::rawHash().
const int UInt64MaxSize = 20 [static] |
| bool urlNonEncodedChars[256] = {false} |
Definition at line 1323 of file Data.cxx.
Referenced by resip::Data::urlEncode(), and urlNonEncodedCharsInitFn().
1.7.5.1