private TSIP_HeaderWWWAuthenticate(THTTP_HeaderWWWAuthenticate embeddedHeader)
     : base(tsip_header_type_t.WWW_Authenticate)
 {
     mEmbeddedHeader = embeddedHeader;
 }
        /* #line 222 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
        public static THTTP_HeaderWWWAuthenticate Parse(String data)
        {
            int cs = 0;
            int p = 0;
            int pe = data.Length;
            int eof = pe;
            THTTP_HeaderWWWAuthenticate hdr_WWW_Authenticate = new THTTP_HeaderWWWAuthenticate();

            int tag_start = 0;

            /* #line 8801 "../Headers/THTTP_HeaderWWWAuthenticate.cs" */
            {
            cs = thttp_machine_parser_header_WWW_Authenticate_start;
            }

            /* #line 235 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */

            /* #line 8808 "../Headers/THTTP_HeaderWWWAuthenticate.cs" */
            {
            sbyte _klen;
            short _trans;
            sbyte _acts;
            sbyte _nacts;
            short _keys;

            if ( p == pe )
            goto _test_eof;
            if ( cs == 0 )
            goto _out;
            _resume:
            _keys = _thttp_machine_parser_header_WWW_Authenticate_key_offsets[cs];
            _trans = (short)_thttp_machine_parser_header_WWW_Authenticate_index_offsets[cs];

            _klen = _thttp_machine_parser_header_WWW_Authenticate_single_lengths[cs];
            if ( _klen > 0 ) {
            short _lower = _keys;
            short _mid;
            short _upper = (short) (_keys + _klen - 1);
            while (true) {
            if ( _upper < _lower )
                break;

            _mid = (short) (_lower + ((_upper-_lower) >> 1));
            if ( data[p] < _thttp_machine_parser_header_WWW_Authenticate_trans_keys[_mid] )
                _upper = (short) (_mid - 1);
            else if ( data[p] > _thttp_machine_parser_header_WWW_Authenticate_trans_keys[_mid] )
                _lower = (short) (_mid + 1);
            else {
                _trans += (short) (_mid - _keys);
                goto _match;
            }
            }
            _keys += (short) _klen;
            _trans += (short) _klen;
            }

            _klen = _thttp_machine_parser_header_WWW_Authenticate_range_lengths[cs];
            if ( _klen > 0 ) {
            short _lower = _keys;
            short _mid;
            short _upper = (short) (_keys + (_klen<<1) - 2);
            while (true) {
            if ( _upper < _lower )
                break;

            _mid = (short) (_lower + (((_upper-_lower) >> 1) & ~1));
            if ( data[p] < _thttp_machine_parser_header_WWW_Authenticate_trans_keys[_mid] )
                _upper = (short) (_mid - 2);
            else if ( data[p] > _thttp_machine_parser_header_WWW_Authenticate_trans_keys[_mid+1] )
                _lower = (short) (_mid + 2);
            else {
                _trans += (short)((_mid - _keys)>>1);
                goto _match;
            }
            }
            _trans += (short) _klen;
            }

            _match:
            _trans = (short)_thttp_machine_parser_header_WWW_Authenticate_indicies[_trans];
            cs = _thttp_machine_parser_header_WWW_Authenticate_trans_targs[_trans];

            if ( _thttp_machine_parser_header_WWW_Authenticate_trans_actions[_trans] == 0 )
            goto _again;

            _acts = _thttp_machine_parser_header_WWW_Authenticate_trans_actions[_trans];
            _nacts = _thttp_machine_parser_header_WWW_Authenticate_actions[_acts++];
            while ( _nacts-- > 0 )
            {
            switch ( _thttp_machine_parser_header_WWW_Authenticate_actions[_acts++] )
            {
            case 0:
            /* #line 31 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            tag_start = p;
            }
            break;
            case 1:
            /* #line 35 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            hdr_WWW_Authenticate.Scheme = "Digest";
            }
            break;
            case 2:
            /* #line 39 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            hdr_WWW_Authenticate.Scheme = "Basic";
            }
            break;
            case 3:
            /* #line 43 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            hdr_WWW_Authenticate.mType = thttp_header_type_t.WWW_Authenticate;
            }
            break;
            case 4:
            /* #line 47 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            hdr_WWW_Authenticate.mType = thttp_header_type_t.Proxy_Authenticate;
            }
            break;
            case 5:
            /* #line 51 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            hdr_WWW_Authenticate.Realm = TSK_String.UnQuote(TSK_RagelState.Parser.GetString(data, p, tag_start));
            }
            break;
            case 6:
            /* #line 55 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            hdr_WWW_Authenticate.Domain = TSK_RagelState.Parser.GetString(data, p, tag_start);
            }
            break;
            case 7:
            /* #line 59 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            hdr_WWW_Authenticate.Nonce = TSK_String.UnQuote(TSK_RagelState.Parser.GetString(data, p, tag_start));
            }
            break;
            case 8:
            /* #line 63 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            hdr_WWW_Authenticate.Opaque = TSK_String.UnQuote(TSK_RagelState.Parser.GetString(data, p, tag_start));
            }
            break;
            case 9:
            /* #line 67 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            String stale = TSK_RagelState.Parser.GetString(data, p, tag_start);
            hdr_WWW_Authenticate.Stale = String.Equals(stale, "true", StringComparison.InvariantCultureIgnoreCase);
            }
            break;
            case 10:
            /* #line 72 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            hdr_WWW_Authenticate.Algorithm = TSK_RagelState.Parser.GetString(data, p, tag_start);
            }
            break;
            case 11:
            /* #line 76 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            hdr_WWW_Authenticate.Qop = TSK_RagelState.Parser.GetString(data, p, tag_start);
            }
            break;
            case 12:
            /* #line 80 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            hdr_WWW_Authenticate.Params = TSK_RagelState.Parser.AddParam(data, p, tag_start, hdr_WWW_Authenticate.Params);
            }
            break;
            case 13:
            /* #line 88 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
            {
            }
            break;
            /* #line 8966 "../Headers/THTTP_HeaderWWWAuthenticate.cs" */
            default: break;
            }
            }

            _again:
            if ( cs == 0 )
            goto _out;
            if ( ++p != pe )
            goto _resume;
            _test_eof: {}
            _out: {}
            }

            /* #line 236 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */

            if( cs <
            /* #line 8983 "../Headers/THTTP_HeaderWWWAuthenticate.cs" */
            1738
            /* #line 237 "./ragel/thttp_parser_header_WWW_Authenticate.rl" */
             ){
                TSK_Debug.Error("Failed to parse SIP 'WWW-Authenticate' header.");
                hdr_WWW_Authenticate.Dispose();
                hdr_WWW_Authenticate = null;
            }

            return hdr_WWW_Authenticate;
        }