Quellcode durchsuchen

Faster parse_hname function, hash table removed, several minor optimizations

Jan Janak vor 23 Jahren
Ursprung
Commit
32822438ca

+ 10 - 11
parser/case_allo.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Allow header field parser macros
+ * Allow Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -27,18 +27,17 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-
 #ifndef CASE_ALLO_H
 #define CASE_ALLO_H
 
 
-#define Allo_CASE                     \
-    p += 4;                           \
-    if ((*p == 'w') || (*p == 'W')) { \
-            hdr->type = HDR_ALLOW;    \
-            p++;                      \
-	    goto dc_end;              \
-    }                                 \
+#define allo_CASE                  \
+    p += 4;                        \
+    if (LOWER_BYTE(*p) == 'w') {   \
+            hdr->type = HDR_ALLOW; \
+            p++;                   \
+	    goto dc_end;           \
+    }                              \
     goto other;
 
 

+ 12 - 22
parser/case_auth.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Authoriazation header field parser macros
+ * Authorization Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -27,17 +27,15 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-
 #ifndef CASE_AUTH_H
 #define CASE_AUTH_H
 
 
 #define AUTH_ATIO_CASE                                 \
-        if (val == _atio_) {                           \
+        if (LOWER_DWORD(val) == _atio_) {              \
 	        p += 4;                                \
-		switch(*p) {                           \
+		switch(LOWER_BYTE(*p)) {               \
 		case 'n':                              \
-		case 'N':                              \
 		        hdr->type = HDR_AUTHORIZATION; \
 			p++;                           \
 			goto dc_end;                   \
@@ -47,27 +45,19 @@
 	}
 	             
 
-#define AUTH_ORIZ_CASE            \
-        if (val == _oriz_) {      \
-                p += 4;           \
-	        val = READ(p);    \
-	        AUTH_ATIO_CASE;   \
-          			  \
-                val = unify(val); \
-	        AUTH_ATIO_CASE;   \
-                                  \
-                goto other;       \
+#define AUTH_ORIZ_CASE                     \
+        if (LOWER_DWORD(val) == _oriz_) {  \
+                p += 4;                    \
+	        val = READ(p);             \
+	        AUTH_ATIO_CASE;            \
+                goto other;                \
         }
 
 
-#define Auth_CASE      \
+#define auth_CASE      \
      p += 4;           \
      val = READ(p);    \
      AUTH_ORIZ_CASE;   \
-                       \
-     val = unify(val); \
-     AUTH_ORIZ_CASE;   \
-                       \
      goto other;
 
 

+ 7 - 11
parser/case_call.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Call-ID header field parser macros
+ * Call-ID Header Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -33,28 +33,24 @@
 
 
 #define ID_CASE                      \
-     switch(val) {                   \
-     case __ID1_:                    \
+     switch(LOWER_DWORD(val)) {      \
+     case __id1_:                    \
 	     hdr->type = HDR_CALLID; \
 	     hdr->name.len = 7;      \
 	     *(p + 3) = '\0';        \
 	     return (p + 4);         \
 	                             \
-     case __ID2_:                    \
+     case __id2_:                    \
 	     hdr->type = HDR_CALLID; \
 	     p += 4;                 \
 	     goto dc_end;            \
      }
 
 
-#define Call_CASE      \
+#define call_CASE      \
      p += 4;           \
      val = READ(p);    \
      ID_CASE;          \
-                       \
-     val = unify(val); \
-     ID_CASE;          \
-                       \
      goto other;
 
 

+ 11 - 17
parser/case_cont.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Contact, Content-Type, Content-Length header field parser macros
+ * Contact, Content-Type, Content-Length Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -33,7 +33,7 @@
 
 
 #define TH_CASE                                        \
-        switch(val) {                                  \
+        switch(LOWER_DWORD(val)) {                     \
         case _th12_:                                   \
                 hdr->type = HDR_CONTENTLENGTH;         \
                 hdr->name.len = 14;                    \
@@ -41,9 +41,9 @@
                 return (p + 4);                        \
         }                                              \
                                                        \
-        if ((*p == 't') || (*p == 'T')) {              \
+        if (LOWER_BYTE(*p) == 't') {                   \
                 p++;                                   \
-                if ((*p == 'h') || (*p == 'H')) {      \
+                if (LOWER_BYTE(*p) == 'h') {           \
                         hdr->type = HDR_CONTENTLENGTH; \
                         p++;                           \
                         goto dc_end;                   \
@@ -52,14 +52,14 @@
 
 
 #define LENG_TYPE_CASE                       \
-        switch(val) {                        \
-        case _Leng_:                         \
+        switch(LOWER_DWORD(val)) {            \
+        case _leng_:                         \
                 p += 4;                      \
                 val = READ(p);               \
                 TH_CASE;                     \
                 goto other;                  \
                                              \
-        case _Type_:                         \
+        case _type_:                         \
                 hdr->type = HDR_CONTENTTYPE; \
                 p += 4;                      \
                 goto dc_end;                 \
@@ -67,7 +67,7 @@
 
 
 #define ACT_ENT_CASE                     \
-        switch(val) {                    \
+        switch(LOWER_DWORD(val)) {       \
         case _act1_:                     \
 	        hdr->type = HDR_CONTACT; \
 	        hdr->name.len = 7;       \
@@ -82,20 +82,14 @@
         case _ent__:                     \
                 p += 4;                  \
                 val = READ(p);           \
-                LENG_TYPE_CASE;          \
-                                         \
-                val = unify(val);        \
                 LENG_TYPE_CASE;          \
                 goto other;              \
         }                         
 
 
-#define Cont_CASE      \
+#define cont_CASE      \
      p += 4;           \
      val = READ(p);    \
-     ACT_ENT_CASE;     \
-                       \
-     val = unify(val); \
      ACT_ENT_CASE;     \
      goto other;
 

+ 4 - 4
parser/case_cseq.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * CSeq header field parser macros
+ * CSeq Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -32,7 +32,7 @@
 #define CASE_CSEQ_H
 
 
-#define CSeq_CASE          \
+#define cseq_CASE          \
      hdr->type = HDR_CSEQ; \
      p += 4;               \
      goto dc_end

+ 5 - 5
parser/case_even.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Event header field parser macros
+ * Event Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -32,9 +32,9 @@
 #define CASE_EVEN_H
 
 
-#define Even_CASE                     \
+#define even_CASE                     \
     p += 4;                           \
-    if ((*p == 't') || (*p == 'T')) { \
+    if (LOWER_BYTE(*p) == 't') {      \
             hdr->type = HDR_EVENT;    \
             p++;                      \
 	    goto dc_end;              \

+ 5 - 8
parser/case_expi.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Expires header field parser macros
+ * Expires Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -33,7 +33,7 @@
 
 
 #define EXPI_RES_CASE                    \
-        switch(val) {                    \
+        switch(LOWER_DWORD(val)) {       \
         case _res1_:                     \
 		hdr->type = HDR_EXPIRES; \
 		hdr->name.len = 7;       \
@@ -47,12 +47,9 @@
         }
 
 
-#define Expi_CASE         \
+#define expi_CASE         \
         p += 4;           \
         val = READ(p);    \
-        EXPI_RES_CASE;    \
-                          \
-        val = unify(val); \
         EXPI_RES_CASE;    \
         goto other;
 

+ 4 - 4
parser/case_from.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * From header field parser macros
+ * From Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -32,7 +32,7 @@
 #define CASE_FROM_H
 
 
-#define From_CASE             \
+#define from_CASE             \
         hdr->type = HDR_FROM; \
         p += 4;               \
         goto dc_end

+ 12 - 18
parser/case_max.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Max-Forwards header field parser macros
+ * Max-Forwards Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -33,32 +33,26 @@
 
 
 #define ARDS_CASE                            \
-        if (val == _ards_) {                 \
+        if (LOWER_DWORD(val) == _ards_) {    \
 	        hdr->type = HDR_MAXFORWARDS; \
 	        p += 4;                      \
 		goto dc_end;                 \
 	}
 
 
-#define FORW_CASE                 \
-        switch(val) {             \
-        case _Forw_:              \
-	        p += 4;           \
-	        val = READ(p);    \
-                ARDS_CASE;        \
-                                  \
-	        val = unify(val); \
-		ARDS_CASE;        \
-	        goto other;       \
+#define FORW_CASE                  \
+        switch(LOWER_DWORD(val)) { \
+        case _forw_:               \
+	        p += 4;            \
+	        val = READ(p);     \
+                ARDS_CASE;         \
+	        goto other;        \
         }                                             
 
 
-#define Max_CASE       \
+#define max_CASE       \
      p += 4;           \
      val = READ(p);    \
-     FORW_CASE;        \
-                       \
-     val = unify(val); \
      FORW_CASE;        \
      goto other;       \
 

+ 35 - 51
parser/case_prox.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Proxy-Authorization and Proxy-Require header field parser macros
+ * Proxy-Require, Proxy-Authorization Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -33,7 +33,7 @@
 
 
 #define ION_CASE                           \
-        switch(val) {                      \
+        switch(LOWER_DWORD(val)) {         \
         case _ion1_:                       \
 	        hdr->type = HDR_PROXYAUTH; \
 	        hdr->name.len = 19;        \
@@ -47,39 +47,32 @@
         }
 
 
-#define IZAT_CASE                 \
-        switch(val) {             \
-        case _izat_:              \
-                p += 4;           \
-                val = READ(p);    \
-                ION_CASE;         \
-                                  \
-                val = unify(val); \
-                ION_CASE;         \
-                goto other;       \
+#define IZAT_CASE                  \
+        switch(LOWER_DWORD(val)) { \
+        case _izat_:               \
+                p += 4;            \
+                val = READ(p);     \
+                ION_CASE;          \
+                goto other;        \
         }
 
 
-#define THOR_CASE                 \
-        switch(val) {             \
-        case _thor_:              \
-                p += 4;           \
-                val = READ(p);    \
-                IZAT_CASE;        \
-                                  \
-                val = unify(val); \
-                IZAT_CASE;        \
-                goto other;       \
+#define THOR_CASE                  \
+        switch(LOWER_DWORD(val)) { \
+        case _thor_:               \
+                p += 4;            \
+                val = READ(p);     \
+                IZAT_CASE;         \
+                goto other;        \
         }
 
 
 #define QUIR_CASE                                     \
-        switch(val) {                                 \
+        switch(LOWER_DWORD(val)) {                    \
         case _quir_:                                  \
 	        p += 4;                               \
-                switch(*p) {                          \
+                switch(LOWER_BYTE(*p)) {              \
                 case 'e':                             \
-                case 'E':                             \
                         hdr->type = HDR_PROXYREQUIRE; \
 	                p++;                          \
                         goto dc_end;                  \
@@ -88,36 +81,27 @@
         }
 
 
-#define PROX2_CASE                \
-        switch(val) {             \
-        case _y_Au_:              \
-                p += 4;           \
-                val = READ(p);    \
-                THOR_CASE;        \
-                                  \
-                val = unify(val); \
-                THOR_CASE;        \
-                goto other;       \
-                                  \
-        case _y_Re_:              \
-                p += 4;           \
-                val = READ(p);    \
-                QUIR_CASE;        \
-                                  \
-                val = unify(val); \
-                QUIR_CASE;        \
-                goto other;       \
+#define PROX2_CASE                 \
+        switch(LOWER_DWORD(val)) { \
+        case _y_au_:               \
+                p += 4;            \
+                val = READ(p);     \
+                THOR_CASE;         \
+                goto other;        \
+                                   \
+        case _y_re_:               \
+                p += 4;            \
+                val = READ(p);     \
+                QUIR_CASE;         \
+                goto other;        \
         }
 
 
-#define Prox_CASE         \
+#define prox_CASE         \
         p += 4;           \
         val = READ(p);    \
         PROX2_CASE;       \
-                          \
-        val = unify(val); \
-        PROX2_CASE;       \
-        goto other;
+         goto other;
 
 
 #endif /* CASE_PROX_H */

+ 12 - 18
parser/case_reco.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Record-Route header field parser macros
+ * Record-Route Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -33,32 +33,26 @@
 
 
 #define OUTE_CASE                            \
-        if (val == _oute_) {                 \
+        if (LOWER_DWORD(val) == _oute_) {    \
 	        hdr->type = HDR_RECORDROUTE; \
 		p += 4;                      \
 		goto dc_end;                 \
 	}                                    \
 
 
-#define RD_R_CASE                 \
-        switch(val) {             \
-        case _rd_R_:              \
-	        p += 4;           \
-	        val = READ(p);    \
-		OUTE_CASE;        \
-                                  \
-	        val = unify(val); \
-		OUTE_CASE;        \
-	        goto other;       \
+#define RD_R_CASE                  \
+        switch(LOWER_DWORD(val)) { \
+        case _rd_r_:               \
+	        p += 4;            \
+	        val = READ(p);     \
+		OUTE_CASE;         \
+	        goto other;        \
         }
 
 
-#define Reco_CASE         \
+#define reco_CASE         \
         p += 4;           \
         val = READ(p);    \
-        RD_R_CASE;        \
-                          \
-        val = unify(val); \
         RD_R_CASE;        \
         goto other;
 

+ 5 - 8
parser/case_requ.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Require header field parser macros
+ * Require Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -33,7 +33,7 @@
 
 
 #define IRE_CASE                         \
-        switch(val) {                    \
+        switch(LOWER_DWORD(val)) {       \
         case _ire1_:                     \
                 hdr->type = HDR_REQUIRE; \
                 hdr->name.len = 7;       \
@@ -47,12 +47,9 @@
         }
 
 
-#define Requ_CASE         \
+#define requ_CASE         \
         p += 4;           \
         val = READ(p);    \
-        IRE_CASE;         \
-                          \
-        val = unify(val); \
         IRE_CASE;         \
         goto other;
 

+ 5 - 6
parser/case_rout.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Route header field parser macros
+ * Route Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -32,11 +32,10 @@
 #define CASE_ROUT_H
 
 
-#define Rout_CASE                   \
+#define rout_CASE                   \
      p += 4;                        \
-     switch(*p) {                   \
+     switch(LOWER_BYTE(*p)) {       \
      case 'e':                      \
-     case 'E':                      \
 	     hdr->type = HDR_ROUTE; \
 	     p++;                   \
 	     goto dc_end;           \

+ 6 - 9
parser/case_supp.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Supported header field parser macros
+ * Supported Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -33,10 +33,10 @@
 
 
 #define ORTE_CASE                                  \
-        switch(val) {                              \
+        switch(LOWER_DWORD(val)) {                 \
         case _orte_:                               \
 	        p += 4;                            \
-	        if ((*p == 'd') || (*p == 'D')) {  \
+	        if (LOWER_BYTE(*p) == 'd') {       \
 		        hdr->type = HDR_SUPPORTED; \
                         p++;                       \
                         goto dc_end;               \
@@ -45,12 +45,9 @@
         }
 
 
-#define Supp_CASE         \
+#define supp_CASE         \
         p += 4;           \
         val = READ(p);    \
-        ORTE_CASE;        \
-                          \
-        val = unify(val); \
         ORTE_CASE;        \
         goto other;
 

+ 4 - 4
parser/case_to.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * To header field parser macros
+ * To Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -32,7 +32,7 @@
 #define CASE_TO_H
 
 
-#define To12_CASE           \
+#define to12_CASE           \
         hdr->type = HDR_TO; \
         hdr->name.len = 2;  \
         *(p + 2) = '\0';    \

+ 12 - 18
parser/case_unsu.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Unsupported header field parser macros
+ * Unsupported Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -33,7 +33,7 @@
 
 
 #define TED_CASE                             \
-        switch(val) {                        \
+        switch(LOWER_DWORD(val)) {           \
         case _ted1_:                         \
                 hdr->type = HDR_UNSUPPORTED; \
                 hdr->name.len = 11;          \
@@ -47,25 +47,19 @@
         }
 
 
-#define PPOR_CASE                 \
-        switch(val) {             \
-        case _ppor_:              \
-                p += 4;           \
-                val = READ(p);    \
-                TED_CASE;         \
-                                  \
-                val = unify(val); \
-                TED_CASE;         \
-                goto other;       \
+#define PPOR_CASE                  \
+        switch(LOWER_DWORD(val)) { \
+        case _ppor_:               \
+                p += 4;            \
+                val = READ(p);     \
+                TED_CASE;          \
+                goto other;        \
         }
 
 
-#define Unsu_CASE         \
+#define unsu_CASE         \
         p += 4;           \
         val = READ(p);    \
-        PPOR_CASE;        \
-                          \
-        val = unify(val); \
         PPOR_CASE;        \
         goto other;       \
 

+ 5 - 5
parser/case_via.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * Via header field parser macros
+ * Via Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -32,14 +32,14 @@
 #define CASE_VIA_H
 
 
-#define Via1_CASE            \
+#define via1_CASE            \
         hdr->type = HDR_VIA; \
         hdr->name.len = 3;   \
         *(p + 3) = '\0';     \
         return (p + 4)        
 
 
-#define Via2_CASE            \
+#define via2_CASE            \
         hdr->type = HDR_VIA; \
         p += 4;              \
         goto dc_end

+ 19 - 29
parser/case_www.h

@@ -1,7 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
  *
- * WWW-Authenticate header field parser macros
+ * WWW-Authenticate Header Field Name Parsing Macros
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -33,7 +33,7 @@
 
 
 #define CATE_CASE                        \
-        switch(val) {                    \
+        switch(LOWER_DWORD(val)) {       \
         case _cate_:                     \
                 hdr->type = HDR_WWWAUTH; \
                 p += 4;                  \
@@ -41,39 +41,29 @@
         }
 
 
-#define ENTI_CASE                 \
-        switch(val) {             \
-        case _enti_:              \
-                p += 4;           \
-                val = READ(p);    \
-                CATE_CASE;        \
-                                  \
-                val = unify(val); \
-                CATE_CASE;        \
-                goto other;       \
+#define ENTI_CASE                  \
+        switch(LOWER_DWORD(val)) { \
+        case _enti_:               \
+                p += 4;            \
+                val = READ(p);     \
+                CATE_CASE;         \
+                goto other;        \
 } 
 
 
-#define WWW_AUTH_CASE             \
-        switch(val) {             \
-        case _Auth_:              \
-	        p += 4;           \
-                val = READ(p);    \
-                ENTI_CASE;        \
-                                  \
-                val = unify(val); \
-                ENTI_CASE;        \
-	        goto other;       \
+#define WWW_AUTH_CASE              \
+        switch(LOWER_DWORD(val)) { \
+        case _auth_:               \
+	        p += 4;            \
+                val = READ(p);     \
+                ENTI_CASE;         \
+	        goto other;        \
         }
 
 
-#define WWW_CASE          \
+#define www_CASE          \
         p += 4;           \
         val = READ(p);    \
-        WWW_AUTH_CASE;    \
-                          \
-        val = unify(val); \
-                          \
         WWW_AUTH_CASE;    \
         goto other;
 

+ 50 - 590
parser/keys.h

@@ -1,696 +1,156 @@
-/*
- * $Id$
- *
- * parse_hname hash table keys
- * This file is automatically generated, do not edit
- *
- * Copyright (C) 2001-2003 Fhg Fokus
- *
- * This file is part of ser, a free SIP server.
- *
- * ser is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version
- *
- * For a license to use the ser software under conditions
- * other than those described here, or to purchase support for this
- * software, please contact iptel.org by e-mail at the following addresses:
- *    [email protected]
- *
- * ser is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
 #ifndef KEYS_H
 #define KEYS_H
 
 
 #define _allo_ 0x6f6c6c61   /* "allo" */
-#define _allO_ 0x4f6c6c61   /* "allO" */
-#define _alLo_ 0x6f4c6c61   /* "alLo" */
-#define _alLO_ 0x4f4c6c61   /* "alLO" */
-#define _aLlo_ 0x6f6c4c61   /* "aLlo" */
-#define _aLlO_ 0x4f6c4c61   /* "aLlO" */
-#define _aLLo_ 0x6f4c4c61   /* "aLLo" */
-#define _aLLO_ 0x4f4c4c61   /* "aLLO" */
-#define _Allo_ 0x6f6c6c41   /* "Allo" */
-#define _AllO_ 0x4f6c6c41   /* "AllO" */
-#define _AlLo_ 0x6f4c6c41   /* "AlLo" */
-#define _AlLO_ 0x4f4c6c41   /* "AlLO" */
-#define _ALlo_ 0x6f6c4c41   /* "ALlo" */
-#define _ALlO_ 0x4f6c4c41   /* "ALlO" */
-#define _ALLo_ 0x6f4c4c41   /* "ALLo" */
-#define _ALLO_ 0x4f4c4c41   /* "ALLO" */
+#define _allo_hash ((unsigned char)((_allo_ >> 13) ^ _allo_))
 
 #define _auth_ 0x68747561   /* "auth" */
-#define _autH_ 0x48747561   /* "autH" */
-#define _auTh_ 0x68547561   /* "auTh" */
-#define _auTH_ 0x48547561   /* "auTH" */
-#define _aUth_ 0x68745561   /* "aUth" */
-#define _aUtH_ 0x48745561   /* "aUtH" */
-#define _aUTh_ 0x68545561   /* "aUTh" */
-#define _aUTH_ 0x48545561   /* "aUTH" */
-#define _Auth_ 0x68747541   /* "Auth" */
-#define _AutH_ 0x48747541   /* "AutH" */
-#define _AuTh_ 0x68547541   /* "AuTh" */
-#define _AuTH_ 0x48547541   /* "AuTH" */
-#define _AUth_ 0x68745541   /* "AUth" */
-#define _AUtH_ 0x48745541   /* "AUtH" */
-#define _AUTh_ 0x68545541   /* "AUTh" */
-#define _AUTH_ 0x48545541   /* "AUTH" */
+#define _auth_hash ((unsigned char)((_auth_ >> 13) ^ _allo_))
 
 #define _oriz_ 0x7a69726f   /* "oriz" */
-#define _oriZ_ 0x5a69726f   /* "oriZ" */
-#define _orIz_ 0x7a49726f   /* "orIz" */
-#define _orIZ_ 0x5a49726f   /* "orIZ" */
-#define _oRiz_ 0x7a69526f   /* "oRiz" */
-#define _oRiZ_ 0x5a69526f   /* "oRiZ" */
-#define _oRIz_ 0x7a49526f   /* "oRIz" */
-#define _oRIZ_ 0x5a49526f   /* "oRIZ" */
-#define _Oriz_ 0x7a69724f   /* "Oriz" */
-#define _OriZ_ 0x5a69724f   /* "OriZ" */
-#define _OrIz_ 0x7a49724f   /* "OrIz" */
-#define _OrIZ_ 0x5a49724f   /* "OrIZ" */
-#define _ORiz_ 0x7a69524f   /* "ORiz" */
-#define _ORiZ_ 0x5a69524f   /* "ORiZ" */
-#define _ORIz_ 0x7a49524f   /* "ORIz" */
-#define _ORIZ_ 0x5a49524f   /* "ORIZ" */
+#define _oriz_hash ((unsigned char)((_oriz_ >> 13) ^ _oriz_))
 
 #define _atio_ 0x6f697461   /* "atio" */
-#define _atiO_ 0x4f697461   /* "atiO" */
-#define _atIo_ 0x6f497461   /* "atIo" */
-#define _atIO_ 0x4f497461   /* "atIO" */
-#define _aTio_ 0x6f695461   /* "aTio" */
-#define _aTiO_ 0x4f695461   /* "aTiO" */
-#define _aTIo_ 0x6f495461   /* "aTIo" */
-#define _aTIO_ 0x4f495461   /* "aTIO" */
-#define _Atio_ 0x6f697441   /* "Atio" */
-#define _AtiO_ 0x4f697441   /* "AtiO" */
-#define _AtIo_ 0x6f497441   /* "AtIo" */
-#define _AtIO_ 0x4f497441   /* "AtIO" */
-#define _ATio_ 0x6f695441   /* "ATio" */
-#define _ATiO_ 0x4f695441   /* "ATiO" */
-#define _ATIo_ 0x6f495441   /* "ATIo" */
-#define _ATIO_ 0x4f495441   /* "ATIO" */
+#define _atio_hash ((unsigned char)((_atio_ >> 13) ^ _atio_))
 
 #define _call_ 0x6c6c6163   /* "call" */
-#define _calL_ 0x4c6c6163   /* "calL" */
-#define _caLl_ 0x6c4c6163   /* "caLl" */
-#define _caLL_ 0x4c4c6163   /* "caLL" */
-#define _cAll_ 0x6c6c4163   /* "cAll" */
-#define _cAlL_ 0x4c6c4163   /* "cAlL" */
-#define _cALl_ 0x6c4c4163   /* "cALl" */
-#define _cALL_ 0x4c4c4163   /* "cALL" */
-#define _Call_ 0x6c6c6143   /* "Call" */
-#define _CalL_ 0x4c6c6143   /* "CalL" */
-#define _CaLl_ 0x6c4c6143   /* "CaLl" */
-#define _CaLL_ 0x4c4c6143   /* "CaLL" */
-#define _CAll_ 0x6c6c4143   /* "CAll" */
-#define _CAlL_ 0x4c6c4143   /* "CAlL" */
-#define _CALl_ 0x6c4c4143   /* "CALl" */
-#define _CALL_ 0x4c4c4143   /* "CALL" */
+#define _call_hash ((unsigned char)((_call_ >> 13) ^ _call_))
 
 #define __id2_ 0x2064692d   /* "-id " */
-#define __iD2_ 0x2044692d   /* "-iD " */
-#define __Id2_ 0x2064492d   /* "-Id " */
-#define __ID2_ 0x2044492d   /* "-ID " */
+#define __id2_hash ((unsigned char)((__id2_ >> 13) ^ __id2_))
 
 #define __id1_ 0x3a64692d   /* "-id:" */
-#define __iD1_ 0x3a44692d   /* "-iD:" */
-#define __Id1_ 0x3a64492d   /* "-Id:" */
-#define __ID1_ 0x3a44492d   /* "-ID:" */
+#define __id1_hash ((unsigned char)((__id1_ >> 13) ^ __id1_))
 
 #define _cont_ 0x746e6f63   /* "cont" */
-#define _conT_ 0x546e6f63   /* "conT" */
-#define _coNt_ 0x744e6f63   /* "coNt" */
-#define _coNT_ 0x544e6f63   /* "coNT" */
-#define _cOnt_ 0x746e4f63   /* "cOnt" */
-#define _cOnT_ 0x546e4f63   /* "cOnT" */
-#define _cONt_ 0x744e4f63   /* "cONt" */
-#define _cONT_ 0x544e4f63   /* "cONT" */
-#define _Cont_ 0x746e6f43   /* "Cont" */
-#define _ConT_ 0x546e6f43   /* "ConT" */
-#define _CoNt_ 0x744e6f43   /* "CoNt" */
-#define _CoNT_ 0x544e6f43   /* "CoNT" */
-#define _COnt_ 0x746e4f43   /* "COnt" */
-#define _COnT_ 0x546e4f43   /* "COnT" */
-#define _CONt_ 0x744e4f43   /* "CONt" */
-#define _CONT_ 0x544e4f43   /* "CONT" */
+#define _cont_hash ((unsigned char)((_cont_ >> 13) ^ _cont_))
 
 #define _act2_ 0x20746361   /* "act " */
-#define _acT2_ 0x20546361   /* "acT " */
-#define _aCt2_ 0x20744361   /* "aCt " */
-#define _aCT2_ 0x20544361   /* "aCT " */
-#define _Act2_ 0x20746341   /* "Act " */
-#define _AcT2_ 0x20546341   /* "AcT " */
-#define _ACt2_ 0x20744341   /* "ACt " */
-#define _ACT2_ 0x20544341   /* "ACT " */
+#define _act2_hash ((unsigned char)((_act2_ >> 13) ^ _act2_))
 
 #define _act1_ 0x3a746361   /* "act:" */
-#define _acT1_ 0x3a546361   /* "acT:" */
-#define _aCt1_ 0x3a744361   /* "aCt:" */
-#define _aCT1_ 0x3a544361   /* "aCT:" */
-#define _Act1_ 0x3a746341   /* "Act:" */
-#define _AcT1_ 0x3a546341   /* "AcT:" */
-#define _ACt1_ 0x3a744341   /* "ACt:" */
-#define _ACT1_ 0x3a544341   /* "ACT:" */
+#define _act1_hash ((unsigned char)((_act1_ >> 13) ^ _act1_))
 
 #define _ent__ 0x2d746e65   /* "ent-" */
-#define _enT__ 0x2d546e65   /* "enT-" */
-#define _eNt__ 0x2d744e65   /* "eNt-" */
-#define _eNT__ 0x2d544e65   /* "eNT-" */
-#define _Ent__ 0x2d746e45   /* "Ent-" */
-#define _EnT__ 0x2d546e45   /* "EnT-" */
-#define _ENt__ 0x2d744e45   /* "ENt-" */
-#define _ENT__ 0x2d544e45   /* "ENT-" */
+#define _ent__hash ((unsigned char)((_ent__ >> 13) ^ _ent__))
 
 #define _leng_ 0x676e656c   /* "leng" */
-#define _lenG_ 0x476e656c   /* "lenG" */
-#define _leNg_ 0x674e656c   /* "leNg" */
-#define _leNG_ 0x474e656c   /* "leNG" */
-#define _lEng_ 0x676e456c   /* "lEng" */
-#define _lEnG_ 0x476e456c   /* "lEnG" */
-#define _lENg_ 0x674e456c   /* "lENg" */
-#define _lENG_ 0x474e456c   /* "lENG" */
-#define _Leng_ 0x676e654c   /* "Leng" */
-#define _LenG_ 0x476e654c   /* "LenG" */
-#define _LeNg_ 0x674e654c   /* "LeNg" */
-#define _LeNG_ 0x474e654c   /* "LeNG" */
-#define _LEng_ 0x676e454c   /* "LEng" */
-#define _LEnG_ 0x476e454c   /* "LEnG" */
-#define _LENg_ 0x674e454c   /* "LENg" */
-#define _LENG_ 0x474e454c   /* "LENG" */
+#define _leng_hash ((unsigned char)((_leng_ >> 13) ^ _leng_))
 
 #define _th12_ 0x203a6874   /* "th: " */
-#define _tH12_ 0x203a4874   /* "tH: " */
-#define _Th12_ 0x203a6854   /* "Th: " */
-#define _TH12_ 0x203a4854   /* "TH: " */
+#define _th12_hash ((unsigned char)((_th12_ >> 13) ^ _th12_))
 
 #define _type_ 0x65707974   /* "type" */
-#define _typE_ 0x45707974   /* "typE" */
-#define _tyPe_ 0x65507974   /* "tyPe" */
-#define _tyPE_ 0x45507974   /* "tyPE" */
-#define _tYpe_ 0x65705974   /* "tYpe" */
-#define _tYpE_ 0x45705974   /* "tYpE" */
-#define _tYPe_ 0x65505974   /* "tYPe" */
-#define _tYPE_ 0x45505974   /* "tYPE" */
-#define _Type_ 0x65707954   /* "Type" */
-#define _TypE_ 0x45707954   /* "TypE" */
-#define _TyPe_ 0x65507954   /* "TyPe" */
-#define _TyPE_ 0x45507954   /* "TyPE" */
-#define _TYpe_ 0x65705954   /* "TYpe" */
-#define _TYpE_ 0x45705954   /* "TYpE" */
-#define _TYPe_ 0x65505954   /* "TYPe" */
-#define _TYPE_ 0x45505954   /* "TYPE" */
+#define _type_hash ((unsigned char)((_type_ >> 13) ^ _type_))
 
 #define _cseq_ 0x71657363   /* "cseq" */
-#define _cseQ_ 0x51657363   /* "cseQ" */
-#define _csEq_ 0x71457363   /* "csEq" */
-#define _csEQ_ 0x51457363   /* "csEQ" */
-#define _cSeq_ 0x71655363   /* "cSeq" */
-#define _cSeQ_ 0x51655363   /* "cSeQ" */
-#define _cSEq_ 0x71455363   /* "cSEq" */
-#define _cSEQ_ 0x51455363   /* "cSEQ" */
-#define _Cseq_ 0x71657343   /* "Cseq" */
-#define _CseQ_ 0x51657343   /* "CseQ" */
-#define _CsEq_ 0x71457343   /* "CsEq" */
-#define _CsEQ_ 0x51457343   /* "CsEQ" */
-#define _CSeq_ 0x71655343   /* "CSeq" */
-#define _CSeQ_ 0x51655343   /* "CSeQ" */
-#define _CSEq_ 0x71455343   /* "CSEq" */
-#define _CSEQ_ 0x51455343   /* "CSEQ" */
+#define _cseq_hash ((unsigned char)((_cseq_ >> 13) ^ _cseq_))
 
 #define _expi_ 0x69707865   /* "expi" */
-#define _expI_ 0x49707865   /* "expI" */
-#define _exPi_ 0x69507865   /* "exPi" */
-#define _exPI_ 0x49507865   /* "exPI" */
-#define _eXpi_ 0x69705865   /* "eXpi" */
-#define _eXpI_ 0x49705865   /* "eXpI" */
-#define _eXPi_ 0x69505865   /* "eXPi" */
-#define _eXPI_ 0x49505865   /* "eXPI" */
-#define _Expi_ 0x69707845   /* "Expi" */
-#define _ExpI_ 0x49707845   /* "ExpI" */
-#define _ExPi_ 0x69507845   /* "ExPi" */
-#define _ExPI_ 0x49507845   /* "ExPI" */
-#define _EXpi_ 0x69705845   /* "EXpi" */
-#define _EXpI_ 0x49705845   /* "EXpI" */
-#define _EXPi_ 0x69505845   /* "EXPi" */
-#define _EXPI_ 0x49505845   /* "EXPI" */
+#define _expi_hash ((unsigned char)((_expi_ >> 13) ^ _expi_))
 
 #define _res2_ 0x20736572   /* "res " */
-#define _reS2_ 0x20536572   /* "reS " */
-#define _rEs2_ 0x20734572   /* "rEs " */
-#define _rES2_ 0x20534572   /* "rES " */
-#define _Res2_ 0x20736552   /* "Res " */
-#define _ReS2_ 0x20536552   /* "ReS " */
-#define _REs2_ 0x20734552   /* "REs " */
-#define _RES2_ 0x20534552   /* "RES " */
+#define _res2_hash ((unsigned char)((_res2_ >> 13) ^ _res2_))
 
 #define _res1_ 0x3a736572   /* "res:" */
-#define _reS1_ 0x3a536572   /* "reS:" */
-#define _rEs1_ 0x3a734572   /* "rEs:" */
-#define _rES1_ 0x3a534572   /* "rES:" */
-#define _Res1_ 0x3a736552   /* "Res:" */
-#define _ReS1_ 0x3a536552   /* "ReS:" */
-#define _REs1_ 0x3a734552   /* "REs:" */
-#define _RES1_ 0x3a534552   /* "RES:" */
+#define _res1_hash ((unsigned char)((_res1_ >> 13) ^ _res1_))
 
 #define _from_ 0x6d6f7266   /* "from" */
-#define _froM_ 0x4d6f7266   /* "froM" */
-#define _frOm_ 0x6d4f7266   /* "frOm" */
-#define _frOM_ 0x4d4f7266   /* "frOM" */
-#define _fRom_ 0x6d6f5266   /* "fRom" */
-#define _fRoM_ 0x4d6f5266   /* "fRoM" */
-#define _fROm_ 0x6d4f5266   /* "fROm" */
-#define _fROM_ 0x4d4f5266   /* "fROM" */
-#define _From_ 0x6d6f7246   /* "From" */
-#define _FroM_ 0x4d6f7246   /* "FroM" */
-#define _FrOm_ 0x6d4f7246   /* "FrOm" */
-#define _FrOM_ 0x4d4f7246   /* "FrOM" */
-#define _FRom_ 0x6d6f5246   /* "FRom" */
-#define _FRoM_ 0x4d6f5246   /* "FRoM" */
-#define _FROm_ 0x6d4f5246   /* "FROm" */
-#define _FROM_ 0x4d4f5246   /* "FROM" */
+#define _from_hash ((unsigned char)((_from_ >> 13) ^ _from_))
 
 #define _max__ 0x2d78616d   /* "max-" */
-#define _maX__ 0x2d58616d   /* "maX-" */
-#define _mAx__ 0x2d78416d   /* "mAx-" */
-#define _mAX__ 0x2d58416d   /* "mAX-" */
-#define _Max__ 0x2d78614d   /* "Max-" */
-#define _MaX__ 0x2d58614d   /* "MaX-" */
-#define _MAx__ 0x2d78414d   /* "MAx-" */
-#define _MAX__ 0x2d58414d   /* "MAX-" */
+#define _max__hash ((unsigned char)((_max__ >> 13) ^ _max__))
 
 #define _forw_ 0x77726f66   /* "forw" */
-#define _forW_ 0x57726f66   /* "forW" */
-#define _foRw_ 0x77526f66   /* "foRw" */
-#define _foRW_ 0x57526f66   /* "foRW" */
-#define _fOrw_ 0x77724f66   /* "fOrw" */
-#define _fOrW_ 0x57724f66   /* "fOrW" */
-#define _fORw_ 0x77524f66   /* "fORw" */
-#define _fORW_ 0x57524f66   /* "fORW" */
-#define _Forw_ 0x77726f46   /* "Forw" */
-#define _ForW_ 0x57726f46   /* "ForW" */
-#define _FoRw_ 0x77526f46   /* "FoRw" */
-#define _FoRW_ 0x57526f46   /* "FoRW" */
-#define _FOrw_ 0x77724f46   /* "FOrw" */
-#define _FOrW_ 0x57724f46   /* "FOrW" */
-#define _FORw_ 0x77524f46   /* "FORw" */
-#define _FORW_ 0x57524f46   /* "FORW" */
+#define _forw_hash ((unsigned char)((_forw_ >> 13) ^ _forw_))
 
 #define _ards_ 0x73647261   /* "ards" */
-#define _ardS_ 0x53647261   /* "ardS" */
-#define _arDs_ 0x73447261   /* "arDs" */
-#define _arDS_ 0x53447261   /* "arDS" */
-#define _aRds_ 0x73645261   /* "aRds" */
-#define _aRdS_ 0x53645261   /* "aRdS" */
-#define _aRDs_ 0x73445261   /* "aRDs" */
-#define _aRDS_ 0x53445261   /* "aRDS" */
-#define _Ards_ 0x73647241   /* "Ards" */
-#define _ArdS_ 0x53647241   /* "ArdS" */
-#define _ArDs_ 0x73447241   /* "ArDs" */
-#define _ArDS_ 0x53447241   /* "ArDS" */
-#define _ARds_ 0x73645241   /* "ARds" */
-#define _ARdS_ 0x53645241   /* "ARdS" */
-#define _ARDs_ 0x73445241   /* "ARDs" */
-#define _ARDS_ 0x53445241   /* "ARDS" */
+#define _ards_hash ((unsigned char)((_ards_ >> 13) ^ _ards_))
 
 #define _prox_ 0x786f7270   /* "prox" */
-#define _proX_ 0x586f7270   /* "proX" */
-#define _prOx_ 0x784f7270   /* "prOx" */
-#define _prOX_ 0x584f7270   /* "prOX" */
-#define _pRox_ 0x786f5270   /* "pRox" */
-#define _pRoX_ 0x586f5270   /* "pRoX" */
-#define _pROx_ 0x784f5270   /* "pROx" */
-#define _pROX_ 0x584f5270   /* "pROX" */
-#define _Prox_ 0x786f7250   /* "Prox" */
-#define _ProX_ 0x586f7250   /* "ProX" */
-#define _PrOx_ 0x784f7250   /* "PrOx" */
-#define _PrOX_ 0x584f7250   /* "PrOX" */
-#define _PRox_ 0x786f5250   /* "PRox" */
-#define _PRoX_ 0x586f5250   /* "PRoX" */
-#define _PROx_ 0x784f5250   /* "PROx" */
-#define _PROX_ 0x584f5250   /* "PROX" */
+#define _prox_hash ((unsigned char)((_prox_ >> 13) ^ _prox_))
 
 #define _y_au_ 0x75612d79   /* "y-au" */
-#define _y_aU_ 0x55612d79   /* "y-aU" */
-#define _y_Au_ 0x75412d79   /* "y-Au" */
-#define _y_AU_ 0x55412d79   /* "y-AU" */
-#define _Y_au_ 0x75612d59   /* "Y-au" */
-#define _Y_aU_ 0x55612d59   /* "Y-aU" */
-#define _Y_Au_ 0x75412d59   /* "Y-Au" */
-#define _Y_AU_ 0x55412d59   /* "Y-AU" */
+#define _y_au_hash ((unsigned char)((_y_au_ >> 13) ^ _y_au_))
 
 #define _thor_ 0x726f6874   /* "thor" */
-#define _thoR_ 0x526f6874   /* "thoR" */
-#define _thOr_ 0x724f6874   /* "thOr" */
-#define _thOR_ 0x524f6874   /* "thOR" */
-#define _tHor_ 0x726f4874   /* "tHor" */
-#define _tHoR_ 0x526f4874   /* "tHoR" */
-#define _tHOr_ 0x724f4874   /* "tHOr" */
-#define _tHOR_ 0x524f4874   /* "tHOR" */
-#define _Thor_ 0x726f6854   /* "Thor" */
-#define _ThoR_ 0x526f6854   /* "ThoR" */
-#define _ThOr_ 0x724f6854   /* "ThOr" */
-#define _ThOR_ 0x524f6854   /* "ThOR" */
-#define _THor_ 0x726f4854   /* "THor" */
-#define _THoR_ 0x526f4854   /* "THoR" */
-#define _THOr_ 0x724f4854   /* "THOr" */
-#define _THOR_ 0x524f4854   /* "THOR" */
+#define _thor_hash ((unsigned char)((_thor_ >> 13) ^ _thor_))
 
 #define _izat_ 0x74617a69   /* "izat" */
-#define _izaT_ 0x54617a69   /* "izaT" */
-#define _izAt_ 0x74417a69   /* "izAt" */
-#define _izAT_ 0x54417a69   /* "izAT" */
-#define _iZat_ 0x74615a69   /* "iZat" */
-#define _iZaT_ 0x54615a69   /* "iZaT" */
-#define _iZAt_ 0x74415a69   /* "iZAt" */
-#define _iZAT_ 0x54415a69   /* "iZAT" */
-#define _Izat_ 0x74617a49   /* "Izat" */
-#define _IzaT_ 0x54617a49   /* "IzaT" */
-#define _IzAt_ 0x74417a49   /* "IzAt" */
-#define _IzAT_ 0x54417a49   /* "IzAT" */
-#define _IZat_ 0x74615a49   /* "IZat" */
-#define _IZaT_ 0x54615a49   /* "IZaT" */
-#define _IZAt_ 0x74415a49   /* "IZAt" */
-#define _IZAT_ 0x54415a49   /* "IZAT" */
+#define _izat_hash ((unsigned char)((_izat_ >> 13) ^ _izat_))
 
 #define _ion2_ 0x206e6f69   /* "ion " */
-#define _ioN2_ 0x204e6f69   /* "ioN " */
-#define _iOn2_ 0x206e4f69   /* "iOn " */
-#define _iON2_ 0x204e4f69   /* "iON " */
-#define _Ion2_ 0x206e6f49   /* "Ion " */
-#define _IoN2_ 0x204e6f49   /* "IoN " */
-#define _IOn2_ 0x206e4f49   /* "IOn " */
-#define _ION2_ 0x204e4f49   /* "ION " */
+#define _ion2_hash ((unsigned char)((_ion2_ >> 13) ^ _ion2_))
 
 #define _ion1_ 0x3a6e6f69   /* "ion:" */
-#define _ioN1_ 0x3a4e6f69   /* "ioN:" */
-#define _iOn1_ 0x3a6e4f69   /* "iOn:" */
-#define _iON1_ 0x3a4e4f69   /* "iON:" */
-#define _Ion1_ 0x3a6e6f49   /* "Ion:" */
-#define _IoN1_ 0x3a4e6f49   /* "IoN:" */
-#define _IOn1_ 0x3a6e4f49   /* "IOn:" */
-#define _ION1_ 0x3a4e4f49   /* "ION:" */
+#define _ion1_hash ((unsigned char)((_ion1_ >> 13) ^ _ion1_))
 
 #define _y_re_ 0x65722d79   /* "y-re" */
-#define _y_rE_ 0x45722d79   /* "y-rE" */
-#define _y_Re_ 0x65522d79   /* "y-Re" */
-#define _y_RE_ 0x45522d79   /* "y-RE" */
-#define _Y_re_ 0x65722d59   /* "Y-re" */
-#define _Y_rE_ 0x45722d59   /* "Y-rE" */
-#define _Y_Re_ 0x65522d59   /* "Y-Re" */
-#define _Y_RE_ 0x45522d59   /* "Y-RE" */
+#define _y_re_hash ((unsigned char)((_y_re_ >> 13) ^ _y_re_))
 
 #define _quir_ 0x72697571   /* "quir" */
-#define _quiR_ 0x52697571   /* "quiR" */
-#define _quIr_ 0x72497571   /* "quIr" */
-#define _quIR_ 0x52497571   /* "quIR" */
-#define _qUir_ 0x72695571   /* "qUir" */
-#define _qUiR_ 0x52695571   /* "qUiR" */
-#define _qUIr_ 0x72495571   /* "qUIr" */
-#define _qUIR_ 0x52495571   /* "qUIR" */
-#define _Quir_ 0x72697551   /* "Quir" */
-#define _QuiR_ 0x52697551   /* "QuiR" */
-#define _QuIr_ 0x72497551   /* "QuIr" */
-#define _QuIR_ 0x52497551   /* "QuIR" */
-#define _QUir_ 0x72695551   /* "QUir" */
-#define _QUiR_ 0x52695551   /* "QUiR" */
-#define _QUIr_ 0x72495551   /* "QUIr" */
-#define _QUIR_ 0x52495551   /* "QUIR" */
+#define _quir_hash ((unsigned char)((_quir_ >> 13) ^ _quir_))
 
 #define _reco_ 0x6f636572   /* "reco" */
-#define _recO_ 0x4f636572   /* "recO" */
-#define _reCo_ 0x6f436572   /* "reCo" */
-#define _reCO_ 0x4f436572   /* "reCO" */
-#define _rEco_ 0x6f634572   /* "rEco" */
-#define _rEcO_ 0x4f634572   /* "rEcO" */
-#define _rECo_ 0x6f434572   /* "rECo" */
-#define _rECO_ 0x4f434572   /* "rECO" */
-#define _Reco_ 0x6f636552   /* "Reco" */
-#define _RecO_ 0x4f636552   /* "RecO" */
-#define _ReCo_ 0x6f436552   /* "ReCo" */
-#define _ReCO_ 0x4f436552   /* "ReCO" */
-#define _REco_ 0x6f634552   /* "REco" */
-#define _REcO_ 0x4f634552   /* "REcO" */
-#define _RECo_ 0x6f434552   /* "RECo" */
-#define _RECO_ 0x4f434552   /* "RECO" */
+#define _reco_hash ((unsigned char)((_reco_ >> 13) ^ _reco_))
 
 #define _rd_r_ 0x722d6472   /* "rd-r" */
-#define _rd_R_ 0x522d6472   /* "rd-R" */
-#define _rD_r_ 0x722d4472   /* "rD-r" */
-#define _rD_R_ 0x522d4472   /* "rD-R" */
-#define _Rd_r_ 0x722d6452   /* "Rd-r" */
-#define _Rd_R_ 0x522d6452   /* "Rd-R" */
-#define _RD_r_ 0x722d4452   /* "RD-r" */
-#define _RD_R_ 0x522d4452   /* "RD-R" */
+#define _rd_r_hash ((unsigned char)((_rd_r_ >> 13) ^ _rd_r_))
 
 #define _oute_ 0x6574756f   /* "oute" */
-#define _outE_ 0x4574756f   /* "outE" */
-#define _ouTe_ 0x6554756f   /* "ouTe" */
-#define _ouTE_ 0x4554756f   /* "ouTE" */
-#define _oUte_ 0x6574556f   /* "oUte" */
-#define _oUtE_ 0x4574556f   /* "oUtE" */
-#define _oUTe_ 0x6554556f   /* "oUTe" */
-#define _oUTE_ 0x4554556f   /* "oUTE" */
-#define _Oute_ 0x6574754f   /* "Oute" */
-#define _OutE_ 0x4574754f   /* "OutE" */
-#define _OuTe_ 0x6554754f   /* "OuTe" */
-#define _OuTE_ 0x4554754f   /* "OuTE" */
-#define _OUte_ 0x6574554f   /* "OUte" */
-#define _OUtE_ 0x4574554f   /* "OUtE" */
-#define _OUTe_ 0x6554554f   /* "OUTe" */
-#define _OUTE_ 0x4554554f   /* "OUTE" */
+#define _oute_hash ((unsigned char)((_oute_ >> 13) ^ _oute_))
 
 #define _requ_ 0x75716572   /* "requ" */
-#define _reqU_ 0x55716572   /* "reqU" */
-#define _reQu_ 0x75516572   /* "reQu" */
-#define _reQU_ 0x55516572   /* "reQU" */
-#define _rEqu_ 0x75714572   /* "rEqu" */
-#define _rEqU_ 0x55714572   /* "rEqU" */
-#define _rEQu_ 0x75514572   /* "rEQu" */
-#define _rEQU_ 0x55514572   /* "rEQU" */
-#define _Requ_ 0x75716552   /* "Requ" */
-#define _ReqU_ 0x55716552   /* "ReqU" */
-#define _ReQu_ 0x75516552   /* "ReQu" */
-#define _ReQU_ 0x55516552   /* "ReQU" */
-#define _REqu_ 0x75714552   /* "REqu" */
-#define _REqU_ 0x55714552   /* "REqU" */
-#define _REQu_ 0x75514552   /* "REQu" */
-#define _REQU_ 0x55514552   /* "REQU" */
+#define _requ_hash ((unsigned char)((_requ_ >> 13) ^ _requ_))
 
 #define _ire2_ 0x20657269   /* "ire " */
-#define _irE2_ 0x20457269   /* "irE " */
-#define _iRe2_ 0x20655269   /* "iRe " */
-#define _iRE2_ 0x20455269   /* "iRE " */
-#define _Ire2_ 0x20657249   /* "Ire " */
-#define _IrE2_ 0x20457249   /* "IrE " */
-#define _IRe2_ 0x20655249   /* "IRe " */
-#define _IRE2_ 0x20455249   /* "IRE " */
+#define _ire2_hash ((unsigned char)((_ire2_ >> 13) ^ _ire2_))
 
 #define _ire1_ 0x3a657269   /* "ire:" */
-#define _irE1_ 0x3a457269   /* "irE:" */
-#define _iRe1_ 0x3a655269   /* "iRe:" */
-#define _iRE1_ 0x3a455269   /* "iRE:" */
-#define _Ire1_ 0x3a657249   /* "Ire:" */
-#define _IrE1_ 0x3a457249   /* "IrE:" */
-#define _IRe1_ 0x3a655249   /* "IRe:" */
-#define _IRE1_ 0x3a455249   /* "IRE:" */
+#define _ire1_hash ((unsigned char)((_ire1_ >> 13) ^ _ire1_))
 
 #define _rout_ 0x74756f72   /* "rout" */
-#define _rouT_ 0x54756f72   /* "rouT" */
-#define _roUt_ 0x74556f72   /* "roUt" */
-#define _roUT_ 0x54556f72   /* "roUT" */
-#define _rOut_ 0x74754f72   /* "rOut" */
-#define _rOuT_ 0x54754f72   /* "rOuT" */
-#define _rOUt_ 0x74554f72   /* "rOUt" */
-#define _rOUT_ 0x54554f72   /* "rOUT" */
-#define _Rout_ 0x74756f52   /* "Rout" */
-#define _RouT_ 0x54756f52   /* "RouT" */
-#define _RoUt_ 0x74556f52   /* "RoUt" */
-#define _RoUT_ 0x54556f52   /* "RoUT" */
-#define _ROut_ 0x74754f52   /* "ROut" */
-#define _ROuT_ 0x54754f52   /* "ROuT" */
-#define _ROUt_ 0x74554f52   /* "ROUt" */
-#define _ROUT_ 0x54554f52   /* "ROUT" */
+#define _rout_hash ((unsigned char)((_rout_ >> 13) ^ _rout_))
 
 #define _supp_ 0x70707573   /* "supp" */
-#define _supP_ 0x50707573   /* "supP" */
-#define _suPp_ 0x70507573   /* "suPp" */
-#define _suPP_ 0x50507573   /* "suPP" */
-#define _sUpp_ 0x70705573   /* "sUpp" */
-#define _sUpP_ 0x50705573   /* "sUpP" */
-#define _sUPp_ 0x70505573   /* "sUPp" */
-#define _sUPP_ 0x50505573   /* "sUPP" */
-#define _Supp_ 0x70707553   /* "Supp" */
-#define _SupP_ 0x50707553   /* "SupP" */
-#define _SuPp_ 0x70507553   /* "SuPp" */
-#define _SuPP_ 0x50507553   /* "SuPP" */
-#define _SUpp_ 0x70705553   /* "SUpp" */
-#define _SUpP_ 0x50705553   /* "SUpP" */
-#define _SUPp_ 0x70505553   /* "SUPp" */
-#define _SUPP_ 0x50505553   /* "SUPP" */
+#define _supp_hash ((unsigned char)((_supp_ >> 13) ^ _supp_))
 
 #define _orte_ 0x6574726f   /* "orte" */
-#define _ortE_ 0x4574726f   /* "ortE" */
-#define _orTe_ 0x6554726f   /* "orTe" */
-#define _orTE_ 0x4554726f   /* "orTE" */
-#define _oRte_ 0x6574526f   /* "oRte" */
-#define _oRtE_ 0x4574526f   /* "oRtE" */
-#define _oRTe_ 0x6554526f   /* "oRTe" */
-#define _oRTE_ 0x4554526f   /* "oRTE" */
-#define _Orte_ 0x6574724f   /* "Orte" */
-#define _OrtE_ 0x4574724f   /* "OrtE" */
-#define _OrTe_ 0x6554724f   /* "OrTe" */
-#define _OrTE_ 0x4554724f   /* "OrTE" */
-#define _ORte_ 0x6574524f   /* "ORte" */
-#define _ORtE_ 0x4574524f   /* "ORtE" */
-#define _ORTe_ 0x6554524f   /* "ORTe" */
-#define _ORTE_ 0x4554524f   /* "ORTE" */
+#define _orte_hash ((unsigned char)((_orte_ >> 13) ^ _orte_))
 
 #define _to12_ 0x203a6f74   /* "to: " */
-#define _tO12_ 0x203a4f74   /* "tO: " */
-#define _To12_ 0x203a6f54   /* "To: " */
-#define _TO12_ 0x203a4f54   /* "TO: " */
+#define _to12_hash ((unsigned char)((_to12_ >> 13) ^ _to12_))
 
 #define _unsu_ 0x75736e75   /* "unsu" */
-#define _unsU_ 0x55736e75   /* "unsU" */
-#define _unSu_ 0x75536e75   /* "unSu" */
-#define _unSU_ 0x55536e75   /* "unSU" */
-#define _uNsu_ 0x75734e75   /* "uNsu" */
-#define _uNsU_ 0x55734e75   /* "uNsU" */
-#define _uNSu_ 0x75534e75   /* "uNSu" */
-#define _uNSU_ 0x55534e75   /* "uNSU" */
-#define _Unsu_ 0x75736e55   /* "Unsu" */
-#define _UnsU_ 0x55736e55   /* "UnsU" */
-#define _UnSu_ 0x75536e55   /* "UnSu" */
-#define _UnSU_ 0x55536e55   /* "UnSU" */
-#define _UNsu_ 0x75734e55   /* "UNsu" */
-#define _UNsU_ 0x55734e55   /* "UNsU" */
-#define _UNSu_ 0x75534e55   /* "UNSu" */
-#define _UNSU_ 0x55534e55   /* "UNSU" */
+#define _unsu_hash ((unsigned char)((_unsu_ >> 13) ^ _unsu_))
 
 #define _ppor_ 0x726f7070   /* "ppor" */
-#define _ppoR_ 0x526f7070   /* "ppoR" */
-#define _ppOr_ 0x724f7070   /* "ppOr" */
-#define _ppOR_ 0x524f7070   /* "ppOR" */
-#define _pPor_ 0x726f5070   /* "pPor" */
-#define _pPoR_ 0x526f5070   /* "pPoR" */
-#define _pPOr_ 0x724f5070   /* "pPOr" */
-#define _pPOR_ 0x524f5070   /* "pPOR" */
-#define _Ppor_ 0x726f7050   /* "Ppor" */
-#define _PpoR_ 0x526f7050   /* "PpoR" */
-#define _PpOr_ 0x724f7050   /* "PpOr" */
-#define _PpOR_ 0x524f7050   /* "PpOR" */
-#define _PPor_ 0x726f5050   /* "PPor" */
-#define _PPoR_ 0x526f5050   /* "PPoR" */
-#define _PPOr_ 0x724f5050   /* "PPOr" */
-#define _PPOR_ 0x524f5050   /* "PPOR" */
+#define _ppor_hash ((unsigned char)((_ppor_ >> 13) ^ _ppor_))
 
 #define _ted2_ 0x20646574   /* "ted " */
-#define _teD2_ 0x20446574   /* "teD " */
-#define _tEd2_ 0x20644574   /* "tEd " */
-#define _tED2_ 0x20444574   /* "tED " */
-#define _Ted2_ 0x20646554   /* "Ted " */
-#define _TeD2_ 0x20446554   /* "TeD " */
-#define _TEd2_ 0x20644554   /* "TEd " */
-#define _TED2_ 0x20444554   /* "TED " */
+#define _ted2_hash ((unsigned char)((_ted2_ >> 13) ^ _ted2_))
 
 #define _ted1_ 0x3a646574   /* "ted:" */
-#define _teD1_ 0x3a446574   /* "teD:" */
-#define _tEd1_ 0x3a644574   /* "tEd:" */
-#define _tED1_ 0x3a444574   /* "tED:" */
-#define _Ted1_ 0x3a646554   /* "Ted:" */
-#define _TeD1_ 0x3a446554   /* "TeD:" */
-#define _TEd1_ 0x3a644554   /* "TEd:" */
-#define _TED1_ 0x3a444554   /* "TED:" */
+#define _ted1_hash ((unsigned char)((_ted1_ >> 13) ^ _ted1_))
 
 #define _via2_ 0x20616976   /* "via " */
-#define _viA2_ 0x20416976   /* "viA " */
-#define _vIa2_ 0x20614976   /* "vIa " */
-#define _vIA2_ 0x20414976   /* "vIA " */
-#define _Via2_ 0x20616956   /* "Via " */
-#define _ViA2_ 0x20416956   /* "ViA " */
-#define _VIa2_ 0x20614956   /* "VIa " */
-#define _VIA2_ 0x20414956   /* "VIA " */
+#define _via2_hash ((unsigned char)((_via2_ >> 13) ^ _via2_))
 
 #define _via1_ 0x3a616976   /* "via:" */
-#define _viA1_ 0x3a416976   /* "viA:" */
-#define _vIa1_ 0x3a614976   /* "vIa:" */
-#define _vIA1_ 0x3a414976   /* "vIA:" */
-#define _Via1_ 0x3a616956   /* "Via:" */
-#define _ViA1_ 0x3a416956   /* "ViA:" */
-#define _VIa1_ 0x3a614956   /* "VIa:" */
-#define _VIA1_ 0x3a414956   /* "VIA:" */
+#define _via1_hash ((unsigned char)((_via1_ >> 13) ^ _via1_))
 
 #define _www__ 0x2d777777   /* "www-" */
-#define _wwW__ 0x2d577777   /* "wwW-" */
-#define _wWw__ 0x2d775777   /* "wWw-" */
-#define _wWW__ 0x2d575777   /* "wWW-" */
-#define _Www__ 0x2d777757   /* "Www-" */
-#define _WwW__ 0x2d577757   /* "WwW-" */
-#define _WWw__ 0x2d775757   /* "WWw-" */
-#define _WWW__ 0x2d575757   /* "WWW-" */
+#define _www__hash ((unsigned char)((_www__ >> 13) ^ _www__))
 
 #define _enti_ 0x69746e65   /* "enti" */
-#define _entI_ 0x49746e65   /* "entI" */
-#define _enTi_ 0x69546e65   /* "enTi" */
-#define _enTI_ 0x49546e65   /* "enTI" */
-#define _eNti_ 0x69744e65   /* "eNti" */
-#define _eNtI_ 0x49744e65   /* "eNtI" */
-#define _eNTi_ 0x69544e65   /* "eNTi" */
-#define _eNTI_ 0x49544e65   /* "eNTI" */
-#define _Enti_ 0x69746e45   /* "Enti" */
-#define _EntI_ 0x49746e45   /* "EntI" */
-#define _EnTi_ 0x69546e45   /* "EnTi" */
-#define _EnTI_ 0x49546e45   /* "EnTI" */
-#define _ENti_ 0x69744e45   /* "ENti" */
-#define _ENtI_ 0x49744e45   /* "ENtI" */
-#define _ENTi_ 0x69544e45   /* "ENTi" */
-#define _ENTI_ 0x49544e45   /* "ENTI" */
+#define _enti_hash ((unsigned char)((_enti_ >> 13) ^ _enti_))
 
 #define _cate_ 0x65746163   /* "cate" */
-#define _catE_ 0x45746163   /* "catE" */
-#define _caTe_ 0x65546163   /* "caTe" */
-#define _caTE_ 0x45546163   /* "caTE" */
-#define _cAte_ 0x65744163   /* "cAte" */
-#define _cAtE_ 0x45744163   /* "cAtE" */
-#define _cATe_ 0x65544163   /* "cATe" */
-#define _cATE_ 0x45544163   /* "cATE" */
-#define _Cate_ 0x65746143   /* "Cate" */
-#define _CatE_ 0x45746143   /* "CatE" */
-#define _CaTe_ 0x65546143   /* "CaTe" */
-#define _CaTE_ 0x45546143   /* "CaTE" */
-#define _CAte_ 0x65744143   /* "CAte" */
-#define _CAtE_ 0x45744143   /* "CAtE" */
-#define _CATe_ 0x65544143   /* "CATe" */
-#define _CATE_ 0x45544143   /* "CATE" */
+#define _cate_hash ((unsigned char)((_cate_ >> 13) ^ _cate_))
 
 #define _even_ 0x6e657665   /* "even" */
-#define _eveN_ 0x4e657665   /* "eveN" */
-#define _evEn_ 0x6e457665   /* "evEn" */
-#define _evEN_ 0x4e457665   /* "evEN" */
-#define _eVen_ 0x6e655665   /* "eVen" */
-#define _eVeN_ 0x4e655665   /* "eVeN" */
-#define _eVEn_ 0x6e455665   /* "eVEn" */
-#define _eVEN_ 0x4e455665   /* "eVEN" */
-#define _Even_ 0x6e657645   /* "Even" */
-#define _EveN_ 0x4e657645   /* "EveN" */
-#define _EvEn_ 0x6e457645   /* "EvEn" */
-#define _EvEN_ 0x4e457645   /* "EvEN" */
-#define _EVen_ 0x6e655645   /* "EVen" */
-#define _EVeN_ 0x4e655645   /* "EVeN" */
-#define _EVEn_ 0x6e455645   /* "EVEn" */
-#define _EVEN_ 0x4e455645   /* "EVEN" */
-
+#define _even_hash ((unsigned char)((_even_ >> 13) ^ _even_))
 
 #endif /* KEYS_H */
 

+ 39 - 283
parser/parse_hname2.c

@@ -1,5 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
+ *
+ * Fast 32-bit Header Field Name Parser
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -26,62 +28,12 @@
  */
 
 
-
 #include "parse_hname2.h"
 #include "keys.h"
 #include "../ut.h"  /* q_memchr */
 
-/*
- * Size of hash table, this is magic value
- * that ensures, that there are no synonyms for
- * frequently used keys (frequently used keys are
- * 4-byte parts of message headers we recognize)
- * WARNING ! This value MUST be recalculated if you want
- * a new header to be recognized
- */
-#define HASH_TABLE_SIZE 9349
-
-
-/*
- * Hash function
- */
-#define HASH_FUNC(val) ((val) % HASH_TABLE_SIZE)
-
-
-/*
- * This constants marks empty hash table element
- */
-#define HASH_EMPTY 0x2d2d2d2d
-
-
-/*
- * Hash table entry
- */
-struct ht_entry {
-	unsigned int key;
-	unsigned int value;
-};
-
-
-static struct ht_entry hash_table[HASH_TABLE_SIZE];
-
-
-/*
- * Pointer to the hash table
- */
-/*
-static struct ht_entry *hash_table;
-*/
-
-
-/*
- * Declarations
- */
-static inline char* skip_ws     (char* p, unsigned int size);
-void                init_htable (void);
-static void         set_entry   (unsigned int key, unsigned int val);
-static inline int   unify       (int key);
-
+#define LOWER_BYTE(b) ((b) | 0x20)
+#define LOWER_DWORD(d) ((d) | 0x20202020)
 
 /*
  * Skip all whitechars and return position of the first
@@ -98,33 +50,6 @@ static inline char* skip_ws(char* p, unsigned int size)
 	return p;
 }
 	
-
-/*
- * Used to initialize hash table
- */
-static void set_entry(unsigned int key, unsigned int val)
-{
-	hash_table[HASH_FUNC(key)].key = key;
-	hash_table[HASH_FUNC(key)].value = val;
-}
-
-
-/*
- * cSeQ -> CSeq and so on...
- */ 
-static inline int unify(int key)
-{
-	register struct ht_entry* en;
-
-	en = &hash_table[HASH_FUNC(key)];
-	if (en->key == key) {
-		return en->value;
-	} else {
-		return key;
-	}
-}
-
-
 /*
  * Parser macros
  */
@@ -153,25 +78,25 @@ static inline int unify(int key)
 
 
 #define FIRST_QUATERNIONS       \
-        case _Via1_: Via1_CASE; \
-	case _From_: From_CASE; \
-	case _To12_: To12_CASE; \
-	case _CSeq_: CSeq_CASE; \
-	case _Call_: Call_CASE; \
-	case _Cont_: Cont_CASE; \
-	case _Rout_: Rout_CASE; \
-	case _Max__: Max_CASE;  \
-	case _Reco_: Reco_CASE; \
-	case _Via2_: Via2_CASE; \
-	case _Auth_: Auth_CASE; \
-	case _Expi_: Expi_CASE; \
-	case _Prox_: Prox_CASE; \
-	case _Allo_: Allo_CASE; \
-	case _Unsu_: Unsu_CASE; \
-	case _Requ_: Requ_CASE; \
-	case _Supp_: Supp_CASE; \
-        case _WWW__: WWW_CASE;  \
-        case _Even_: Even_CASE;
+        case _via1_: via1_CASE; \
+	case _from_: from_CASE; \
+	case _to12_: to12_CASE; \
+	case _cseq_: cseq_CASE; \
+	case _call_: call_CASE; \
+	case _cont_: cont_CASE; \
+	case _rout_: rout_CASE; \
+	case _max__: max_CASE;  \
+	case _reco_: reco_CASE; \
+	case _via2_: via2_CASE; \
+	case _auth_: auth_CASE; \
+	case _expi_: expi_CASE; \
+	case _prox_: prox_CASE; \
+	case _allo_: allo_CASE; \
+	case _unsu_: unsu_CASE; \
+	case _requ_: requ_CASE; \
+	case _supp_: supp_CASE; \
+        case _www__: www_CASE;  \
+        case _even_: even_CASE;
 
 
 #define PARSE_COMPACT(id)          \
@@ -192,7 +117,7 @@ static inline int unify(int key)
 char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
 {
 	register char* p;
-	register int val;
+	register unsigned int val;
 
 	if ((end - begin) < 4) {
 		hdr->type = HDR_ERROR;
@@ -200,20 +125,18 @@ char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
 	}
 
 	p = begin;
-	val = READ(p);
-	hdr->name.s = begin;
 
+	val = LOWER_DWORD(READ(p));
+	hdr->name.s = begin;
 
 	switch(val) {
 	FIRST_QUATERNIONS;
 
 	default:
-		switch(*p) {
-		case 'T':                           
+		switch(LOWER_BYTE(*p)) {
 		case 't':                           
-			switch(*(p + 1)) {          
+			switch(LOWER_BYTE(*(p + 1))) {          
 			case 'o':                   
-			case 'O':                   
 			case ' ':                   
 				hdr->type = HDR_TO; 
 				p += 2;             
@@ -227,52 +150,16 @@ char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
 			}                           
 			break;
 
-		case 'V':                            
-		case 'v':                            
-			PARSE_COMPACT(HDR_VIA);
-			break;
-			
-		case 'F':
-		case 'f':
-			PARSE_COMPACT(HDR_FROM);
-			break;
-			
-		case 'I':
-		case 'i':
-			PARSE_COMPACT(HDR_CALLID);
-			break;
-
-		case 'M':
-		case 'm':
-			PARSE_COMPACT(HDR_CONTACT);
-			break;
-
-		case 'L':
-		case 'l':
-			PARSE_COMPACT(HDR_CONTENTLENGTH);
-			break;
-
-		case 'C':
-		case 'c':
-			PARSE_COMPACT(HDR_CONTENTTYPE);
-			break;
-
-		case 'K':
-		case 'k':
-			PARSE_COMPACT(HDR_SUPPORTED);
-                        break;
-
-		case 'O':
-		case 'o':
-			PARSE_COMPACT(HDR_EVENT);
-			break;
-		}
-		
-		val = unify(val);
-		switch(val) {
-		FIRST_QUATERNIONS;
-		default: goto other;
+		case 'v': PARSE_COMPACT(HDR_VIA);           break;
+		case 'f': PARSE_COMPACT(HDR_FROM);          break;
+		case 'i': PARSE_COMPACT(HDR_CALLID);        break;
+		case 'm': PARSE_COMPACT(HDR_CONTACT);       break;
+		case 'l': PARSE_COMPACT(HDR_CONTENTLENGTH); break;
+		case 'c': PARSE_COMPACT(HDR_CONTENTTYPE);   break;
+		case 'k': PARSE_COMPACT(HDR_SUPPORTED);     break;
+		case 'o': PARSE_COMPACT(HDR_EVENT);         break;
 		}
+		goto other;
         }
 
 	     /* Double colon hasn't been found yet */
@@ -301,134 +188,3 @@ char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
 		return (p + 1);
 	}
 }
-
-
-/* Number of distinct keys */
-#define NUM_KEYS  608
-
-/* Number of distinct values */
-#define NUM_VALS 50
-
-
-/*
- * Create synonym-less (precalculated) hash table
- */
-void init_hfname_parser(void)
-{
-	int i, j, k;
-
-	     /* Hash table values */
-	unsigned int init_val[NUM_VALS] = {
-		_Allo_, _Auth_, _oriz_, _atio_, _Call_, __ID2_, __ID1_, _Cont_,
-		_act2_, _act1_, _ent__, _Leng_, _th12_, _Type_, _CSeq_, _Expi_,
-		_res2_, _res1_, _From_, _Max__, _Forw_, _ards_, _Prox_, _y_Au_,
-		_thor_, _izat_, _ion2_, _ion1_, _y_Re_, _quir_, _Reco_, _rd_R_,
-		_oute_, _Requ_, _ire2_, _ire1_, _Rout_, _Supp_, _orte_, _To12_,
-		_Unsu_, _ppor_, _ted2_, _ted1_, _Via2_, _Via1_, _WWW__, _enti_,
-		_cate_, _Even_
-	};
-
-	     /* Number of keys associated to each value */
-	unsigned int key_nums[NUM_VALS] = {
-		16, 16, 16, 16, 16,  4,  4, 16, 
-		 8,  8,  8, 16,  4, 16, 16, 16, 
-		 8,  8, 16,  8, 16, 16, 16,  8, 
-		16, 16,  8,  8,  8, 16, 16,  8, 
-		16, 16,  8,  8, 16, 16, 16,  4, 
-		16, 16,  8,  8,  8,  8,  8, 16,
-                16, 16
-	};
-
-	     /* Hash table keys */
-	unsigned int init_key[NUM_KEYS] = {
-		_allo_, _allO_, _alLo_, _alLO_, _aLlo_, _aLlO_, _aLLo_, _aLLO_, 
-		_Allo_, _AllO_, _AlLo_, _AlLO_, _ALlo_, _ALlO_, _ALLo_, _ALLO_, 
-		_auth_, _autH_, _auTh_, _auTH_, _aUth_, _aUtH_, _aUTh_, _aUTH_, 
-		_Auth_, _AutH_, _AuTh_, _AuTH_, _AUth_, _AUtH_, _AUTh_, _AUTH_, 
-		_oriz_, _oriZ_, _orIz_, _orIZ_, _oRiz_, _oRiZ_, _oRIz_, _oRIZ_, 
-		_Oriz_, _OriZ_, _OrIz_, _OrIZ_, _ORiz_, _ORiZ_, _ORIz_, _ORIZ_, 
-		_atio_, _atiO_, _atIo_, _atIO_, _aTio_, _aTiO_, _aTIo_, _aTIO_, 
-		_Atio_, _AtiO_, _AtIo_, _AtIO_, _ATio_, _ATiO_, _ATIo_, _ATIO_, 
-		_call_, _calL_, _caLl_, _caLL_, _cAll_, _cAlL_, _cALl_, _cALL_, 
-		_Call_, _CalL_, _CaLl_, _CaLL_, _CAll_, _CAlL_, _CALl_, _CALL_, 
-		__id2_, __iD2_, __Id2_, __ID2_, __id1_, __iD1_, __Id1_, __ID1_, 
-		_cont_, _conT_, _coNt_, _coNT_, _cOnt_, _cOnT_, _cONt_, _cONT_, 
-		_Cont_, _ConT_, _CoNt_, _CoNT_, _COnt_, _COnT_, _CONt_, _CONT_, 
-		_act2_, _acT2_, _aCt2_, _aCT2_, _Act2_, _AcT2_, _ACt2_, _ACT2_, 
-		_act1_, _acT1_, _aCt1_, _aCT1_, _Act1_, _AcT1_, _ACt1_, _ACT1_, 
-		_ent__, _enT__, _eNt__, _eNT__, _Ent__, _EnT__, _ENt__, _ENT__, 
-		_leng_, _lenG_, _leNg_, _leNG_, _lEng_, _lEnG_, _lENg_, _lENG_, 
-		_Leng_, _LenG_, _LeNg_, _LeNG_, _LEng_, _LEnG_, _LENg_, _LENG_, 
-		_th12_, _tH12_, _Th12_, _TH12_, _type_, _typE_, _tyPe_, _tyPE_, 
-		_tYpe_, _tYpE_, _tYPe_, _tYPE_, _Type_, _TypE_, _TyPe_, _TyPE_, 
-		_TYpe_, _TYpE_, _TYPe_, _TYPE_, _cseq_, _cseQ_, _csEq_, _csEQ_, 
-		_cSeq_, _cSeQ_, _cSEq_, _cSEQ_, _Cseq_, _CseQ_, _CsEq_, _CsEQ_, 
-		_CSeq_, _CSeQ_, _CSEq_, _CSEQ_, _expi_, _expI_, _exPi_, _exPI_, 
-		_eXpi_, _eXpI_, _eXPi_, _eXPI_, _Expi_, _ExpI_, _ExPi_, _ExPI_, 
-		_EXpi_, _EXpI_, _EXPi_, _EXPI_, _res2_, _reS2_, _rEs2_, _rES2_, 
-		_Res2_, _ReS2_, _REs2_, _RES2_, _res1_, _reS1_, _rEs1_, _rES1_, 
-		_Res1_, _ReS1_, _REs1_, _RES1_, _from_, _froM_, _frOm_, _frOM_, 
-		_fRom_, _fRoM_, _fROm_, _fROM_, _From_, _FroM_, _FrOm_, _FrOM_, 
-		_FRom_, _FRoM_, _FROm_, _FROM_, _max__, _maX__, _mAx__, _mAX__, 
-		_Max__, _MaX__, _MAx__, _MAX__, _forw_, _forW_, _foRw_, _foRW_, 
-		_fOrw_, _fOrW_, _fORw_, _fORW_, _Forw_, _ForW_, _FoRw_, _FoRW_, 
-		_FOrw_, _FOrW_, _FORw_, _FORW_, _ards_, _ardS_, _arDs_, _arDS_, 
-		_aRds_, _aRdS_, _aRDs_, _aRDS_, _Ards_, _ArdS_, _ArDs_, _ArDS_, 
-		_ARds_, _ARdS_, _ARDs_, _ARDS_, _prox_, _proX_, _prOx_, _prOX_, 
-		_pRox_, _pRoX_, _pROx_, _pROX_, _Prox_, _ProX_, _PrOx_, _PrOX_, 
-		_PRox_, _PRoX_, _PROx_, _PROX_, _y_au_, _y_aU_, _y_Au_, _y_AU_, 
-		_Y_au_, _Y_aU_, _Y_Au_, _Y_AU_, _thor_, _thoR_, _thOr_, _thOR_, 
-		_tHor_, _tHoR_, _tHOr_, _tHOR_, _Thor_, _ThoR_, _ThOr_, _ThOR_, 
-		_THor_, _THoR_, _THOr_, _THOR_, _izat_, _izaT_, _izAt_, _izAT_, 
-		_iZat_, _iZaT_, _iZAt_, _iZAT_, _Izat_, _IzaT_, _IzAt_, _IzAT_, 
-		_IZat_, _IZaT_, _IZAt_, _IZAT_, _ion2_, _ioN2_, _iOn2_, _iON2_, 
-		_Ion2_, _IoN2_, _IOn2_, _ION2_, _ion1_, _ioN1_, _iOn1_, _iON1_, 
-		_Ion1_, _IoN1_, _IOn1_, _ION1_, _y_re_, _y_rE_, _y_Re_, _y_RE_, 
-		_Y_re_, _Y_rE_, _Y_Re_, _Y_RE_, _quir_, _quiR_, _quIr_, _quIR_, 
-		_qUir_, _qUiR_, _qUIr_, _qUIR_, _Quir_, _QuiR_, _QuIr_, _QuIR_, 
-		_QUir_, _QUiR_, _QUIr_, _QUIR_, _reco_, _recO_, _reCo_, _reCO_, 
-		_rEco_, _rEcO_, _rECo_, _rECO_, _Reco_, _RecO_, _ReCo_, _ReCO_, 
-		_REco_, _REcO_, _RECo_, _RECO_, _rd_r_, _rd_R_, _rD_r_, _rD_R_, 
-		_Rd_r_, _Rd_R_, _RD_r_, _RD_R_, _oute_, _outE_, _ouTe_, _ouTE_, 
-		_oUte_, _oUtE_, _oUTe_, _oUTE_, _Oute_, _OutE_, _OuTe_, _OuTE_, 
-		_OUte_, _OUtE_, _OUTe_, _OUTE_, _requ_, _reqU_, _reQu_, _reQU_, 
-		_rEqu_, _rEqU_, _rEQu_, _rEQU_, _Requ_, _ReqU_, _ReQu_, _ReQU_, 
-		_REqu_, _REqU_, _REQu_, _REQU_, _ire2_, _irE2_, _iRe2_, _iRE2_, 
-		_Ire2_, _IrE2_, _IRe2_, _IRE2_, _ire1_, _irE1_, _iRe1_, _iRE1_, 
-		_Ire1_, _IrE1_, _IRe1_, _IRE1_, _rout_, _rouT_, _roUt_, _roUT_, 
-		_rOut_, _rOuT_, _rOUt_, _rOUT_, _Rout_, _RouT_, _RoUt_, _RoUT_, 
-		_ROut_, _ROuT_, _ROUt_, _ROUT_, _supp_, _supP_, _suPp_, _suPP_, 
-		_sUpp_, _sUpP_, _sUPp_, _sUPP_, _Supp_, _SupP_, _SuPp_, _SuPP_, 
-		_SUpp_, _SUpP_, _SUPp_, _SUPP_, _orte_, _ortE_, _orTe_, _orTE_, 
-		_oRte_, _oRtE_, _oRTe_, _oRTE_, _Orte_, _OrtE_, _OrTe_, _OrTE_, 
-		_ORte_, _ORtE_, _ORTe_, _ORTE_, _to12_, _tO12_, _To12_, _TO12_, 
-		_unsu_, _unsU_, _unSu_, _unSU_, _uNsu_, _uNsU_, _uNSu_, _uNSU_, 
-		_Unsu_, _UnsU_, _UnSu_, _UnSU_, _UNsu_, _UNsU_, _UNSu_, _UNSU_, 
-		_ppor_, _ppoR_, _ppOr_, _ppOR_, _pPor_, _pPoR_, _pPOr_, _pPOR_, 
-		_Ppor_, _PpoR_, _PpOr_, _PpOR_, _PPor_, _PPoR_, _PPOr_, _PPOR_, 
-		_ted2_, _teD2_, _tEd2_, _tED2_, _Ted2_, _TeD2_, _TEd2_, _TED2_, 
-		_ted1_, _teD1_, _tEd1_, _tED1_, _Ted1_, _TeD1_, _TEd1_, _TED1_, 
-		_via2_, _viA2_, _vIa2_, _vIA2_, _Via2_, _ViA2_, _VIa2_, _VIA2_, 
-		_via1_, _viA1_, _vIa1_, _vIA1_, _Via1_, _ViA1_, _VIa1_, _VIA1_, 
-		_www__, _wwW__, _wWw__, _wWW__, _Www__, _WwW__, _WWw__, _WWW__, 
-		_enti_, _entI_, _enTi_, _enTI_, _eNti_, _eNtI_, _eNTi_, _eNTI_, 
-		_Enti_, _EntI_, _EnTi_, _EnTI_, _ENti_, _ENtI_, _ENTi_, _ENTI_, 
-		_cate_, _catE_, _caTe_, _caTE_, _cAte_, _cAtE_, _cATe_, _cATE_, 
-		_Cate_, _CatE_, _CaTe_, _CaTE_, _CAte_, _CAtE_, _CATe_, _CATE_,
-		_even_, _eveN_, _evEn_, _evEN_, _eVen_, _eVeN_, _eVEn_, _eVEN_, 
-		_Even_, _EveN_, _EvEn_, _EvEN_, _EVen_, _EVeN_, _EVEn_, _EVEN_, 
-	}; 
-
-	     /* Mark all elements as empty */
-	for(i = 0; i < HASH_TABLE_SIZE; i++) {
-		set_entry(HASH_EMPTY, HASH_EMPTY);
-	}
-
-	k = 0;
-
-	for(i = 0; i < NUM_VALS; i++) {
-		for(j = 0; j < key_nums[i]; j++) {
-			set_entry(init_key[k++], init_val[i]);
-		}
-	}
-}

+ 4 - 9
parser/parse_hname2.h

@@ -1,5 +1,7 @@
-/*
- * $Id$
+/* 
+ * $Id$ 
+ *
+ * Fast 32-bit Header Field Name Parser
  *
  * Copyright (C) 2001-2003 Fhg Fokus
  *
@@ -37,11 +39,4 @@
  */
 char* parse_hname2(char* begin, char* end, struct hdr_field* hdr);
 
-
-/*
- * Initialize hash table
- */
-void init_hfname_parser(void);
-
-
 #endif /* PARSE_HNAME2_H */