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 85
 									{'i',TYPE_UNKNOWN,1,-1},
86 86
 										{'o',TYPE_UNKNOWN,1,-1},
87 87
 											{'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 88
 	};
98 89
 
99 90
 static type_node_t subtype_tree[] = {
... ...
@@ -102,18 +101,18 @@ static type_node_t subtype_tree[] = {
102 102
 			{'a',SUBTYPE_UNKNOWN,1,-1},
103 103
 				{'i',SUBTYPE_UNKNOWN,1,-1},
104 104
 					{'n',SUBTYPE_PLAIN,0,-1},
105
-		{'i',SUBTYPE_UNKNOWN,1,-1},
105
+		{'i',SUBTYPE_UNKNOWN,1,-1}, /* 5 */
106 106
 			{'d',SUBTYPE_UNKNOWN,1,-1},
107 107
 				{'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},
108
+					{'+',TYPE_UNKNOWN,1,-1},
109
+						{'x',TYPE_UNKNOWN,1,-1},
110
+							{'m',TYPE_UNKNOWN,1,-1},
111
+								{'l',SUBTYPE_PIDFXML,0,-1},
112 112
 									{'l',SUBTYPE_PIDFXML,0,-1},
113
-	{'s',SUBTYPE_UNKNOWN,1,16},
113
+	{'s',SUBTYPE_UNKNOWN,1,16}, /* 13 */
114 114
 		{'d',SUBTYPE_UNKNOWN,1,-1},
115 115
 			{'p',SUBTYPE_SDP,0,-1},
116
-	{'c',SUBTYPE_UNKNOWN,1,25},
116
+	{'c',SUBTYPE_UNKNOWN,1,25}, /* 16 */
117 117
 		{'p',SUBTYPE_UNKNOWN,2,-1},
118 118
 			{'i',SUBTYPE_UNKNOWN,1,20},
119 119
 				{'m',SUBTYPE_CPIM,0,-1},
... ...
@@ -122,31 +121,30 @@ static type_node_t subtype_tree[] = {
122 122
 					{'x',TYPE_UNKNOWN,1,-1},
123 123
 						{'m',TYPE_UNKNOWN,1,-1},
124 124
 							{'l',SUBTYPE_CPLXML,0,-1},
125
-	{'r',SUBTYPE_UNKNOWN,2,39},
126
-		{'l',SUBTYPE_UNKNOWN,1,42},
125
+	{'r',SUBTYPE_UNKNOWN,2,39}, /* 25 */
126
+		{'l',SUBTYPE_UNKNOWN,1,33},/* 26 */
127 127
 			{'m',SUBTYPE_UNKNOWN,1,-1},
128 128
 				{'i',SUBTYPE_UNKNOWN,1,-1},
129 129
 					{'+',TYPE_UNKNOWN,1,-1},
130 130
 						{'x',TYPE_UNKNOWN,1,-1},
131 131
 							{'m',TYPE_UNKNOWN,1,-1},
132 132
 								{'l',SUBTYPE_RLMIXML,0,-1},
133
-		{'e',SUBTYPE_UNKNOWN,1,-1},
133
+		{'e',SUBTYPE_UNKNOWN,1,-1}, /* 33 */
134 134
 			{'l',SUBTYPE_UNKNOWN,1,-1},
135 135
 				{'a',SUBTYPE_UNKNOWN,1,-1},
136 136
 					{'t',SUBTYPE_UNKNOWN,1,-1},
137 137
 						{'e',SUBTYPE_UNKNOWN,1,-1},
138 138
 							{'d',SUBTYPE_RELATED,0,-1},
139
-	{'l',SUBTYPE_UNKNOWN,1,49},
139
+	{'l',SUBTYPE_UNKNOWN,1,48}, /* 39 */
140 140
 		{'p',SUBTYPE_UNKNOWN,1,-1},
141 141
 			{'i',SUBTYPE_UNKNOWN,1,-1},
142 142
 				{'d',SUBTYPE_UNKNOWN,1,-1},
143 143
 					{'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},
144
+						{'+',SUBTYPE_UNKNOWN,1,-1},
145
+							{'x',SUBTYPE_UNKNOWN,1,-1},
146
+								{'m',SUBTYPE_UNKNOWN,1,-1},
147
+									{'l',SUBTYPE_LPIDFXML,0,-1},
148
+	{'w',SUBTYPE_UNKNOWN,1,63}, /* 48 */
150 149
 		{'a',SUBTYPE_UNKNOWN,1,-1},
151 150
 			{'t',SUBTYPE_UNKNOWN,1,-1},
152 151
 				{'c',SUBTYPE_UNKNOWN,1,-1},
... ...
@@ -161,29 +159,41 @@ static type_node_t subtype_tree[] = {
161 161
 													{'x',TYPE_UNKNOWN,1,-1},
162 162
 														{'m',TYPE_UNKNOWN,1,-1},
163 163
 															{'l',SUBTYPE_WATCHERINFOXML,0,-1},
164
-	{'x',SUBTYPE_UNKNOWN,1,74},
165
-		{'p',SUBTYPE_UNKNOWN,1,-1},
164
+	{'x',SUBTYPE_UNKNOWN,2,85}, /* 63 */
165
+		{'p',SUBTYPE_UNKNOWN,1,72}, /* 64 */
166 166
 			{'i',SUBTYPE_UNKNOWN,1,-1},
167 167
 				{'d',SUBTYPE_UNKNOWN,1,-1},
168 168
 					{'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},
169
+						{'+',SUBTYPE_UNKNOWN,1,-1},
170
+							{'x',SUBTYPE_UNKNOWN,1,-1},
171
+								{'m',SUBTYPE_UNKNOWN,1,-1},
172
+									{'l',SUBTYPE_XPIDFXML,0,-1},
173
+		{'m',SUBTYPE_UNKNOWN,1,-1}, /* 72 */
174
+			{'l',SUBTYPE_UNKNOWN,1,-1},
175
+				{'+',SUBTYPE_UNKNOWN,1,-1},
176
+					{'m',SUBTYPE_UNKNOWN,1,-1},
177
+						{'s',SUBTYPE_UNKNOWN,1,-1},
178
+							{'r',SUBTYPE_UNKNOWN,1,-1},
179
+								{'t',SUBTYPE_UNKNOWN,1,-1},
180
+									{'c',SUBTYPE_UNKNOWN,1,-1},
181
+										{'.',SUBTYPE_UNKNOWN,1,-1},
182
+											{'p',SUBTYPE_UNKNOWN,1,-1},
183
+												{'i',SUBTYPE_UNKNOWN,1,-1}, 
184
+													{'d',SUBTYPE_UNKNOWN,1,-1},
185
+														{'f',SUBTYPE_XML_MSRTC_PIDF,0,-1},
186
+	{'e',SUBTYPE_UNKNOWN,1,-1}, /* 85 */
175 187
 		{'x',SUBTYPE_UNKNOWN,1,-1},
176 188
 			{'t',SUBTYPE_UNKNOWN,1,-1},
177 189
 				{'e',SUBTYPE_UNKNOWN,1,-1},
178 190
 					{'r',SUBTYPE_UNKNOWN,1,-1},
179 191
 						{'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},
192
+							{'a',SUBTYPE_UNKNOWN,1,-1},
193
+								{'l',SUBTYPE_UNKNOWN,1,-1},
194
+									{'-',SUBTYPE_UNKNOWN,1,-1},
195
+										{'b',SUBTYPE_UNKNOWN,1,-1},
196
+											{'o',SUBTYPE_UNKNOWN,1,-1},
197
+												{'d',SUBTYPE_UNKNOWN,1,-1},
198
+													{'y',SUBTYPE_EXTERNAL_BODY,0,-1},
187 199
 
188 200
 	};
189 201
 
... ...
@@ -322,14 +332,14 @@ char* decode_mime_type(char *start, char *end, unsigned int *mime_type)
322 322
 
323 323
 	/* check the format of the decoded mime */
324 324
 	if ((*mime_type)>>16==TYPE_ALL && ((*mime_type)&0x00ff)!=SUBTYPE_ALL) {
325
-		LOG(L_ERR,"ERROR:decode_mine_type: invalid mime format found "
325
+		LOG(L_ERR,"ERROR:decode_mime_type: invalid mime format found "
326 326
 			" <*/submime> in [%.*s]!!\n", (int)(end-start),start);
327 327
 		return 0;
328 328
 	}
329 329
 
330 330
 	return p;
331 331
 error:
332
-	LOG(L_ERR,"ERROR:decode_mine_type: parse error near in [%.*s] char"
332
+	LOG(L_ERR,"ERROR:decode_mime_type: parse error near in [%.*s] char"
333 333
 		"[%d][%c] offset=%d\n", (int)(end-start),start,*p,*p,(int)(p-start));
334 334
 	return 0;
335 335
 }
... ...
@@ -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