Browse code

added mime subtype xml+msrtc.pidf, needed by PA, and fixed some errors in parse tables. All types and subtypes tested by startup code in PA

Jamey Hicks authored on 19/04/2005 12:50:53
Showing 2 changed files
... ...
@@ -45,7 +45,7 @@
45 45
 
46 46
 
47 47
 #define is_mime_char(_c_) \
48
-	(isalpha((int)_c_) || (_c_)=='-' || (_c_)=='+')
48
+	(isalpha((int)_c_) || (_c_)=='-' || (_c_)=='+' || (_c_)=='.')
49 49
 #define is_char_equal(_c_,_cs_) \
50 50
 	( (isalpha((int)_c_)?(((_c_)|0x20)==(_cs_)):((_c_)==(_cs_)))==1 )
51 51
 
... ...
@@ -63,18 +63,26 @@ typedef struct type_node_s {
63 63
 
64 64
 
65 65
 static type_node_t type_tree[] = {
66
-	{'t',TYPE_UNKNOWN,1,4},
66
+	{'t',TYPE_UNKNOWN,1,4}, /* 0 */
67 67
 		{'e',TYPE_UNKNOWN,1,-1},
68 68
 			{'x',TYPE_UNKNOWN,1,-1},
69 69
 				{'t',TYPE_TEXT,0,-1},
70
-	{'m',TYPE_UNKNOWN,1,11},
71
-		{'e',TYPE_UNKNOWN,1,-1},
70
+	{'m',TYPE_UNKNOWN,2,19}, /* 4 */
71
+		{'e',TYPE_UNKNOWN,1,11}, /* 5 */
72 72
 			{'s',TYPE_UNKNOWN,1,-1},
73 73
 				{'s',TYPE_UNKNOWN,1,-1},
74 74
 					{'a',TYPE_UNKNOWN,1,-1},
75 75
 						{'g',TYPE_UNKNOWN,1,-1},
76 76
 							{'e',TYPE_MESSAGE,0,-1},
77
-	{'a',TYPE_UNKNOWN,1,22},
77
+		{'u',TYPE_UNKNOWN,1,-1}, /* 11 */
78
+			{'l',TYPE_UNKNOWN,1,-1},
79
+				{'t',TYPE_UNKNOWN,1,-1},
80
+					{'i',TYPE_UNKNOWN,1,-1},
81
+						{'p',TYPE_UNKNOWN,1,-1},
82
+							{'a',TYPE_UNKNOWN,1,-1},
83
+								{'r',TYPE_UNKNOWN,1,-1},
84
+									{'t',TYPE_MULTIPART,0,-1},
85
+	{'a',TYPE_UNKNOWN,1,-1}, /* 19 */
78 86
 		{'p',TYPE_UNKNOWN,1,-1},
79 87
 			{'p',TYPE_UNKNOWN,1,-1},
80 88
 				{'l',TYPE_UNKNOWN,1,-1},
... ...
@@ -85,15 +93,6 @@ static type_node_t type_tree[] = {
85 93
 									{'i',TYPE_UNKNOWN,1,-1},
86 94
 										{'o',TYPE_UNKNOWN,1,-1},
87 95
 											{'n',TYPE_APPLICATION,0,-1},
88
-	{'m',TYPE_UNKNOWN,1,-1},
89
-		{'u',TYPE_UNKNOWN,1,-1},
90
-			{'l',TYPE_UNKNOWN,1,-1},
91
-				{'t',TYPE_UNKNOWN,1,-1},
92
-					{'i',TYPE_UNKNOWN,1,-1},
93
-						{'p',TYPE_UNKNOWN,1,-1},
94
-							{'a',TYPE_UNKNOWN,1,-1},
95
-								{'r',TYPE_UNKNOWN,1,-1},
96
-									{'t',TYPE_MULTIPART,0,-1},
97 96
 	};
98 97
 
99 98
 static type_node_t subtype_tree[] = {
... ...
@@ -102,18 +101,18 @@ static type_node_t subtype_tree[] = {
102 101
 			{'a',SUBTYPE_UNKNOWN,1,-1},
103 102
 				{'i',SUBTYPE_UNKNOWN,1,-1},
104 103
 					{'n',SUBTYPE_PLAIN,0,-1},
105
-		{'i',SUBTYPE_UNKNOWN,1,-1},
104
+		{'i',SUBTYPE_UNKNOWN,1,-1}, /* 5 */
106 105
 			{'d',SUBTYPE_UNKNOWN,1,-1},
107 106
 				{'f',SUBTYPE_UNKNOWN,1,-1},
108
-					{'i',SUBTYPE_UNKNOWN,1,-1},
109
-						{'+',TYPE_UNKNOWN,1,-1},
110
-							{'x',TYPE_UNKNOWN,1,-1},
111
-								{'m',TYPE_UNKNOWN,1,-1},
107
+					{'+',TYPE_UNKNOWN,1,-1},
108
+						{'x',TYPE_UNKNOWN,1,-1},
109
+							{'m',TYPE_UNKNOWN,1,-1},
110
+								{'l',SUBTYPE_PIDFXML,0,-1},
112 111
 									{'l',SUBTYPE_PIDFXML,0,-1},
113
-	{'s',SUBTYPE_UNKNOWN,1,16},
112
+	{'s',SUBTYPE_UNKNOWN,1,16}, /* 13 */
114 113
 		{'d',SUBTYPE_UNKNOWN,1,-1},
115 114
 			{'p',SUBTYPE_SDP,0,-1},
116
-	{'c',SUBTYPE_UNKNOWN,1,25},
115
+	{'c',SUBTYPE_UNKNOWN,1,25}, /* 16 */
117 116
 		{'p',SUBTYPE_UNKNOWN,2,-1},
118 117
 			{'i',SUBTYPE_UNKNOWN,1,20},
119 118
 				{'m',SUBTYPE_CPIM,0,-1},
... ...
@@ -122,31 +121,30 @@ static type_node_t subtype_tree[] = {
122 121
 					{'x',TYPE_UNKNOWN,1,-1},
123 122
 						{'m',TYPE_UNKNOWN,1,-1},
124 123
 							{'l',SUBTYPE_CPLXML,0,-1},
125
-	{'r',SUBTYPE_UNKNOWN,2,39},
126
-		{'l',SUBTYPE_UNKNOWN,1,42},
124
+	{'r',SUBTYPE_UNKNOWN,2,39}, /* 25 */
125
+		{'l',SUBTYPE_UNKNOWN,1,33},/* 26 */
127 126
 			{'m',SUBTYPE_UNKNOWN,1,-1},
128 127
 				{'i',SUBTYPE_UNKNOWN,1,-1},
129 128
 					{'+',TYPE_UNKNOWN,1,-1},
130 129
 						{'x',TYPE_UNKNOWN,1,-1},
131 130
 							{'m',TYPE_UNKNOWN,1,-1},
132 131
 								{'l',SUBTYPE_RLMIXML,0,-1},
133
-		{'e',SUBTYPE_UNKNOWN,1,-1},
132
+		{'e',SUBTYPE_UNKNOWN,1,-1}, /* 33 */
134 133
 			{'l',SUBTYPE_UNKNOWN,1,-1},
135 134
 				{'a',SUBTYPE_UNKNOWN,1,-1},
136 135
 					{'t',SUBTYPE_UNKNOWN,1,-1},
137 136
 						{'e',SUBTYPE_UNKNOWN,1,-1},
138 137
 							{'d',SUBTYPE_RELATED,0,-1},
139
-	{'l',SUBTYPE_UNKNOWN,1,49},
138
+	{'l',SUBTYPE_UNKNOWN,1,48}, /* 39 */
140 139
 		{'p',SUBTYPE_UNKNOWN,1,-1},
141 140
 			{'i',SUBTYPE_UNKNOWN,1,-1},
142 141
 				{'d',SUBTYPE_UNKNOWN,1,-1},
143 142
 					{'f',SUBTYPE_UNKNOWN,1,-1},
144
-						{'i',SUBTYPE_UNKNOWN,1,-1},
145
-							{'+',TYPE_UNKNOWN,1,-1},
146
-								{'x',TYPE_UNKNOWN,1,-1},
147
-									{'m',TYPE_UNKNOWN,1,-1},
148
-										{'l',SUBTYPE_LPIDFXML,0,-1},
149
-	{'w',SUBTYPE_UNKNOWN,1,64},
143
+						{'+',SUBTYPE_UNKNOWN,1,-1},
144
+							{'x',SUBTYPE_UNKNOWN,1,-1},
145
+								{'m',SUBTYPE_UNKNOWN,1,-1},
146
+									{'l',SUBTYPE_LPIDFXML,0,-1},
147
+	{'w',SUBTYPE_UNKNOWN,1,63}, /* 48 */
150 148
 		{'a',SUBTYPE_UNKNOWN,1,-1},
151 149
 			{'t',SUBTYPE_UNKNOWN,1,-1},
152 150
 				{'c',SUBTYPE_UNKNOWN,1,-1},
... ...
@@ -161,29 +159,41 @@ static type_node_t subtype_tree[] = {
161 159
 													{'x',TYPE_UNKNOWN,1,-1},
162 160
 														{'m',TYPE_UNKNOWN,1,-1},
163 161
 															{'l',SUBTYPE_WATCHERINFOXML,0,-1},
164
-	{'x',SUBTYPE_UNKNOWN,1,74},
165
-		{'p',SUBTYPE_UNKNOWN,1,-1},
162
+	{'x',SUBTYPE_UNKNOWN,2,85}, /* 63 */
163
+		{'p',SUBTYPE_UNKNOWN,1,72}, /* 64 */
166 164
 			{'i',SUBTYPE_UNKNOWN,1,-1},
167 165
 				{'d',SUBTYPE_UNKNOWN,1,-1},
168 166
 					{'f',SUBTYPE_UNKNOWN,1,-1},
169
-						{'i',SUBTYPE_UNKNOWN,1,-1},
170
-							{'+',TYPE_UNKNOWN,1,-1},
171
-								{'x',TYPE_UNKNOWN,1,-1},
172
-									{'m',TYPE_UNKNOWN,1,-1},
173
-										{'l',SUBTYPE_XPIDFXML,0,-1},
174
-	{'e',SUBTYPE_UNKNOWN,1,-1},
167
+						{'+',SUBTYPE_UNKNOWN,1,-1},
168
+							{'x',SUBTYPE_UNKNOWN,1,-1},
169
+								{'m',SUBTYPE_UNKNOWN,1,-1},
170
+									{'l',SUBTYPE_XPIDFXML,0,-1},
171
+		{'m',SUBTYPE_UNKNOWN,1,-1}, /* 72 */
172
+			{'l',SUBTYPE_UNKNOWN,1,-1},
173
+				{'+',SUBTYPE_UNKNOWN,1,-1},
174
+					{'m',SUBTYPE_UNKNOWN,1,-1},
175
+						{'s',SUBTYPE_UNKNOWN,1,-1},
176
+							{'r',SUBTYPE_UNKNOWN,1,-1},
177
+								{'t',SUBTYPE_UNKNOWN,1,-1},
178
+									{'c',SUBTYPE_UNKNOWN,1,-1},
179
+										{'.',SUBTYPE_UNKNOWN,1,-1},
180
+											{'p',SUBTYPE_UNKNOWN,1,-1},
181
+												{'i',SUBTYPE_UNKNOWN,1,-1}, 
182
+													{'d',SUBTYPE_UNKNOWN,1,-1},
183
+														{'f',SUBTYPE_XML_MSRTC_PIDF,0,-1},
184
+	{'e',SUBTYPE_UNKNOWN,1,-1}, /* 85 */
175 185
 		{'x',SUBTYPE_UNKNOWN,1,-1},
176 186
 			{'t',SUBTYPE_UNKNOWN,1,-1},
177 187
 				{'e',SUBTYPE_UNKNOWN,1,-1},
178 188
 					{'r',SUBTYPE_UNKNOWN,1,-1},
179 189
 						{'n',SUBTYPE_UNKNOWN,1,-1},
180
-							{'a',TYPE_UNKNOWN,1,-1},
181
-								{'l',TYPE_UNKNOWN,1,-1},
182
-									{'-',TYPE_UNKNOWN,1,-1},
183
-										{'b',SUBTYPE_LPIDFXML,0,-1},
184
-											{'o',TYPE_UNKNOWN,1,-1},
185
-												{'d',TYPE_UNKNOWN,1,-1},
186
-													{'y',SUBTYPE_EXTERNAL_BODY,1,-1},
190
+							{'a',SUBTYPE_UNKNOWN,1,-1},
191
+								{'l',SUBTYPE_UNKNOWN,1,-1},
192
+									{'-',SUBTYPE_UNKNOWN,1,-1},
193
+										{'b',SUBTYPE_UNKNOWN,1,-1},
194
+											{'o',SUBTYPE_UNKNOWN,1,-1},
195
+												{'d',SUBTYPE_UNKNOWN,1,-1},
196
+													{'y',SUBTYPE_EXTERNAL_BODY,0,-1},
187 197
 
188 198
 	};
189 199
 
... ...
@@ -322,14 +332,14 @@ char* decode_mime_type(char *start, char *end, unsigned int *mime_type)
322 332
 
323 333
 	/* check the format of the decoded mime */
324 334
 	if ((*mime_type)>>16==TYPE_ALL && ((*mime_type)&0x00ff)!=SUBTYPE_ALL) {
325
-		LOG(L_ERR,"ERROR:decode_mine_type: invalid mime format found "
335
+		LOG(L_ERR,"ERROR:decode_mime_type: invalid mime format found "
326 336
 			" <*/submime> in [%.*s]!!\n", (int)(end-start),start);
327 337
 		return 0;
328 338
 	}
329 339
 
330 340
 	return p;
331 341
 error:
332
-	LOG(L_ERR,"ERROR:decode_mine_type: parse error near in [%.*s] char"
342
+	LOG(L_ERR,"ERROR:decode_mime_type: parse error near in [%.*s] char"
333 343
 		"[%d][%c] offset=%d\n", (int)(end-start),start,*p,*p,(int)(p-start));
334 344
 	return 0;
335 345
 }
... ...
@@ -60,6 +60,7 @@ struct mime_type {
60 60
 #define SUBTYPE_XPIDFXML     9
61 61
 #define SUBTYPE_WATCHERINFOXML     10
62 62
 #define SUBTYPE_EXTERNAL_BODY      11
63
+#define SUBTYPE_XML_MSRTC_PIDF     12
63 64
 #define SUBTYPE_ALL          0xfe
64 65
 #define SUBTYPE_UNKNOWN      0xff
65 66