4
#include "resip/stack/Contents.hxx"
5
#include "resip/stack/SdpContents.hxx"
6
#include "resip/stack/SipMessage.hxx"
7
#include "resip/stack/ExtensionHeader.hxx"
8
#include "resip/stack/ExtensionParameter.hxx"
9
#include "resip/stack/ParserCategories.hxx"
10
#include "resip/stack/ParameterTypes.hxx"
11
#include "resip/stack/Uri.hxx"
12
#include "rutil/Logger.hxx"
15
#define RESIPROCATE_SUBSYSTEM resip::Subsystem::TEST
21
This short, relatively human-readable message contains:
23
o line folding all over.
25
o escaped characters within quotes.
29
o LWS between colons, semicolons, header field values, and other
32
o both comma separated and separately listed header field values.
34
o a mix of short and long form for the same header field name.
36
o unknown Request-URI parameter.
38
o unknown header fields.
40
o an unknown header field with a value that would be syntactically
41
invalid if it were defined in terms of generic-param.
43
o unusual header field ordering.
45
o unusual header field name character case.
47
o unknown parameters of a known header field.
49
o a uri parameter with no value.
51
o a header parameter with no value.
53
o integer fields (Max-Forwards and CSeq) with leading zeros.
55
All elements should treat this as a well-formed request.
57
The UnknownHeaderWithUnusualValue header field deserves special
58
attention. If this header field were defined in terms of comma-
59
separated values with semicolon-separated parameters (as would many
60
of the existing defined header fields), this would be invalid.
61
However, since the receiving element does not know the definition of
62
the syntax for this field, it must parse it as a header value.
63
Proxies would forward this header field unchanged. Endpoints would
64
ignore the header field.
66
INVITE sip:vivekg@chair-dnrc.example.com;unknownparam SIP/2.0
68
sip:vivekg@chair-dnrc.example.com ; tag = 1918181833n
69
from : "J Rosenberg \\\"" <sip:jdrosen@example.com>
73
Call-ID: wsinv.ndaksdj@192.0.2.1
79
192.0.2.2;branch=390skdjuw
81
NewFangledHeader: newfangled value
82
continued newfangled value
83
UnknownHeaderWithUnusualValue: ;;,,;;,;
84
Content-Type: application/sdp
86
<sip:services.example.com;lr;unknownwith=value;unknown-no-value>
87
v: SIP / 2.0 / TCP spindle.example.com ;
88
branch = z9hG4bK9ikj8 ,
89
SIP / 2.0 / UDP 192.168.255.111 ; branch=
91
m:"Quoted string \"\"" <sip:jdrosen@example.com> ; newparam =
93
secondparam ; q = 0.33
96
o=mhandley 29739 7272939 IN IP4 192.0.2.3
100
m=audio 49217 RTP/AVP 0 12
101
m=video 3227 RTP/AVP 31
105
FILE* fid= fopen("wsinv.dat","r");
112
result = fread(&mBuf,1,1024,fid);
113
txt += resip::Data(mBuf,result);
116
resip::SipMessage* msg = resip::SipMessage::make(txt);
125
std::auto_ptr<resip::SipMessage> message(msg);
126
msg->parseAllHeaders();
128
resip::SipMessage copy(*msg);
132
resip::oDataStream str(encoded);
135
resip::Data copyEncoded;
137
resip::oDataStream str(copyEncoded);
142
tassert(msg->header(resip::h_RequestLine).method()==resip::INVITE);
143
tassert(msg->header(resip::h_RequestLine).unknownMethodName()=="INVITE");
144
tassert(msg->header(resip::h_RequestLine).uri().scheme()=="sip");
145
tassert(msg->header(resip::h_RequestLine).uri().user()=="vivekg");
146
tassert(msg->header(resip::h_RequestLine).uri().host()=="chair-dnrc.example.com");
147
tassert(msg->header(resip::h_RequestLine).uri().port()==0);
148
tassert(msg->header(resip::h_RequestLine).uri().password().empty());
149
tassert(!(msg->header(resip::h_RequestLine).uri().hasEmbedded()));
150
tassert(msg->header(resip::h_RequestLine).uri().numKnownParams()==0);
151
tassert(msg->header(resip::h_RequestLine).uri().numUnknownParams()==1);
152
resip::ExtensionParameter p_unknownparam("unknownparam");
153
tassert(msg->header(resip::h_RequestLine).uri().exists(p_unknownparam));
154
tassert(msg->header(resip::h_RequestLine).getSipVersion()=="SIP/2.0");
157
tassert(msg->exists(resip::h_To));
158
tassert(msg->header(resip::h_To).displayName().empty());
159
tassert(msg->header(resip::h_To).numKnownParams()==1);
160
tassert(msg->header(resip::h_To).numUnknownParams()==0);
161
tassert(msg->header(resip::h_To).exists(resip::p_tag));
162
tassert(msg->header(resip::h_To).param(resip::p_tag)=="1918181833n");
163
tassert(!(msg->header(resip::h_To).isAllContacts()));
164
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
165
tassert(msg->header(resip::h_To).uri().user()=="vivekg");
166
tassert(msg->header(resip::h_To).uri().host()=="chair-dnrc.example.com");
167
tassert(msg->header(resip::h_To).uri().port()==0);
168
tassert(msg->header(resip::h_To).uri().password().empty());
169
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
170
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
171
tassert(msg->header(resip::h_To).uri().numUnknownParams()==0);
174
tassert(msg->exists(resip::h_From));
175
tassert(msg->header(resip::h_From).displayName()=="J Rosenberg \\\\\\\"");
176
tassert(msg->header(resip::h_From).numKnownParams()==1);
177
tassert(msg->header(resip::h_From).numUnknownParams()==0);
178
tassert(msg->header(resip::h_From).exists(resip::p_tag));
179
tassert(msg->header(resip::h_From).param(resip::p_tag)=="98asjd8");
180
tassert(!(msg->header(resip::h_From).isAllContacts()));
181
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
182
tassert(msg->header(resip::h_From).uri().user()=="jdrosen");
183
tassert(msg->header(resip::h_From).uri().host()=="example.com");
184
tassert(msg->header(resip::h_From).uri().port()==0);
185
tassert(msg->header(resip::h_From).uri().password().empty());
186
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
187
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
188
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
191
tassert(msg->exists(resip::h_MaxForwards));
192
tassert(msg->header(resip::h_MaxForwards).value()==68);
193
tassert(msg->header(resip::h_MaxForwards).numKnownParams()==0);
194
tassert(msg->header(resip::h_MaxForwards).numUnknownParams()==0);
198
tassert(msg->exists(resip::h_CallID));
199
tassert(msg->header(resip::h_CallID).value()=="wsinv.ndaksdj@192.0.2.1");
200
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
201
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
204
tassert(msg->exists(resip::h_ContentLength));
205
tassert(msg->header(resip::h_ContentLength).value()==150);
206
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
207
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
210
tassert(msg->exists(resip::h_CSeq));
211
tassert(msg->header(resip::h_CSeq).method()==resip::INVITE);
212
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="INVITE");
213
tassert(msg->header(resip::h_CSeq).sequence()==9);
214
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
215
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
218
tassert(msg->exists(resip::h_Vias));
219
tassert(msg->header(resip::h_Vias).size()==3);
220
resip::ParserContainer<resip::Via>::iterator i=msg->header(resip::h_Vias).begin();
222
tassert(i->numKnownParams()==1);
223
tassert(i->numUnknownParams()==0);
224
tassert(i->protocolName()=="SIP");
225
tassert(i->protocolVersion()=="2.0");
226
tassert(i->transport()=="UDP");
227
tassert(i->sentHost()=="192.0.2.2");
228
tassert(i->sentPort()==0);
230
tassert(i->exists(resip::p_branch));
231
tassert(!(i->param(resip::p_branch).hasMagicCookie()));
232
tassert(i->param(resip::p_branch).getTransactionId()=="390skdjuw");
233
tassert(i->param(resip::p_branch).clientData().empty());
237
tassert(i->numKnownParams()==1);
238
tassert(i->numUnknownParams()==0);
239
tassert(i->protocolName()=="SIP");
240
tassert(i->protocolVersion()=="2.0");
241
tassert(i->transport()=="TCP");
242
tassert(i->sentHost()=="spindle.example.com");
243
tassert(i->sentPort()==0);
245
tassert(i->exists(resip::p_branch));
246
tassert(i->param(resip::p_branch).hasMagicCookie());
247
tassert(i->param(resip::p_branch).getTransactionId()=="9ikj8");
248
tassert(i->param(resip::p_branch).clientData().empty());
252
tassert(i->numKnownParams()==1);
253
tassert(i->numUnknownParams()==0);
254
tassert(i->protocolName()=="SIP");
255
tassert(i->protocolVersion()=="2.0");
256
tassert(i->transport()=="UDP");
257
tassert(i->sentHost()=="192.168.255.111");
258
tassert(i->sentPort()==0);
260
tassert(i->exists(resip::p_branch));
261
tassert(i->param(resip::p_branch).hasMagicCookie());
262
tassert(i->param(resip::p_branch).getTransactionId()=="30239");
263
tassert(i->param(resip::p_branch).clientData().empty());
267
tassert(msg->exists(resip::h_Subject));
268
tassert(msg->header(resip::h_Subject).value()=="");
269
tassert(msg->header(resip::h_Subject).numKnownParams()==0);
270
tassert(msg->header(resip::h_Subject).numUnknownParams()==0);
274
resip::ExtensionHeader h_NewFangledHeader("NewFangledHeader");
276
tassert(msg->exists(h_NewFangledHeader));
277
tassert(msg->header(h_NewFangledHeader).size()==1);
278
tassert(msg->header(h_NewFangledHeader).begin()->value()=="newfangled value\r\n continued newfangled value");
279
tassert(msg->header(h_NewFangledHeader).begin()->numKnownParams()==0);
280
tassert(msg->header(h_NewFangledHeader).begin()->numUnknownParams()==0);
282
resip::ExtensionHeader h_UnknownHeaderWithUnusualValue("UnknownHeaderWithUnusualValue");
284
tassert(msg->exists(h_UnknownHeaderWithUnusualValue));
285
tassert(msg->header(h_UnknownHeaderWithUnusualValue).size()==1);
286
tassert(msg->header(h_UnknownHeaderWithUnusualValue).begin()->value()==";;,,;;,;");
287
tassert(msg->header(h_UnknownHeaderWithUnusualValue).begin()->numKnownParams()==0);
288
tassert(msg->header(h_UnknownHeaderWithUnusualValue).begin()->numUnknownParams()==0);
291
tassert(msg->exists(resip::h_ContentType));
292
tassert(msg->header(resip::h_ContentType).type()=="application");
293
tassert(msg->header(resip::h_ContentType).subType()=="sdp");
294
tassert(msg->header(resip::h_ContentType).numKnownParams()==0);
295
tassert(msg->header(resip::h_ContentType).numUnknownParams()==0);
298
tassert(msg->exists(resip::h_Contacts));
299
tassert(msg->header(resip::h_Contacts).size()==1);
300
tassert(msg->header(resip::h_Contacts).begin()->displayName()=="Quoted string \\\"\\\"");
301
tassert(msg->header(resip::h_Contacts).begin()->numKnownParams()==1);
302
tassert(msg->header(resip::h_Contacts).begin()->numUnknownParams()==2);
303
tassert(!(msg->header(resip::h_Contacts).begin()->isAllContacts()));
304
tassert(msg->header(resip::h_Contacts).begin()->uri().numKnownParams()==0);
305
tassert(msg->header(resip::h_Contacts).begin()->uri().numUnknownParams()==0);
306
tassert(msg->header(resip::h_Contacts).begin()->uri().scheme()=="sip");
307
tassert(msg->header(resip::h_Contacts).begin()->uri().user()=="jdrosen");
308
tassert(msg->header(resip::h_Contacts).begin()->uri().host()=="example.com");
309
tassert(msg->header(resip::h_Contacts).begin()->uri().port()==0);
310
tassert(msg->header(resip::h_Contacts).begin()->uri().password().empty());
311
tassert(!(msg->header(resip::h_Contacts).begin()->uri().hasEmbedded()));
313
resip::ExtensionParameter p_newparam("newparam");
314
tassert(msg->header(resip::h_Contacts).begin()->exists(p_newparam));
315
tassert(msg->header(resip::h_Contacts).begin()->param(p_newparam)=="newvalue");
317
resip::ExtensionParameter p_secondparam("secondparam");
318
tassert(msg->header(resip::h_Contacts).begin()->exists(p_secondparam));
319
tassert(msg->header(resip::h_Contacts).begin()->param(p_secondparam)=="");
321
tassert(msg->header(resip::h_Contacts).begin()->exists(resip::p_q));
322
tassert(msg->header(resip::h_Contacts).begin()->param(resip::p_q)==330);
328
InfoLog(<< "In case wsinv:" );
329
InfoLog(<< "Original text:" << std::endl << txt );
330
InfoLog(<< "Encoded form:" << std::endl << encoded );
331
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
344
This message exercises a wider range of characters in several key
345
syntactic elements than implementations usually see. In particular,
348
o The Method contains non-alpha characters from token. Note that %
349
is not an escape character for this field. A method of IN%56ITE
350
is an unknown method. It is not the same as a method of INVITE.
352
o The Request-URI contains unusual, but legal, characters.
354
o A branch parameter contains all non-alphanum characters from
357
o The To header field value's quoted string contains quoted-pair
358
expansions, including a quoted NULL character.
360
o The name part of name-addr in the From header field value contains
361
multiple tokens (instead of a quoted string) with all non-alphanum
362
characters from the token production rule. That value also has an
363
unknown header parameter whose name contains the non-alphanum
364
token characters and whose value is a non-ascii range UTF-8
365
encoded string. The tag parameter on this value contains the
366
non-alphanum token characters.
368
o The Call-ID header field value contains the non-alphanum
369
characters from word. Notice that in this production:
371
* % is not an escape character. It is only an escape character
372
in productions matching the rule "escaped".
374
* " does not start a quoted string. None of ',` or " imply that
375
there will be a matching symbol later in the string.
377
* The characters []{}()<> do not have any grouping semantics.
378
They are not required to appear in balanced pairs.
380
o There is an unknown header field (matching extension-header) with
381
non-alphanum token characters in its name and a UTF8-NONASCII
384
If this unusual URI has been defined at a proxy, the proxy will
385
forward this request normally. Otherwise, a proxy will generate a
386
404. Endpoints will generate a 501 listing the methods they
387
understand in an Allow header field.
390
!interesting-Method0123456789_*+`.%indeed'~ sip:1_unusual.URI~(to-be!sure)&isn't+it$/crazy?,/;;*:&it+has=1,weird!*pas$wo~d_too.(doesn't-it)@example.com SIP/2.0
391
Via: SIP/2.0/TCP host1.example.com;branch=z9hG4bK-.!%66*_+`'~
392
To: "BEL:\ NUL:\ DEL:\" <sip:1_unusual.URI~(to-be!sure)&isn't+it$/crazy?,/;;*@example.com>
393
From: token1~` token2'+_ token3*%!.- <sip:mundane@example.com>;fromParam''~+*_!.-%="ŃŠ°Š±Š¾ŃŠ°ŃŃŠøŠ¹";tag=_token~1'+`*%!-.
394
Call-ID: intmeth.word%ZK-!.*_+'@word`~)(><:\/"][?}{
395
CSeq: 139122385 !interesting-Method0123456789_*+`.%indeed'~
397
extensionHeader-!.%*+_`'~:ļ»æ大åé»
404
FILE* fid= fopen("intmeth.dat","r");
411
result = fread(&mBuf,1,1024,fid);
412
txt += resip::Data(mBuf,result);
415
resip::SipMessage* msg = resip::SipMessage::make(txt);
424
std::auto_ptr<resip::SipMessage> message(msg);
425
msg->parseAllHeaders();
427
resip::SipMessage copy(*msg);
431
resip::oDataStream str(encoded);
434
resip::Data copyEncoded;
436
resip::oDataStream str(copyEncoded);
441
tassert(msg->header(resip::h_RequestLine).method()==resip::UNKNOWN);
442
tassert(msg->header(resip::h_RequestLine).unknownMethodName()=="!interesting-Method0123456789_*+`.%indeed'~");
443
tassert(msg->header(resip::h_RequestLine).uri().scheme()=="sip");
444
tassert(msg->header(resip::h_RequestLine).uri().user()=="1_unusual.URI~(to-be!sure)&isn't+it$/crazy?,/;;*");
445
tassert(msg->header(resip::h_RequestLine).uri().password()=="&it+has=1,weird!*pas$wo~d_too.(doesn't-it)");
446
tassert(msg->header(resip::h_RequestLine).uri().host()=="example.com");
447
tassert(msg->header(resip::h_RequestLine).uri().port()==0);
448
tassert(!(msg->header(resip::h_RequestLine).uri().hasEmbedded()));
449
tassert(msg->header(resip::h_RequestLine).uri().numKnownParams()==0);
450
tassert(msg->header(resip::h_RequestLine).uri().numUnknownParams()==0);
451
tassert(msg->header(resip::h_RequestLine).getSipVersion()=="SIP/2.0");
454
tassert(msg->exists(resip::h_To));
455
tassert(msg->header(resip::h_To).numKnownParams()==0);
456
tassert(msg->header(resip::h_To).numUnknownParams()==0);
457
resip::Data dispName;
459
dispName+=(char)0x07;
461
dispName+=(char)0x00;
463
dispName+=(char)0x7F;
464
tassert(msg->header(resip::h_To).displayName()==dispName);
465
tassert(!(msg->header(resip::h_To).isAllContacts()));
467
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
468
tassert(msg->header(resip::h_To).uri().user()=="1_unusual.URI~(to-be!sure)&isn't+it$/crazy?,/;;*");
469
tassert(msg->header(resip::h_To).uri().password().empty());
470
tassert(msg->header(resip::h_To).uri().host()=="example.com");
471
tassert(msg->header(resip::h_To).uri().port()==0);
472
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
473
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
474
tassert(msg->header(resip::h_To).uri().numUnknownParams()==0);
477
tassert(msg->exists(resip::h_From));
478
tassert(msg->header(resip::h_From).numKnownParams()==1);
479
tassert(msg->header(resip::h_From).numUnknownParams()==1);
480
tassert(msg->header(resip::h_From).exists(resip::p_tag));
481
tassert(msg->header(resip::h_From).param(resip::p_tag)=="_token~1'+`*%!-.");
483
resip::ExtensionParameter p_oddball("fromParam''~+*_!.-%");
484
tassert(msg->header(resip::h_From).exists(p_oddball));
485
resip::Data binaryParamVal;
486
binaryParamVal+=(char)0xD1;
487
binaryParamVal+=(char)0x80;
488
binaryParamVal+=(char)0xD0;
489
binaryParamVal+=(char)0xB0;
490
binaryParamVal+=(char)0xD0;
491
binaryParamVal+=(char)0xB1;
492
binaryParamVal+=(char)0xD0;
493
binaryParamVal+=(char)0xBE;
494
binaryParamVal+=(char)0xD1;
495
binaryParamVal+=(char)0x82;
496
binaryParamVal+=(char)0xD0;
497
binaryParamVal+=(char)0xB0;
498
binaryParamVal+=(char)0xD1;
499
binaryParamVal+=(char)0x8E;
500
binaryParamVal+=(char)0xD1;
501
binaryParamVal+=(char)0x89;
502
binaryParamVal+=(char)0xD0;
503
binaryParamVal+=(char)0xB8;
504
binaryParamVal+=(char)0xD0;
505
binaryParamVal+=(char)0xB9;
506
tassert(msg->header(resip::h_From).param(p_oddball)==binaryParamVal);
507
tassert(msg->header(resip::h_From).displayName()=="token1~` token2'+_ token3*%!.-");
508
tassert(!(msg->header(resip::h_From).isAllContacts()));
510
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
511
tassert(msg->header(resip::h_From).uri().user()=="mundane");
512
tassert(msg->header(resip::h_From).uri().password().empty());
513
tassert(msg->header(resip::h_From).uri().host()=="example.com");
514
tassert(msg->header(resip::h_From).uri().port()==0);
515
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
516
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
517
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
521
tassert(msg->exists(resip::h_MaxForwards));
522
tassert(msg->header(resip::h_MaxForwards).value()==255);
523
tassert(msg->header(resip::h_MaxForwards).numKnownParams()==0);
524
tassert(msg->header(resip::h_MaxForwards).numUnknownParams()==0);
527
tassert(msg->exists(resip::h_CallID));
528
tassert(msg->header(resip::h_CallID).value()=="intmeth.word%ZK-!.*_+'@word`~)(><:\\/\"][?}{");
529
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
530
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
533
tassert(msg->exists(resip::h_ContentLength));
534
tassert(msg->header(resip::h_ContentLength).value()==0);
535
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
536
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
539
tassert(msg->exists(resip::h_CSeq));
540
tassert(msg->header(resip::h_CSeq).method()==resip::UNKNOWN);
541
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="!interesting-Method0123456789_*+`.%indeed'~");
542
tassert(msg->header(resip::h_CSeq).sequence()==139122385);
543
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
544
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
547
tassert(msg->exists(resip::h_Vias));
548
tassert(msg->header(resip::h_Vias).size()==1);
549
resip::ParserContainer<resip::Via>::iterator i=msg->header(resip::h_Vias).begin();
551
tassert(i->protocolName()=="SIP");
552
tassert(i->protocolVersion()=="2.0");
553
tassert(i->transport()=="TCP");
554
tassert(i->sentHost()=="host1.example.com");
555
tassert(i->sentPort()==0);
557
tassert(i->numKnownParams()==1);
558
tassert(i->numUnknownParams()==0);
559
tassert(i->exists(resip::p_branch));
560
tassert(i->param(resip::p_branch).hasMagicCookie());
561
tassert(i->param(resip::p_branch).getTransactionId()=="-.!%66*_+`'~");
562
tassert(i->param(resip::p_branch).clientData().empty());
567
resip::ExtensionHeader h_extensionHeader("extensionHeader-!.%*+_`'~");
569
tassert(msg->exists(h_extensionHeader));
570
tassert(msg->header(h_extensionHeader).size()==1);
571
resip::Data binaryHfv;
572
binaryHfv+=(char)0xEF;
573
binaryHfv+=(char)0xBB;
574
binaryHfv+=(char)0xBF;
575
binaryHfv+=(char)0xE5;
576
binaryHfv+=(char)0xA4;
577
binaryHfv+=(char)0xA7;
578
binaryHfv+=(char)0xE5;
579
binaryHfv+=(char)0x81;
580
binaryHfv+=(char)0x9C;
581
binaryHfv+=(char)0xE9;
582
binaryHfv+=(char)0x9B;
583
binaryHfv+=(char)0xBB;
584
tassert(msg->header(h_extensionHeader).begin()->value()==binaryHfv);
585
tassert(msg->header(h_extensionHeader).begin()->numKnownParams()==0);
586
tassert(msg->header(h_extensionHeader).begin()->numUnknownParams()==0);
589
InfoLog(<< "In case intmeth:" );
590
InfoLog(<< "Original text:" << std::endl << txt );
591
InfoLog(<< "Encoded form:" << std::endl << encoded );
592
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
604
This INVITE exercises the % HEX HEX escaping mechanism in several
605
places. The request is syntactically valid. Interesting features
606
include the following:
608
o The request-URI has sips:user@example.com embedded in its
609
userpart. What that might mean to example.net is beyond the scope
612
o The From and To URIs have escaped characters in their userparts.
614
o The Contact URI has escaped characters in the URI parameters.
615
Note that the "name" uri-parameter has a value of "value%41",
616
which is NOT equivalent to "valueA". Per [RFC3986], unescaping
617
URI components is never performed recursively.
619
A parser must accept this as a well-formed message. The application
620
using the message must treat the % HEX HEX expansions as equivalent
621
to the character being encoded. The application must not try to
622
interpret % as an escape character in those places where % HEX HEX
623
("escaped" in the grammar) is not a valid part of the construction.
624
In [RFC3261], "escaped" only occurs in the expansions of SIP-URI,
625
SIPS-URI, and Reason-Phrase.
628
INVITE sip:sips%3Auser%40example.com@example.net SIP/2.0
629
To: sip:%75se%72@example.com
630
From: <sip:I%20have%20spaces@example.net>;tag=938
632
i: esc01.239409asdfakjkn23onasd0-3234
634
Via: SIP/2.0/UDP host5.example.net;branch=z9hG4bKkdjuw
637
<sip:cal%6Cer@host5.example.net;%6C%72;n%61me=v%61lue%25%34%31>
641
o=mhandley 29739 7272939 IN IP4 192.0.2.1
645
m=audio 49217 RTP/AVP 0 12
646
m=video 3227 RTP/AVP 31
650
FILE* fid= fopen("esc01.dat","r");
657
result = fread(&mBuf,1,1024,fid);
658
txt += resip::Data(mBuf,result);
661
resip::SipMessage* msg = resip::SipMessage::make(txt);
670
std::auto_ptr<resip::SipMessage> message(msg);
671
msg->parseAllHeaders();
673
resip::SipMessage copy(*msg);
677
resip::oDataStream str(encoded);
680
resip::Data copyEncoded;
682
resip::oDataStream str(copyEncoded);
687
tassert(msg->header(resip::h_RequestLine).method()==resip::INVITE);
688
tassert(msg->header(resip::h_RequestLine).unknownMethodName()=="INVITE");
689
tassert(msg->header(resip::h_RequestLine).uri().scheme()=="sip");
690
// ?bwc? Is it appropriate to use a one-size-fits-all approach to unescaping
691
// parsed components? ('@' is not legal in a userpart, but the internal
692
// representation contains it)
693
// What is the best approach: all (unescape everything that is printable),
694
// none (leave escaping exactly as found), or context sensitive (escape
695
// everything that is legal for a given field)?
696
tassert(msg->header(resip::h_RequestLine).uri().user()=="sips%3Auser%40example.com");
698
tassert(msg->header(resip::h_RequestLine).uri().password().empty());
699
tassert(msg->header(resip::h_RequestLine).uri().host()=="example.net");
700
tassert(msg->header(resip::h_RequestLine).uri().port()==0);
701
tassert(msg->header(resip::h_RequestLine).uri().numKnownParams()==0);
702
tassert(msg->header(resip::h_RequestLine).uri().numUnknownParams()==0);
703
tassert(!(msg->header(resip::h_RequestLine).uri().hasEmbedded()));
704
tassert(msg->header(resip::h_RequestLine).getSipVersion()=="SIP/2.0");
707
tassert(msg->exists(resip::h_To));
708
tassert(msg->header(resip::h_To).displayName().empty());
709
tassert(!(msg->header(resip::h_To).isAllContacts()));
710
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
711
tassert(msg->header(resip::h_To).uri().user()=="user");
712
tassert(msg->header(resip::h_To).uri().password().empty());
713
tassert(msg->header(resip::h_To).uri().host()=="example.com");
714
tassert(msg->header(resip::h_To).uri().port()==0);
715
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
716
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
717
tassert(msg->header(resip::h_To).uri().numUnknownParams()==0);
718
tassert(msg->header(resip::h_To).numKnownParams()==0);
719
tassert(msg->header(resip::h_To).numUnknownParams()==0);
722
tassert(msg->exists(resip::h_From));
723
tassert(msg->header(resip::h_From).displayName().empty());
724
tassert(!(msg->header(resip::h_From).isAllContacts()));
725
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
726
// ?bwc? ' ' is not legal in a userpart, but the internal
727
// representation contains it. Is this appropriate?
728
tassert(msg->header(resip::h_From).uri().user()=="I%20have%20spaces");
730
tassert(msg->header(resip::h_From).uri().password().empty());
731
tassert(msg->header(resip::h_From).uri().host()=="example.net");
732
tassert(msg->header(resip::h_From).uri().port()==0);
733
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
734
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
735
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
736
tassert(msg->header(resip::h_From).numKnownParams()==1);
737
tassert(msg->header(resip::h_From).numUnknownParams()==0);
738
tassert(msg->header(resip::h_From).exists(resip::p_tag));
739
tassert(msg->header(resip::h_From).param(resip::p_tag)=="938");
742
tassert(msg->exists(resip::h_MaxForwards));
743
tassert(msg->header(resip::h_MaxForwards).value()==87);
744
tassert(msg->header(resip::h_MaxForwards).numKnownParams()==0);
745
tassert(msg->header(resip::h_MaxForwards).numUnknownParams()==0);
748
tassert(msg->exists(resip::h_CallID));
749
tassert(msg->header(resip::h_CallID).value()=="esc01.239409asdfakjkn23onasd0-3234");
750
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
751
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
754
tassert(msg->exists(resip::h_ContentLength));
755
tassert(msg->header(resip::h_ContentLength).value()==150);
756
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
757
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
760
tassert(msg->exists(resip::h_CSeq));
761
tassert(msg->header(resip::h_CSeq).method()==resip::INVITE);
762
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="INVITE");
763
tassert(msg->header(resip::h_CSeq).sequence()==234234);
764
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
765
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
768
tassert(msg->exists(resip::h_Vias));
769
tassert(msg->header(resip::h_Vias).size()==1);
770
resip::ParserContainer<resip::Via>::iterator i=msg->header(resip::h_Vias).begin();
772
tassert(i->protocolName()=="SIP");
773
tassert(i->protocolVersion()=="2.0");
774
tassert(i->transport()=="UDP");
775
tassert(i->sentHost()=="host5.example.net");
776
tassert(i->sentPort()==0);
778
tassert(i->numKnownParams()==1);
779
tassert(i->numUnknownParams()==0);
781
tassert(i->exists(resip::p_branch));
782
tassert(i->param(resip::p_branch).hasMagicCookie());
783
tassert(i->param(resip::p_branch).getTransactionId()=="kdjuw");
784
tassert(i->param(resip::p_branch).clientData().empty());
789
tassert(msg->exists(resip::h_ContentType));
790
tassert(msg->header(resip::h_ContentType).type()=="application");
791
tassert(msg->header(resip::h_ContentType).subType()=="sdp");
792
tassert(msg->header(resip::h_ContentType).numKnownParams()==0);
793
tassert(msg->header(resip::h_ContentType).numUnknownParams()==0);
796
tassert(msg->exists(resip::h_Contacts));
797
tassert(msg->header(resip::h_Contacts).size()==1);
798
tassert(msg->header(resip::h_Contacts).begin()->displayName().empty());
799
tassert(!(msg->header(resip::h_Contacts).begin()->isAllContacts()));
800
tassert(msg->header(resip::h_Contacts).begin()->uri().scheme()=="sip");
801
tassert(msg->header(resip::h_Contacts).begin()->uri().user()=="caller");
802
tassert(msg->header(resip::h_Contacts).begin()->uri().password().empty());
803
tassert(msg->header(resip::h_Contacts).begin()->uri().host()=="host5.example.net");
804
tassert(msg->header(resip::h_Contacts).begin()->uri().port()==0);
805
tassert(!(msg->header(resip::h_Contacts).begin()->uri().hasEmbedded()));
807
tassert(msg->header(resip::h_Contacts).begin()->uri().numKnownParams()==0);
808
tassert(msg->header(resip::h_Contacts).begin()->uri().numUnknownParams()==2);
810
// ?bwc? These params have escaped stuff in them; is it mandatory that we
811
// treat escaped and unescaped versions of the same parameter as identical?
813
resip::ExtensionParameter p_wonky1("%6C%72");
814
resip::ExtensionParameter p_wonky2("n%61me");
815
tassert(msg->header(resip::h_Contacts).begin()->uri().exists(p_wonky1));
816
tassert(msg->header(resip::h_Contacts).begin()->uri().param(p_wonky1)=="");
817
tassert(msg->header(resip::h_Contacts).begin()->uri().exists(p_wonky2));
818
tassert(msg->header(resip::h_Contacts).begin()->uri().param(p_wonky2)=="v%61lue%25%34%31");
821
tassert(msg->header(resip::h_Contacts).begin()->numKnownParams()==0);
822
tassert(msg->header(resip::h_Contacts).begin()->numUnknownParams()==0);
826
InfoLog(<< "In case esc01:" );
827
InfoLog(<< "Original text:" << std::endl << txt );
828
InfoLog(<< "Encoded form:" << std::endl << encoded );
829
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
841
This register request contains several URIs with nulls in the
842
userpart. The message is well formed - parsers must accept this
843
message. Implementations must take special care when unescaping the
844
Address-of-Record (AOR) in this request so as to not prematurely
845
shorten the username. This request registers two distinct contact
848
REGISTER sip:example.com SIP/2.0
849
To: sip:null-%00-null@example.com
850
From: sip:null-%00-null@example.com;tag=839923423
852
Call-ID: escnull.39203ndfvkjdasfkq3w4otrq0adsfdfnavd
853
CSeq: 14398234 REGISTER
854
Via: SIP/2.0/UDP host5.example.com;branch=z9hG4bKkdjuw
855
Contact: <sip:%00@host5.example.com>
856
Contact: <sip:%00%00@host5.example.com>
861
FILE* fid= fopen("escnull.dat","r");
868
result = fread(&mBuf,1,1024,fid);
869
txt += resip::Data(mBuf,result);
872
resip::SipMessage* msg = resip::SipMessage::make(txt);
881
std::auto_ptr<resip::SipMessage> message(msg);
882
msg->parseAllHeaders();
884
resip::SipMessage copy(*msg);
888
resip::oDataStream str(encoded);
891
resip::Data copyEncoded;
893
resip::oDataStream str(copyEncoded);
898
//REGISTER sip:example.com SIP/2.0
899
tassert(msg->header(resip::h_RequestLine).method()==resip::REGISTER);
900
tassert(msg->header(resip::h_RequestLine).unknownMethodName()=="REGISTER");
901
tassert(msg->header(resip::h_RequestLine).uri().scheme()=="sip");
902
tassert(msg->header(resip::h_RequestLine).uri().user()=="");
903
tassert(msg->header(resip::h_RequestLine).uri().password().empty());
904
tassert(msg->header(resip::h_RequestLine).uri().host()=="example.com");
905
tassert(msg->header(resip::h_RequestLine).uri().port()==0);
906
tassert(!(msg->header(resip::h_RequestLine).uri().hasEmbedded()));
907
tassert(msg->header(resip::h_RequestLine).uri().numKnownParams()==0);
908
tassert(msg->header(resip::h_RequestLine).uri().numUnknownParams()==0);
909
tassert(msg->header(resip::h_RequestLine).getSipVersion()=="SIP/2.0");
911
//To: sip:null-%00-null@example.com
912
tassert(msg->exists(resip::h_To));
913
tassert(msg->header(resip::h_To).displayName().empty());
914
tassert(msg->header(resip::h_To).numKnownParams()==0);
915
tassert(msg->header(resip::h_To).numUnknownParams()==0);
916
tassert(!(msg->header(resip::h_To).isAllContacts()));
917
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
918
tassert(msg->header(resip::h_To).uri().user()=="null-%00-null");
919
tassert(msg->header(resip::h_To).uri().password().empty());
920
tassert(msg->header(resip::h_To).uri().host()=="example.com");
921
tassert(msg->header(resip::h_To).uri().port()==0);
922
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
923
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
924
tassert(msg->header(resip::h_To).uri().numUnknownParams()==0);
926
//From: sip:null-%00-null@example.com;tag=839923423
927
tassert(msg->exists(resip::h_From));
928
tassert(msg->header(resip::h_From).displayName()=="");
929
tassert(msg->header(resip::h_From).numKnownParams()==1);
930
tassert(msg->header(resip::h_From).numUnknownParams()==0);
931
tassert(msg->header(resip::h_From).exists(resip::p_tag));
932
tassert(msg->header(resip::h_From).param(resip::p_tag)=="839923423");
933
tassert(!(msg->header(resip::h_From).isAllContacts()));
934
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
935
tassert(msg->header(resip::h_From).uri().user()=="null-%00-null");
936
tassert(msg->header(resip::h_From).uri().password().empty());
937
tassert(msg->header(resip::h_From).uri().host()=="example.com");
938
tassert(msg->header(resip::h_From).uri().port()==0);
939
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
940
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
941
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
944
tassert(msg->exists(resip::h_MaxForwards));
945
tassert(msg->header(resip::h_MaxForwards).value()==70);
946
tassert(msg->header(resip::h_MaxForwards).numKnownParams()==0);
947
tassert(msg->header(resip::h_MaxForwards).numUnknownParams()==0);
950
//Call-ID: escnull.39203ndfvkjdasfkq3w4otrq0adsfdfnavd
951
tassert(msg->exists(resip::h_CallID));
952
tassert(msg->header(resip::h_CallID).value()=="escnull.39203ndfvkjdasfkq3w4otrq0adsfdfnavd");
953
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
954
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
956
//CSeq: 14398234 REGISTER
957
tassert(msg->exists(resip::h_CSeq));
958
tassert(msg->header(resip::h_CSeq).method()==resip::REGISTER);
959
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="REGISTER");
960
tassert(msg->header(resip::h_CSeq).sequence()==14398234);
961
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
962
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
964
//Via: SIP/2.0/UDP host5.example.com;branch=z9hG4bKkdjuw
965
tassert(msg->exists(resip::h_Vias));
966
tassert(msg->header(resip::h_Vias).size()==1);
967
resip::ParserContainer<resip::Via>::iterator i=msg->header(resip::h_Vias).begin();
969
tassert(i->numKnownParams()==1);
970
tassert(i->numUnknownParams()==0);
971
tassert(i->protocolName()=="SIP");
972
tassert(i->protocolVersion()=="2.0");
973
tassert(i->transport()=="UDP");
974
tassert(i->sentHost()=="host5.example.com");
975
tassert(i->sentPort()==0);
977
tassert(i->exists(resip::p_branch));
978
tassert(i->param(resip::p_branch).hasMagicCookie());
979
tassert(i->param(resip::p_branch).getTransactionId()=="kdjuw");
980
tassert(i->param(resip::p_branch).clientData().empty());
982
//Contact: <sip:%00@host5.example.com>
983
//Contact: <sip:%00%00@host5.example.com>
984
tassert(msg->exists(resip::h_Contacts));
985
tassert(msg->header(resip::h_Contacts).size()==2);
986
resip::ParserContainer<resip::NameAddr>::iterator j=msg->header(resip::h_Contacts).begin();
988
tassert(j->displayName()=="");
989
tassert(j->numKnownParams()==0);
990
tassert(j->numUnknownParams()==0);
991
tassert(!(j->isAllContacts()));
992
tassert(j->uri().numKnownParams()==0);
993
tassert(j->uri().numUnknownParams()==0);
994
tassert(j->uri().scheme()=="sip");
995
tassert(j->uri().user()=="%00");
996
tassert(j->uri().password().empty());
997
tassert(j->uri().host()=="host5.example.com");
998
tassert(j->uri().port()==0);
999
tassert(!(j->uri().hasEmbedded()));
1003
tassert(j->displayName()=="");
1004
tassert(j->numKnownParams()==0);
1005
tassert(j->numUnknownParams()==0);
1006
tassert(!(j->isAllContacts()));
1007
tassert(j->uri().numKnownParams()==0);
1008
tassert(j->uri().numUnknownParams()==0);
1009
tassert(j->uri().scheme()=="sip");
1010
tassert(j->uri().user()=="%00%00");
1011
tassert(j->uri().password().empty());
1012
tassert(j->uri().host()=="host5.example.com");
1013
tassert(j->uri().port()==0);
1014
tassert(!(j->uri().hasEmbedded()));
1017
tassert(msg->exists(resip::h_ContentLength));
1018
tassert(msg->header(resip::h_ContentLength).value()==0);
1019
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
1020
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
1025
InfoLog(<< "In case escnull:" );
1026
InfoLog(<< "Original text:" << std::endl << txt );
1027
InfoLog(<< "Encoded form:" << std::endl << encoded );
1028
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
1040
In most of the places % can appear in a SIP message, it is not an
1041
escape character. This can surprise the unwary implementor. The
1042
following well-formed request has these properties:
1044
o The request method is unknown. It is NOT equivalent to REGISTER.
1046
o The display name portion of the To and From header fields is
1047
"%Z%45". Note that this is not the same as %ZE.
1049
o This message has two Contact header field values, not three.
1050
<sip:alias2@host2.example.com> is a C%6Fntact header field value.
1052
A parser should accept this message as well formed. A proxy would
1053
forward or reject the message depending on what the Request-URI meant
1054
to it. An endpoint would reject this message with a 501.
1057
RE%47IST%45R sip:registrar.example.com SIP/2.0
1058
To: "%Z%45" <sip:resource@example.com>
1059
From: "%Z%45" <sip:resource@example.com>;tag=f232jadfj23
1060
Call-ID: esc02.asdfnqwo34rq23i34jrjasdcnl23nrlknsdf
1061
Via: SIP/2.0/TCP host.example.com;branch=z9hG4bK209%fzsnel234
1062
CSeq: 29344 RE%47IST%45R
1064
Contact: <sip:alias1@host1.example.com>
1065
C%6Fntact: <sip:alias2@host2.example.com>
1066
Contact: <sip:alias3@host3.example.com>
1071
FILE* fid= fopen("esc02.dat","r");
1078
result = fread(&mBuf,1,1024,fid);
1079
txt += resip::Data(mBuf,result);
1082
resip::SipMessage* msg = resip::SipMessage::make(txt);
1091
std::auto_ptr<resip::SipMessage> message(msg);
1092
msg->parseAllHeaders();
1094
resip::SipMessage copy(*msg);
1096
resip::Data encoded;
1098
resip::oDataStream str(encoded);
1101
resip::Data copyEncoded;
1103
resip::oDataStream str(copyEncoded);
1107
//RE%47IST%45R sip:registrar.example.com SIP/2.0
1108
tassert(msg->header(resip::h_RequestLine).method()==resip::UNKNOWN);
1109
tassert(msg->header(resip::h_RequestLine).unknownMethodName()=="RE%47IST%45R");
1110
tassert(msg->header(resip::h_RequestLine).uri().scheme()=="sip");
1111
tassert(msg->header(resip::h_RequestLine).uri().user()=="");
1112
tassert(msg->header(resip::h_RequestLine).uri().password().empty());
1113
tassert(msg->header(resip::h_RequestLine).uri().host()=="registrar.example.com");
1114
tassert(msg->header(resip::h_RequestLine).uri().port()==0);
1115
tassert(!(msg->header(resip::h_RequestLine).uri().hasEmbedded()));
1116
tassert(msg->header(resip::h_RequestLine).uri().numKnownParams()==0);
1117
tassert(msg->header(resip::h_RequestLine).uri().numUnknownParams()==0);
1118
tassert(msg->header(resip::h_RequestLine).getSipVersion()=="SIP/2.0");
1120
//To: "%Z%45" <sip:resource@example.com>
1121
tassert(msg->exists(resip::h_To));
1122
tassert(msg->header(resip::h_To).displayName()=="%Z%45");
1123
tassert(msg->header(resip::h_To).numKnownParams()==0);
1124
tassert(msg->header(resip::h_To).numUnknownParams()==0);
1125
tassert(!(msg->header(resip::h_To).isAllContacts()));
1126
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
1127
tassert(msg->header(resip::h_To).uri().user()=="resource");
1128
tassert(msg->header(resip::h_To).uri().password().empty());
1129
tassert(msg->header(resip::h_To).uri().host()=="example.com");
1130
tassert(msg->header(resip::h_To).uri().port()==0);
1131
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
1132
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
1133
tassert(msg->header(resip::h_To).uri().numUnknownParams()==0);
1135
//From: "%Z%45" <sip:resource@example.com>;tag=f232jadfj23
1136
tassert(msg->exists(resip::h_From));
1137
tassert(msg->header(resip::h_From).displayName()=="%Z%45");
1138
tassert(msg->header(resip::h_From).numKnownParams()==1);
1139
tassert(msg->header(resip::h_From).numUnknownParams()==0);
1140
tassert(msg->header(resip::h_From).exists(resip::p_tag));
1141
tassert(msg->header(resip::h_From).param(resip::p_tag)=="f232jadfj23");
1142
tassert(!(msg->header(resip::h_From).isAllContacts()));
1143
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
1144
tassert(msg->header(resip::h_From).uri().user()=="resource");
1145
tassert(msg->header(resip::h_From).uri().password().empty());
1146
tassert(msg->header(resip::h_From).uri().host()=="example.com");
1147
tassert(msg->header(resip::h_From).uri().port()==0);
1148
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
1149
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
1150
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
1152
//Call-ID: esc02.asdfnqwo34rq23i34jrjasdcnl23nrlknsdf
1153
tassert(msg->exists(resip::h_CallID));
1154
tassert(msg->header(resip::h_CallID).value()=="esc02.asdfnqwo34rq23i34jrjasdcnl23nrlknsdf");
1155
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
1156
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
1158
//Via: SIP/2.0/TCP host.example.com;branch=z9hG4bK209%fzsnel234
1159
tassert(msg->exists(resip::h_Vias));
1160
tassert(msg->header(resip::h_Vias).size()==1);
1161
resip::ParserContainer<resip::Via>::iterator i=msg->header(resip::h_Vias).begin();
1163
tassert(i->numKnownParams()==1);
1164
tassert(i->numUnknownParams()==0);
1165
tassert(i->protocolName()=="SIP");
1166
tassert(i->protocolVersion()=="2.0");
1167
tassert(i->transport()=="TCP");
1168
tassert(i->sentHost()=="host.example.com");
1169
tassert(i->sentPort()==0);
1171
tassert(i->exists(resip::p_branch));
1172
tassert(i->param(resip::p_branch).hasMagicCookie());
1173
tassert(i->param(resip::p_branch).getTransactionId()=="209%fzsnel234");
1174
tassert(i->param(resip::p_branch).clientData().empty());
1176
//CSeq: 29344 RE%47IST%45R
1177
tassert(msg->exists(resip::h_CSeq));
1178
tassert(msg->header(resip::h_CSeq).method()==resip::UNKNOWN);
1179
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="RE%47IST%45R");
1180
tassert(msg->header(resip::h_CSeq).sequence()==29344);
1181
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
1182
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
1185
tassert(msg->exists(resip::h_MaxForwards));
1186
tassert(msg->header(resip::h_MaxForwards).value()==70);
1187
tassert(msg->header(resip::h_MaxForwards).numKnownParams()==0);
1188
tassert(msg->header(resip::h_MaxForwards).numUnknownParams()==0);
1190
//Contact: <sip:alias1@host1.example.com>
1191
//Contact: <sip:alias3@host3.example.com>
1192
tassert(msg->exists(resip::h_Contacts));
1193
tassert(msg->header(resip::h_Contacts).size()==2);
1194
resip::ParserContainer<resip::NameAddr>::iterator j=msg->header(resip::h_Contacts).begin();
1196
tassert(j->displayName()=="");
1197
tassert(j->numKnownParams()==0);
1198
tassert(j->numUnknownParams()==0);
1199
tassert(!(j->isAllContacts()));
1200
tassert(j->uri().numKnownParams()==0);
1201
tassert(j->uri().numUnknownParams()==0);
1202
tassert(j->uri().scheme()=="sip");
1203
tassert(j->uri().user()=="alias1");
1204
tassert(j->uri().password().empty());
1205
tassert(j->uri().host()=="host1.example.com");
1206
tassert(j->uri().port()==0);
1207
tassert(!(j->uri().hasEmbedded()));
1211
tassert(j->displayName()=="");
1212
tassert(j->numKnownParams()==0);
1213
tassert(j->numUnknownParams()==0);
1214
tassert(!(j->isAllContacts()));
1215
tassert(j->uri().numKnownParams()==0);
1216
tassert(j->uri().numUnknownParams()==0);
1217
tassert(j->uri().scheme()=="sip");
1218
tassert(j->uri().user()=="alias3");
1219
tassert(j->uri().password().empty());
1220
tassert(j->uri().host()=="host3.example.com");
1221
tassert(j->uri().port()==0);
1222
tassert(!(j->uri().hasEmbedded()));
1224
//C%6Fntact: <sip:alias2@host2.example.com>
1225
resip::ExtensionHeader p_fakeContact("C%6Fntact");
1226
tassert(msg->exists(p_fakeContact));
1227
tassert(msg->header(p_fakeContact).size()==1);
1228
tassert(msg->header(p_fakeContact).begin()->value()=="<sip:alias2@host2.example.com>");
1231
tassert(msg->exists(resip::h_ContentLength));
1232
tassert(msg->header(resip::h_ContentLength).value()==0);
1233
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
1234
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
1237
InfoLog(<< "In case esc02:" );
1238
InfoLog(<< "Original text:" << std::endl << txt );
1239
InfoLog(<< "Encoded form:" << std::endl << encoded );
1240
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
1252
This OPTIONS request is not valid per the grammar in RFC 3261 since
1253
there is no LWS between the token in the display name and < in the
1254
From header field value. This has been identified as a specification
1255
bug that will be removed when RFC 3261 is revised. Elements should
1256
accept this request as well formed.
1258
OPTIONS sip:user@example.com SIP/2.0
1259
To: sip:user@example.com
1260
From: caller<sip:caller@example.com>;tag=323
1262
Call-ID: lwsdisp.1234abcd@funky.example.com
1264
Via: SIP/2.0/UDP funky.example.com;branch=z9hG4bKkdjuw
1269
FILE* fid= fopen("lwsdisp.dat","r");
1276
result = fread(&mBuf,1,1024,fid);
1277
txt += resip::Data(mBuf,result);
1280
resip::SipMessage* msg = resip::SipMessage::make(txt);
1289
std::auto_ptr<resip::SipMessage> message(msg);
1290
msg->parseAllHeaders();
1292
resip::SipMessage copy(*msg);
1294
resip::Data encoded;
1296
resip::oDataStream str(encoded);
1299
resip::Data copyEncoded;
1301
resip::oDataStream str(copyEncoded);
1306
//OPTIONS sip:user@example.com SIP/2.0
1307
tassert(msg->header(resip::h_RequestLine).method()==resip::OPTIONS);
1308
tassert(msg->header(resip::h_RequestLine).unknownMethodName()=="OPTIONS");
1309
tassert(msg->header(resip::h_RequestLine).uri().scheme()=="sip");
1310
tassert(msg->header(resip::h_RequestLine).uri().user()=="user");
1311
tassert(msg->header(resip::h_RequestLine).uri().password().empty());
1312
tassert(msg->header(resip::h_RequestLine).uri().host()=="example.com");
1313
tassert(msg->header(resip::h_RequestLine).uri().port()==0);
1314
tassert(!(msg->header(resip::h_RequestLine).uri().hasEmbedded()));
1315
tassert(msg->header(resip::h_RequestLine).uri().numKnownParams()==0);
1316
tassert(msg->header(resip::h_RequestLine).uri().numUnknownParams()==0);
1317
tassert(msg->header(resip::h_RequestLine).getSipVersion()=="SIP/2.0");
1319
//To: sip:user@example.com
1320
tassert(msg->exists(resip::h_To));
1321
tassert(msg->header(resip::h_To).displayName()=="");
1322
tassert(msg->header(resip::h_To).numKnownParams()==0);
1323
tassert(msg->header(resip::h_To).numUnknownParams()==0);
1324
tassert(!(msg->header(resip::h_To).isAllContacts()));
1325
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
1326
tassert(msg->header(resip::h_To).uri().user()=="user");
1327
tassert(msg->header(resip::h_To).uri().password().empty());
1328
tassert(msg->header(resip::h_To).uri().host()=="example.com");
1329
tassert(msg->header(resip::h_To).uri().port()==0);
1330
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
1331
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
1332
tassert(msg->header(resip::h_To).uri().numUnknownParams()==0);
1334
//From: caller<sip:caller@example.com>;tag=323
1335
tassert(msg->exists(resip::h_From));
1336
tassert(msg->header(resip::h_From).displayName()=="caller");
1337
tassert(msg->header(resip::h_From).numKnownParams()==1);
1338
tassert(msg->header(resip::h_From).numUnknownParams()==0);
1339
tassert(msg->header(resip::h_From).exists(resip::p_tag));
1340
tassert(msg->header(resip::h_From).param(resip::p_tag)=="323");
1341
tassert(!(msg->header(resip::h_From).isAllContacts()));
1342
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
1343
tassert(msg->header(resip::h_From).uri().user()=="caller");
1344
tassert(msg->header(resip::h_From).uri().password().empty());
1345
tassert(msg->header(resip::h_From).uri().host()=="example.com");
1346
tassert(msg->header(resip::h_From).uri().port()==0);
1347
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
1348
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
1349
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
1352
tassert(msg->exists(resip::h_MaxForwards));
1353
tassert(msg->header(resip::h_MaxForwards).value()==70);
1354
tassert(msg->header(resip::h_MaxForwards).numKnownParams()==0);
1355
tassert(msg->header(resip::h_MaxForwards).numUnknownParams()==0);
1357
//Call-ID: lwsdisp.1234abcd@funky.example.com
1358
tassert(msg->exists(resip::h_CallID));
1359
tassert(msg->header(resip::h_CallID).value()=="lwsdisp.1234abcd@funky.example.com");
1360
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
1361
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
1364
tassert(msg->exists(resip::h_CSeq));
1365
tassert(msg->header(resip::h_CSeq).method()==resip::OPTIONS);
1366
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="OPTIONS");
1367
tassert(msg->header(resip::h_CSeq).sequence()==60);
1368
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
1369
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
1371
//Via: SIP/2.0/UDP funky.example.com;branch=z9hG4bKkdjuw
1372
tassert(msg->exists(resip::h_Vias));
1373
tassert(msg->header(resip::h_Vias).size()==1);
1374
resip::ParserContainer<resip::Via>::iterator i=msg->header(resip::h_Vias).begin();
1376
tassert(i->numKnownParams()==1);
1377
tassert(i->numUnknownParams()==0);
1378
tassert(i->protocolName()=="SIP");
1379
tassert(i->protocolVersion()=="2.0");
1380
tassert(i->transport()=="UDP");
1381
tassert(i->sentHost()=="funky.example.com");
1382
tassert(i->sentPort()==0);
1384
tassert(i->exists(resip::p_branch));
1385
tassert(i->param(resip::p_branch).hasMagicCookie());
1386
tassert(i->param(resip::p_branch).getTransactionId()=="kdjuw");
1387
tassert(i->param(resip::p_branch).clientData().empty());
1390
tassert(msg->exists(resip::h_ContentLength));
1391
tassert(msg->header(resip::h_ContentLength).value()==0);
1392
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
1393
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
1395
InfoLog(<< "In case lwsdisp:" );
1396
InfoLog(<< "Original text:" << std::endl << txt );
1397
InfoLog(<< "Encoded form:" << std::endl << encoded );
1398
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
1410
This well-formed request contains header fields with many values and
1411
values that are very long. Features include the following:
1413
o The To header field has a long display name, and long uri
1414
parameter names and values.
1416
o The From header field has long header parameter names and values,
1417
in particular, a very long tag.
1419
o The Call-ID is one long token.
1421
INVITE sip:user@example.com SIP/2.0
1422
To: "I have a user name of extremeextremeextremeextremeextremeextremeextremeextremeextremeextreme proportion"<sip:user@example.com:6000;unknownparam1=verylonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongvalue;longparamnamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamename=shortvalue;verylonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongParameterNameWithNoValue>
1423
F: sip:amazinglylongcallernameamazinglylongcallernameamazinglylongcallernameamazinglylongcallernameamazinglylongcallername@example.net;tag=12982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982424;unknownheaderparamnamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamename=unknowheaderparamvaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevalue;unknownValuelessparamnameparamnameparamnameparamnameparamnameparamnameparamnameparamnameparamnameparamname
1424
Call-ID: longreq.onereallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylongcallid
1425
CSeq: 3882340 INVITE
1426
Unknown-LongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLong-Name: unknown-longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong-value; unknown-longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong-parameter-name = unknown-longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong-parameter-value
1427
Via: SIP/2.0/TCP sip33.example.com
1428
v: SIP/2.0/TCP sip32.example.com
1429
V: SIP/2.0/TCP sip31.example.com
1430
Via: SIP/2.0/TCP sip30.example.com
1431
ViA: SIP/2.0/TCP sip29.example.com
1432
VIa: SIP/2.0/TCP sip28.example.com
1433
VIA: SIP/2.0/TCP sip27.example.com
1434
via: SIP/2.0/TCP sip26.example.com
1435
viA: SIP/2.0/TCP sip25.example.com
1436
vIa: SIP/2.0/TCP sip24.example.com
1437
vIA: SIP/2.0/TCP sip23.example.com
1438
V : SIP/2.0/TCP sip22.example.com
1439
v : SIP/2.0/TCP sip21.example.com
1440
V : SIP/2.0/TCP sip20.example.com
1441
v : SIP/2.0/TCP sip19.example.com
1442
Via : SIP/2.0/TCP sip18.example.com
1443
Via : SIP/2.0/TCP sip17.example.com
1444
Via: SIP/2.0/TCP sip16.example.com
1445
Via: SIP/2.0/TCP sip15.example.com
1446
Via: SIP/2.0/TCP sip14.example.com
1447
Via: SIP/2.0/TCP sip13.example.com
1448
Via: SIP/2.0/TCP sip12.example.com
1449
Via: SIP/2.0/TCP sip11.example.com
1450
Via: SIP/2.0/TCP sip10.example.com
1451
Via: SIP/2.0/TCP sip9.example.com
1452
Via: SIP/2.0/TCP sip8.example.com
1453
Via: SIP/2.0/TCP sip7.example.com
1454
Via: SIP/2.0/TCP sip6.example.com
1455
Via: SIP/2.0/TCP sip5.example.com
1456
Via: SIP/2.0/TCP sip4.example.com
1457
Via: SIP/2.0/TCP sip3.example.com
1458
Via: SIP/2.0/TCP sip2.example.com
1459
Via: SIP/2.0/TCP sip1.example.com
1460
Via: SIP/2.0/TCP host.example.com;received=192.0.2.5;branch=verylonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongbranchvalue
1462
Contact: <sip:amazinglylongcallernameamazinglylongcallernameamazinglylongcallernameamazinglylongcallernameamazinglylongcallername@host5.example.net>
1463
Content-Type: application/sdp
1467
o=mhandley 29739 7272939 IN IP4 192.0.2.1
1471
m=audio 49217 RTP/AVP 0 12
1472
m=video 3227 RTP/AVP 31
1476
FILE* fid= fopen("longreq.dat","r");
1483
result = fread(&mBuf,1,1024,fid);
1484
txt += resip::Data(mBuf,result);
1487
resip::SipMessage* msg = resip::SipMessage::make(txt);
1496
std::auto_ptr<resip::SipMessage> message(msg);
1497
msg->parseAllHeaders();
1499
resip::SipMessage copy(*msg);
1501
resip::Data encoded;
1503
resip::oDataStream str(encoded);
1506
resip::Data copyEncoded;
1508
resip::oDataStream str(copyEncoded);
1513
//INVITE sip:user@example.com SIP/2.0
1514
tassert(msg->header(resip::h_RequestLine).method()==resip::INVITE);
1515
tassert(msg->header(resip::h_RequestLine).unknownMethodName()=="INVITE");
1516
tassert(msg->header(resip::h_RequestLine).uri().scheme()=="sip");
1517
tassert(msg->header(resip::h_RequestLine).uri().user()=="user");
1518
tassert(msg->header(resip::h_RequestLine).uri().password().empty());
1519
tassert(msg->header(resip::h_RequestLine).uri().host()=="example.com");
1520
tassert(msg->header(resip::h_RequestLine).uri().port()==0);
1521
tassert(!(msg->header(resip::h_RequestLine).uri().hasEmbedded()));
1522
tassert(msg->header(resip::h_RequestLine).uri().numKnownParams()==0);
1523
tassert(msg->header(resip::h_RequestLine).uri().numUnknownParams()==0);
1524
tassert(msg->header(resip::h_RequestLine).getSipVersion()=="SIP/2.0");
1526
//To: "I have a user name of extremeextremeextremeextremeextremeextremeextremeextremeextremeextreme proportion"<sip:user@example.com:6000;unknownparam1=verylonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongvalue;longparamnamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamename=shortvalue;verylonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongParameterNameWithNoValue>
1527
tassert(msg->exists(resip::h_To));
1528
tassert(msg->header(resip::h_To).displayName()=="I have a user name of extremeextremeextremeextremeextremeextremeextremeextremeextremeextreme proportion");
1529
tassert(msg->header(resip::h_To).numKnownParams()==0);
1530
tassert(msg->header(resip::h_To).numUnknownParams()==0);
1531
tassert(!(msg->header(resip::h_To).isAllContacts()));
1532
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
1533
tassert(msg->header(resip::h_To).uri().user()=="user");
1534
tassert(msg->header(resip::h_To).uri().password().empty());
1535
tassert(msg->header(resip::h_To).uri().host()=="example.com");
1536
tassert(msg->header(resip::h_To).uri().port()==6000);
1537
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
1538
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
1539
tassert(msg->header(resip::h_To).uri().numUnknownParams()==3);
1541
resip::ExtensionParameter p_unknownparam1("unknownparam1");
1542
tassert(msg->header(resip::h_To).uri().exists(p_unknownparam1));
1543
tassert(msg->header(resip::h_To).uri().param(p_unknownparam1)=="verylonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongvalue");
1545
resip::ExtensionParameter p_long("longparamnamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamename");
1546
tassert(msg->header(resip::h_To).uri().exists(p_long));
1547
tassert(msg->header(resip::h_To).uri().param(p_long)=="shortvalue");
1549
resip::ExtensionParameter p_verylong("verylonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongParameterNameWithNoValue");
1550
tassert(msg->header(resip::h_To).uri().exists(p_verylong));
1551
tassert(msg->header(resip::h_To).uri().param(p_verylong)=="");
1553
//F: sip:amazinglylongcallernameamazinglylongcallernameamazinglylongcallernameamazinglylongcallernameamazinglylongcallername@example.net;tag=12982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982424;unknownheaderparamnamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamename=unknowheaderparamvaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevalue;unknownValuelessparamnameparamnameparamnameparamnameparamnameparamnameparamnameparamnameparamnameparamname
1554
tassert(msg->exists(resip::h_From));
1555
tassert(msg->header(resip::h_From).displayName()=="");
1556
tassert(msg->header(resip::h_From).numKnownParams()==1);
1557
tassert(msg->header(resip::h_From).numUnknownParams()==2);
1558
tassert(msg->header(resip::h_From).exists(resip::p_tag));
1559
tassert(msg->header(resip::h_From).param(resip::p_tag)=="12982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982982424");
1561
resip::ExtensionParameter p_unknownheaderparameternameXalot("unknownheaderparamnamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamenamename");
1562
tassert(msg->header(resip::h_From).exists(p_unknownheaderparameternameXalot));
1563
tassert(msg->header(resip::h_From).param(p_unknownheaderparameternameXalot)=="unknowheaderparamvaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevalue");
1565
resip::ExtensionParameter p_unknownvalueless("unknownValuelessparamnameparamnameparamnameparamnameparamnameparamnameparamnameparamnameparamnameparamname");
1566
tassert(msg->header(resip::h_From).exists(p_unknownvalueless));
1567
tassert(msg->header(resip::h_From).param(p_unknownvalueless)=="");
1569
tassert(!(msg->header(resip::h_From).isAllContacts()));
1570
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
1571
tassert(msg->header(resip::h_From).uri().user()=="amazinglylongcallernameamazinglylongcallernameamazinglylongcallernameamazinglylongcallernameamazinglylongcallername");
1572
tassert(msg->header(resip::h_From).uri().password().empty());
1573
tassert(msg->header(resip::h_From).uri().host()=="example.net");
1574
tassert(msg->header(resip::h_From).uri().port()==0);
1575
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
1576
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
1577
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
1579
//Call-ID: longreq.onereallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylongcallid
1580
tassert(msg->exists(resip::h_CallID));
1581
tassert(msg->header(resip::h_CallID).value()=="longreq.onereallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylongcallid");
1582
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
1583
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
1585
//CSeq: 3882340 INVITE
1586
tassert(msg->exists(resip::h_CSeq));
1587
tassert(msg->header(resip::h_CSeq).method()==resip::INVITE);
1588
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="INVITE");
1589
tassert(msg->header(resip::h_CSeq).sequence()==3882340);
1590
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
1591
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
1594
//Unknown-LongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLong-Name: unknown-longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong-value; unknown-longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong-parameter-name = unknown-longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong-parameter-value
1595
resip::ExtensionHeader h_UnknownLong("Unknown-LongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLong-Name");
1597
tassert(msg->exists(h_UnknownLong));
1598
tassert(msg->header(h_UnknownLong).size()==1);
1599
tassert(msg->header(h_UnknownLong).begin()->value()=="unknown-longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong-value; unknown-longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong-parameter-name = unknown-longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong-parameter-value");
1600
tassert(msg->header(h_UnknownLong).begin()->numKnownParams()==0);
1601
tassert(msg->header(h_UnknownLong).begin()->numUnknownParams()==0);
1605
//Via: SIP/2.0/TCP sip33.example.com
1606
//v: SIP/2.0/TCP sip32.example.com
1607
//V: SIP/2.0/TCP sip31.example.com
1608
//Via: SIP/2.0/TCP sip30.example.com
1609
//ViA: SIP/2.0/TCP sip29.example.com
1610
//VIa: SIP/2.0/TCP sip28.example.com
1611
//VIA: SIP/2.0/TCP sip27.example.com
1612
//via: SIP/2.0/TCP sip26.example.com
1613
//viA: SIP/2.0/TCP sip25.example.com
1614
//vIa: SIP/2.0/TCP sip24.example.com
1615
//vIA: SIP/2.0/TCP sip23.example.com
1616
//V : SIP/2.0/TCP sip22.example.com
1617
//v : SIP/2.0/TCP sip21.example.com
1618
//V : SIP/2.0/TCP sip20.example.com
1619
//v : SIP/2.0/TCP sip19.example.com
1620
//Via : SIP/2.0/TCP sip18.example.com
1621
//Via : SIP/2.0/TCP sip17.example.com
1622
//Via: SIP/2.0/TCP sip16.example.com
1623
//Via: SIP/2.0/TCP sip15.example.com
1624
//Via: SIP/2.0/TCP sip14.example.com
1625
//Via: SIP/2.0/TCP sip13.example.com
1626
//Via: SIP/2.0/TCP sip12.example.com
1627
//Via: SIP/2.0/TCP sip11.example.com
1628
//Via: SIP/2.0/TCP sip10.example.com
1629
//Via: SIP/2.0/TCP sip9.example.com
1630
//Via: SIP/2.0/TCP sip8.example.com
1631
//Via: SIP/2.0/TCP sip7.example.com
1632
//Via: SIP/2.0/TCP sip6.example.com
1633
//Via: SIP/2.0/TCP sip5.example.com
1634
//Via: SIP/2.0/TCP sip4.example.com
1635
//Via: SIP/2.0/TCP sip3.example.com
1636
//Via: SIP/2.0/TCP sip2.example.com
1637
//Via: SIP/2.0/TCP sip1.example.com
1638
//Via: SIP/2.0/TCP host.example.com;received=192.0.2.5;branch=verylonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongbranchvalue
1640
tassert(msg->exists(resip::h_Vias));
1641
tassert(msg->header(resip::h_Vias).size()==34);
1644
resip::Vias::iterator iter;
1645
for(iter=msg->header(resip::h_Vias).begin();
1646
iter!=msg->header(resip::h_Vias).end(); iter++)
1652
tassert(iter->numKnownParams()==0);
1653
tassert(iter->numUnknownParams()==0);
1654
tassert(iter->protocolName()=="SIP");
1655
tassert(iter->protocolVersion()=="2.0");
1656
tassert(iter->transport()=="TCP");
1657
tassert(iter->sentHost()==resip::Data("sip")+resip::Data(i)+resip::Data(".example.com"));
1658
tassert(iter->sentPort()==0);
1662
tassert(iter->numKnownParams()==2);
1663
tassert(iter->numUnknownParams()==0);
1664
tassert(iter->protocolName()=="SIP");
1665
tassert(iter->protocolVersion()=="2.0");
1666
tassert(iter->transport()=="TCP");
1667
tassert(iter->sentHost()=="host.example.com");
1668
tassert(iter->sentPort()==0);
1670
tassert(iter->exists(resip::p_branch));
1671
tassert(!(iter->param(resip::p_branch).hasMagicCookie()));
1672
tassert(iter->param(resip::p_branch).getTransactionId()=="verylonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongbranchvalue");
1673
tassert(iter->param(resip::p_branch).clientData().empty());
1675
tassert(iter->exists(resip::p_received));
1676
tassert(iter->param(resip::p_received)=="192.0.2.5");
1679
tassert(msg->exists(resip::h_MaxForwards));
1680
tassert(msg->header(resip::h_MaxForwards).value()==70);
1681
tassert(msg->header(resip::h_MaxForwards).numKnownParams()==0);
1682
tassert(msg->header(resip::h_MaxForwards).numUnknownParams()==0);
1684
//Contact: <sip:amazinglylongcallernameamazinglylongcallernameamazinglylongcallernameamazinglylongcallernameamazinglylongcallername@host5.example.net>
1685
tassert(msg->exists(resip::h_Contacts));
1686
tassert(msg->header(resip::h_Contacts).size()==1);
1687
resip::ParserContainer<resip::NameAddr>::iterator j=msg->header(resip::h_Contacts).begin();
1689
tassert(j->displayName()=="");
1690
tassert(j->numKnownParams()==0);
1691
tassert(j->numUnknownParams()==0);
1692
tassert(!(j->isAllContacts()));
1693
tassert(j->uri().numKnownParams()==0);
1694
tassert(j->uri().numUnknownParams()==0);
1695
tassert(j->uri().scheme()=="sip");
1696
tassert(j->uri().user()=="amazinglylongcallernameamazinglylongcallernameamazinglylongcallernameamazinglylongcallernameamazinglylongcallername");
1697
tassert(j->uri().password().empty());
1698
tassert(j->uri().host()=="host5.example.net");
1699
tassert(j->uri().port()==0);
1700
tassert(!(j->uri().hasEmbedded()));
1702
//Content-Type: application/sdp
1703
tassert(msg->exists(resip::h_ContentType));
1704
tassert(msg->header(resip::h_ContentType).type()=="application");
1705
tassert(msg->header(resip::h_ContentType).subType()=="sdp");
1706
tassert(msg->header(resip::h_ContentType).numKnownParams()==0);
1707
tassert(msg->header(resip::h_ContentType).numUnknownParams()==0);
1710
tassert(msg->exists(resip::h_ContentLength));
1711
tassert(msg->header(resip::h_ContentLength).value()==150);
1712
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
1713
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
1715
InfoLog(<< "In case longreq:" );
1716
InfoLog(<< "Original text:" << std::endl << txt );
1717
InfoLog(<< "Encoded form:" << std::endl << encoded );
1718
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
1730
This message contains a single SIP REGISTER request, which ostensibly
1731
arrived over UDP in a single datagram. The packet contains extra
1732
octets after the body (which in this case has zero length). The
1733
extra octets happen to look like a SIP INVITE request, but (per
1734
section 18.3 of [RFC3261]) they are just spurious noise that must be
1737
A SIP element receiving this datagram would handle the REGISTER
1738
request normally and ignore the extra bits that look like an INVITE
1739
request. If the element is a proxy choosing to forward the REGISTER,
1740
the INVITE octets would not appear in the forwarded request.
1744
REGISTER sip:example.com SIP/2.0
1745
To: sip:j.user@example.com
1746
From: sip:j.user@example.com;tag=43251j3j324
1748
I: dblreq.0ha0isndaksdj99sdfafnl3lk233412
1749
Contact: sip:j.user@host.example.com
1751
Via: SIP/2.0/UDP 192.0.2.125;branch=z9hG4bKkdjuw23492
1755
INVITE sip:joe@example.com SIP/2.0
1756
t: sip:joe@example.com
1757
From: sip:caller@example.net;tag=141334
1759
Call-ID: dblreq.0ha0isnda977644900765@192.0.2.15
1761
Via: SIP/2.0/UDP 192.0.2.15;branch=z9hG4bKkdjuw380234
1762
Content-Type: application/sdp
1766
o=mhandley 29739 7272939 IN IP4 192.0.2.15
1770
m=audio 49217 RTP/AVP 0 12
1771
m =video 3227 RTP/AVP 31
1776
FILE* fid= fopen("dblreq.dat","r");
1783
result = fread(&mBuf,1,1024,fid);
1784
txt += resip::Data(mBuf,result);
1787
resip::SipMessage* msg = resip::SipMessage::make(txt);
1796
std::auto_ptr<resip::SipMessage> message(msg);
1797
msg->parseAllHeaders();
1799
resip::SipMessage copy(*msg);
1801
resip::Data encoded;
1803
resip::oDataStream str(encoded);
1806
resip::Data copyEncoded;
1808
resip::oDataStream str(copyEncoded);
1813
//REGISTER sip:example.com SIP/2.0
1814
tassert(msg->header(resip::h_RequestLine).method()==resip::REGISTER);
1815
tassert(msg->header(resip::h_RequestLine).unknownMethodName()=="REGISTER");
1816
tassert(msg->header(resip::h_RequestLine).uri().scheme()=="sip");
1817
tassert(msg->header(resip::h_RequestLine).uri().user()=="");
1818
tassert(msg->header(resip::h_RequestLine).uri().password().empty());
1819
tassert(msg->header(resip::h_RequestLine).uri().host()=="example.com");
1820
tassert(msg->header(resip::h_RequestLine).uri().port()==0);
1821
tassert(!(msg->header(resip::h_RequestLine).uri().hasEmbedded()));
1822
tassert(msg->header(resip::h_RequestLine).uri().numKnownParams()==0);
1823
tassert(msg->header(resip::h_RequestLine).uri().numUnknownParams()==0);
1824
tassert(msg->header(resip::h_RequestLine).getSipVersion()=="SIP/2.0");
1826
//To: sip:j.user@example.com
1827
tassert(msg->exists(resip::h_To));
1828
tassert(msg->header(resip::h_To).displayName()=="");
1829
tassert(msg->header(resip::h_To).numKnownParams()==0);
1830
tassert(msg->header(resip::h_To).numUnknownParams()==0);
1831
tassert(!(msg->header(resip::h_To).isAllContacts()));
1832
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
1833
tassert(msg->header(resip::h_To).uri().user()=="j.user");
1834
tassert(msg->header(resip::h_To).uri().password().empty());
1835
tassert(msg->header(resip::h_To).uri().host()=="example.com");
1836
tassert(msg->header(resip::h_To).uri().port()==0);
1837
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
1838
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
1839
tassert(msg->header(resip::h_To).uri().numUnknownParams()==0);
1841
//From: sip:j.user@example.com;tag=43251j3j324
1842
tassert(msg->exists(resip::h_From));
1843
tassert(msg->header(resip::h_From).displayName()=="");
1844
tassert(msg->header(resip::h_From).numKnownParams()==1);
1845
tassert(msg->header(resip::h_From).numUnknownParams()==0);
1846
tassert(msg->header(resip::h_From).exists(resip::p_tag));
1847
tassert(msg->header(resip::h_From).param(resip::p_tag)=="43251j3j324");
1848
tassert(!(msg->header(resip::h_From).isAllContacts()));
1849
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
1850
tassert(msg->header(resip::h_From).uri().user()=="j.user");
1851
tassert(msg->header(resip::h_From).uri().password().empty());
1852
tassert(msg->header(resip::h_From).uri().host()=="example.com");
1853
tassert(msg->header(resip::h_From).uri().port()==0);
1854
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
1855
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
1856
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
1859
tassert(msg->exists(resip::h_MaxForwards));
1860
tassert(msg->header(resip::h_MaxForwards).value()==8);
1861
tassert(msg->header(resip::h_MaxForwards).numKnownParams()==0);
1862
tassert(msg->header(resip::h_MaxForwards).numUnknownParams()==0);
1864
//I: dblreq.0ha0isndaksdj99sdfafnl3lk233412
1865
tassert(msg->exists(resip::h_CallID));
1866
tassert(msg->header(resip::h_CallID).value()=="dblreq.0ha0isndaksdj99sdfafnl3lk233412");
1867
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
1868
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
1870
//Contact: sip:j.user@host.example.com
1871
tassert(msg->exists(resip::h_Contacts));
1872
tassert(msg->header(resip::h_Contacts).size()==1);
1873
resip::ParserContainer<resip::NameAddr>::iterator j=msg->header(resip::h_Contacts).begin();
1875
tassert(j->displayName()=="");
1876
tassert(j->numKnownParams()==0);
1877
tassert(j->numUnknownParams()==0);
1878
tassert(!(j->isAllContacts()));
1879
tassert(j->uri().numKnownParams()==0);
1880
tassert(j->uri().numUnknownParams()==0);
1881
tassert(j->uri().scheme()=="sip");
1882
tassert(j->uri().user()=="j.user");
1883
tassert(j->uri().password().empty());
1884
tassert(j->uri().host()=="host.example.com");
1885
tassert(j->uri().port()==0);
1886
tassert(!(j->uri().hasEmbedded()));
1889
tassert(msg->exists(resip::h_CSeq));
1890
tassert(msg->header(resip::h_CSeq).method()==resip::REGISTER);
1891
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="REGISTER");
1892
tassert(msg->header(resip::h_CSeq).sequence()==8);
1893
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
1894
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
1896
//Via: SIP/2.0/UDP 192.0.2.125;branch=z9hG4bKkdjuw23492
1897
tassert(msg->exists(resip::h_Vias));
1898
tassert(msg->header(resip::h_Vias).size()==1);
1899
resip::ParserContainer<resip::Via>::iterator i=msg->header(resip::h_Vias).begin();
1901
tassert(i->numKnownParams()==1);
1902
tassert(i->numUnknownParams()==0);
1903
tassert(i->protocolName()=="SIP");
1904
tassert(i->protocolVersion()=="2.0");
1905
tassert(i->transport()=="UDP");
1906
tassert(i->sentHost()=="192.0.2.125");
1907
tassert(i->sentPort()==0);
1909
tassert(i->exists(resip::p_branch));
1910
tassert(i->param(resip::p_branch).hasMagicCookie());
1911
tassert(i->param(resip::p_branch).getTransactionId()=="kdjuw23492");
1912
tassert(i->param(resip::p_branch).clientData().empty());
1915
tassert(msg->exists(resip::h_ContentLength));
1916
// .bwc. We configured SipMessage to take the Content-Length seriously
1917
tassert(msg->header(resip::h_ContentLength).value()==0);
1918
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
1919
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
1923
InfoLog(<< "In case dblreq:" );
1924
InfoLog(<< "Original text:" << std::endl << txt );
1925
InfoLog(<< "Encoded form:" << std::endl << encoded );
1926
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
1938
This request has a semicolon-separated parameter contained in the
1939
"user" part of the Request-URI (whose value contains an escaped @
1940
symbol). Receiving elements will accept this as a well-formed
1941
message. The Request-URI will parse so that the user part is
1942
"user;par=u@example.net".
1944
OPTIONS sip:user;par=u%40example.net@example.com SIP/2.0
1945
To: sip:j_user@example.com
1946
From: sip:caller@example.org;tag=33242
1948
Call-ID: semiuri.0ha0isndaksdj
1950
Accept: application/sdp, application/pkcs7-mime,
1951
multipart/mixed, multipart/signed,
1952
message/sip, message/sipfrag
1953
Via: SIP/2.0/UDP 192.0.2.1;branch=z9hG4bKkdjuw
1958
FILE* fid= fopen("semiuri.dat","r");
1965
result = fread(&mBuf,1,1024,fid);
1966
txt += resip::Data(mBuf,result);
1969
resip::SipMessage* msg = resip::SipMessage::make(txt);
1978
std::auto_ptr<resip::SipMessage> message(msg);
1979
msg->parseAllHeaders();
1981
resip::SipMessage copy(*msg);
1983
resip::Data encoded;
1985
resip::oDataStream str(encoded);
1988
resip::Data copyEncoded;
1990
resip::oDataStream str(copyEncoded);
1995
//OPTIONS sip:user;par=u%40example.net@example.com SIP/2.0
1996
tassert(msg->header(resip::h_RequestLine).method()==resip::OPTIONS);
1997
tassert(msg->header(resip::h_RequestLine).unknownMethodName()=="OPTIONS");
1998
tassert(msg->header(resip::h_RequestLine).uri().scheme()=="sip");
1999
// ?bwc? Need to determine how escaped stuff should be represented internally
2000
tassert(msg->header(resip::h_RequestLine).uri().user()=="user;par=u%40example.net");
2002
tassert(msg->header(resip::h_RequestLine).uri().password().empty());
2003
tassert(msg->header(resip::h_RequestLine).uri().host()=="example.com");
2004
tassert(msg->header(resip::h_RequestLine).uri().port()==0);
2005
tassert(!(msg->header(resip::h_RequestLine).uri().hasEmbedded()));
2006
tassert(msg->header(resip::h_RequestLine).uri().numKnownParams()==0);
2007
tassert(msg->header(resip::h_RequestLine).uri().numUnknownParams()==0);
2008
tassert(msg->header(resip::h_RequestLine).getSipVersion()=="SIP/2.0");
2010
//To: sip:j_user@example.com
2011
tassert(msg->exists(resip::h_To));
2012
tassert(msg->header(resip::h_To).displayName()=="");
2013
tassert(msg->header(resip::h_To).numKnownParams()==0);
2014
tassert(msg->header(resip::h_To).numUnknownParams()==0);
2015
tassert(!(msg->header(resip::h_To).isAllContacts()));
2016
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
2017
tassert(msg->header(resip::h_To).uri().user()=="j_user");
2018
tassert(msg->header(resip::h_To).uri().password().empty());
2019
tassert(msg->header(resip::h_To).uri().host()=="example.com");
2020
tassert(msg->header(resip::h_To).uri().port()==0);
2021
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
2022
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
2023
tassert(msg->header(resip::h_To).uri().numUnknownParams()==0);
2025
//From: sip:caller@example.org;tag=33242
2026
tassert(msg->exists(resip::h_From));
2027
tassert(msg->header(resip::h_From).displayName()=="");
2028
tassert(msg->header(resip::h_From).numKnownParams()==1);
2029
tassert(msg->header(resip::h_From).numUnknownParams()==0);
2030
tassert(msg->header(resip::h_From).exists(resip::p_tag));
2031
tassert(msg->header(resip::h_From).param(resip::p_tag)=="33242");
2032
tassert(!(msg->header(resip::h_From).isAllContacts()));
2033
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
2034
tassert(msg->header(resip::h_From).uri().user()=="caller");
2035
tassert(msg->header(resip::h_From).uri().password().empty());
2036
tassert(msg->header(resip::h_From).uri().host()=="example.org");
2037
tassert(msg->header(resip::h_From).uri().port()==0);
2038
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
2039
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
2040
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
2043
tassert(msg->exists(resip::h_MaxForwards));
2044
tassert(msg->header(resip::h_MaxForwards).value()==3);
2045
tassert(msg->header(resip::h_MaxForwards).numKnownParams()==0);
2046
tassert(msg->header(resip::h_MaxForwards).numUnknownParams()==0);
2048
//Call-ID: semiuri.0ha0isndaksdj
2049
tassert(msg->exists(resip::h_CallID));
2050
tassert(msg->header(resip::h_CallID).value()=="semiuri.0ha0isndaksdj");
2051
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
2052
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
2055
tassert(msg->exists(resip::h_CSeq));
2056
tassert(msg->header(resip::h_CSeq).method()==resip::OPTIONS);
2057
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="OPTIONS");
2058
tassert(msg->header(resip::h_CSeq).sequence()==8);
2059
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
2060
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
2062
//Accept: application/sdp, application/pkcs7-mime,
2063
// multipart/mixed, multipart/signed,
2064
// message/sip, message/sipfrag
2065
tassert(msg->exists(resip::h_Accepts));
2066
tassert(msg->header(resip::h_Accepts).size()==6);
2068
resip::Mimes::iterator a=msg->header(resip::h_Accepts).begin();
2070
tassert(a->type()=="application");
2071
tassert(a->subType()=="sdp");
2072
tassert(a->numKnownParams()==0);
2073
tassert(a->numUnknownParams()==0);
2076
tassert(a->type()=="application");
2077
tassert(a->subType()=="pkcs7-mime");
2078
tassert(a->numKnownParams()==0);
2079
tassert(a->numUnknownParams()==0);
2082
tassert(a->type()=="multipart");
2083
tassert(a->subType()=="mixed");
2084
tassert(a->numKnownParams()==0);
2085
tassert(a->numUnknownParams()==0);
2088
tassert(a->type()=="multipart");
2089
tassert(a->subType()=="signed");
2090
tassert(a->numKnownParams()==0);
2091
tassert(a->numUnknownParams()==0);
2094
tassert(a->type()=="message");
2095
tassert(a->subType()=="sip");
2096
tassert(a->numKnownParams()==0);
2097
tassert(a->numUnknownParams()==0);
2100
tassert(a->type()=="message");
2101
tassert(a->subType()=="sipfrag");
2102
tassert(a->numKnownParams()==0);
2103
tassert(a->numUnknownParams()==0);
2105
//Via: SIP/2.0/UDP 192.0.2.1;branch=z9hG4bKkdjuw
2106
tassert(msg->exists(resip::h_Vias));
2107
tassert(msg->header(resip::h_Vias).size()==1);
2108
resip::ParserContainer<resip::Via>::iterator i=msg->header(resip::h_Vias).begin();
2110
tassert(i->numKnownParams()==1);
2111
tassert(i->numUnknownParams()==0);
2112
tassert(i->protocolName()=="SIP");
2113
tassert(i->protocolVersion()=="2.0");
2114
tassert(i->transport()=="UDP");
2115
tassert(i->sentHost()=="192.0.2.1");
2116
tassert(i->sentPort()==0);
2118
tassert(i->exists(resip::p_branch));
2119
tassert(i->param(resip::p_branch).hasMagicCookie());
2120
tassert(i->param(resip::p_branch).getTransactionId()=="kdjuw");
2121
tassert(i->param(resip::p_branch).clientData().empty());
2124
tassert(msg->exists(resip::h_ContentLength));
2125
tassert(msg->header(resip::h_ContentLength).value()==0);
2126
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
2127
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
2131
InfoLog(<< "In case semiuri:" );
2132
InfoLog(<< "Original text:" << std::endl << txt );
2133
InfoLog(<< "Encoded form:" << std::endl << encoded );
2134
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
2146
This request contains Via header field values with all known
2147
transport types and exercises the transport extension mechanism.
2148
Parsers must accept this message as well formed. Elements receiving
2149
this message would process it exactly as if the 2nd and subsequent
2150
header field values specified UDP (or other transport).
2152
OPTIONS sip:user@example.com SIP/2.0
2153
To: sip:user@example.com
2154
From: <sip:caller@example.com>;tag=323
2156
Call-ID: transports.kijh4akdnaqjkwendsasfdj
2157
Accept: application/sdp
2159
Via: SIP/2.0/UDP t1.example.com;branch=z9hG4bKkdjuw
2160
Via: SIP/2.0/SCTP t2.example.com;branch=z9hG4bKklasjdhf
2161
Via: SIP/2.0/TLS t3.example.com;branch=z9hG4bK2980unddj
2162
Via: SIP/2.0/UNKNOWN t4.example.com;branch=z9hG4bKasd0f3en
2163
Via: SIP/2.0/TCP t5.example.com;branch=z9hG4bK0a9idfnee
2168
FILE* fid= fopen("transports.dat","r");
2175
result = fread(&mBuf,1,1024,fid);
2176
txt += resip::Data(mBuf,result);
2179
resip::SipMessage* msg = resip::SipMessage::make(txt);
2188
std::auto_ptr<resip::SipMessage> message(msg);
2189
msg->parseAllHeaders();
2191
resip::SipMessage copy(*msg);
2193
resip::Data encoded;
2195
resip::oDataStream str(encoded);
2198
resip::Data copyEncoded;
2200
resip::oDataStream str(copyEncoded);
2205
//OPTIONS sip:user@example.com SIP/2.0
2206
tassert(msg->header(resip::h_RequestLine).method()==resip::OPTIONS);
2207
tassert(msg->header(resip::h_RequestLine).unknownMethodName()=="OPTIONS");
2208
tassert(msg->header(resip::h_RequestLine).uri().scheme()=="sip");
2209
tassert(msg->header(resip::h_RequestLine).uri().user()=="user");
2211
tassert(msg->header(resip::h_RequestLine).uri().password().empty());
2212
tassert(msg->header(resip::h_RequestLine).uri().host()=="example.com");
2213
tassert(msg->header(resip::h_RequestLine).uri().port()==0);
2214
tassert(!(msg->header(resip::h_RequestLine).uri().hasEmbedded()));
2215
tassert(msg->header(resip::h_RequestLine).uri().numKnownParams()==0);
2216
tassert(msg->header(resip::h_RequestLine).uri().numUnknownParams()==0);
2217
tassert(msg->header(resip::h_RequestLine).getSipVersion()=="SIP/2.0");
2219
//To: sip:user@example.com
2220
tassert(msg->exists(resip::h_To));
2221
tassert(msg->header(resip::h_To).displayName()=="");
2222
tassert(msg->header(resip::h_To).numKnownParams()==0);
2223
tassert(msg->header(resip::h_To).numUnknownParams()==0);
2224
tassert(!(msg->header(resip::h_To).isAllContacts()));
2225
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
2226
tassert(msg->header(resip::h_To).uri().user()=="user");
2227
tassert(msg->header(resip::h_To).uri().password().empty());
2228
tassert(msg->header(resip::h_To).uri().host()=="example.com");
2229
tassert(msg->header(resip::h_To).uri().port()==0);
2230
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
2231
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
2232
tassert(msg->header(resip::h_To).uri().numUnknownParams()==0);
2234
//From: <sip:caller@example.com>;tag=323
2235
tassert(msg->exists(resip::h_From));
2236
tassert(msg->header(resip::h_From).displayName()=="");
2237
tassert(msg->header(resip::h_From).numKnownParams()==1);
2238
tassert(msg->header(resip::h_From).numUnknownParams()==0);
2239
tassert(msg->header(resip::h_From).exists(resip::p_tag));
2240
tassert(msg->header(resip::h_From).param(resip::p_tag)=="323");
2241
tassert(!(msg->header(resip::h_From).isAllContacts()));
2242
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
2243
tassert(msg->header(resip::h_From).uri().user()=="caller");
2244
tassert(msg->header(resip::h_From).uri().password().empty());
2245
tassert(msg->header(resip::h_From).uri().host()=="example.com");
2246
tassert(msg->header(resip::h_From).uri().port()==0);
2247
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
2248
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
2249
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
2252
tassert(msg->exists(resip::h_MaxForwards));
2253
tassert(msg->header(resip::h_MaxForwards).value()==70);
2254
tassert(msg->header(resip::h_MaxForwards).numKnownParams()==0);
2255
tassert(msg->header(resip::h_MaxForwards).numUnknownParams()==0);
2257
//Call-ID: transports.kijh4akdnaqjkwendsasfdj
2258
tassert(msg->exists(resip::h_CallID));
2259
tassert(msg->header(resip::h_CallID).value()=="transports.kijh4akdnaqjkwendsasfdj");
2260
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
2261
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
2263
//Accept: application/sdp
2264
tassert(msg->exists(resip::h_Accepts));
2265
tassert(msg->header(resip::h_Accepts).size()==1);
2267
resip::Mimes::iterator a=msg->header(resip::h_Accepts).begin();
2269
tassert(a->type()=="application");
2270
tassert(a->subType()=="sdp");
2271
tassert(a->numKnownParams()==0);
2272
tassert(a->numUnknownParams()==0);
2275
tassert(msg->exists(resip::h_CSeq));
2276
tassert(msg->header(resip::h_CSeq).method()==resip::OPTIONS);
2277
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="OPTIONS");
2278
tassert(msg->header(resip::h_CSeq).sequence()==60);
2279
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
2280
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
2283
tassert(msg->exists(resip::h_Vias));
2284
tassert(msg->header(resip::h_Vias).size()==5);
2285
resip::ParserContainer<resip::Via>::iterator v=msg->header(resip::h_Vias).begin();
2287
//Via: SIP/2.0/UDP t1.example.com;branch=z9hG4bKkdjuw
2288
tassert(v->numKnownParams()==1);
2289
tassert(v->numUnknownParams()==0);
2290
tassert(v->protocolName()=="SIP");
2291
tassert(v->protocolVersion()=="2.0");
2292
tassert(v->transport()=="UDP");
2293
tassert(v->sentHost()=="t1.example.com");
2294
tassert(v->sentPort()==0);
2296
tassert(v->exists(resip::p_branch));
2297
tassert(v->param(resip::p_branch).hasMagicCookie());
2298
tassert(v->param(resip::p_branch).getTransactionId()=="kdjuw");
2299
tassert(v->param(resip::p_branch).clientData().empty());
2302
//Via: SIP/2.0/SCTP t2.example.com;branch=z9hG4bKklasjdhf
2303
tassert(v->numKnownParams()==1);
2304
tassert(v->numUnknownParams()==0);
2305
tassert(v->protocolName()=="SIP");
2306
tassert(v->protocolVersion()=="2.0");
2307
tassert(v->transport()=="SCTP");
2308
tassert(v->sentHost()=="t2.example.com");
2309
tassert(v->sentPort()==0);
2311
tassert(v->exists(resip::p_branch));
2312
tassert(v->param(resip::p_branch).hasMagicCookie());
2313
tassert(v->param(resip::p_branch).getTransactionId()=="klasjdhf");
2314
tassert(v->param(resip::p_branch).clientData().empty());
2317
//Via: SIP/2.0/TLS t3.example.com;branch=z9hG4bK2980unddj
2318
tassert(v->numKnownParams()==1);
2319
tassert(v->numUnknownParams()==0);
2320
tassert(v->protocolName()=="SIP");
2321
tassert(v->protocolVersion()=="2.0");
2322
tassert(v->transport()=="TLS");
2323
tassert(v->sentHost()=="t3.example.com");
2324
tassert(v->sentPort()==0);
2326
tassert(v->exists(resip::p_branch));
2327
tassert(v->param(resip::p_branch).hasMagicCookie());
2328
tassert(v->param(resip::p_branch).getTransactionId()=="2980unddj");
2329
tassert(v->param(resip::p_branch).clientData().empty());
2332
//Via: SIP/2.0/UNKNOWN t4.example.com;branch=z9hG4bKasd0f3en
2333
tassert(v->numKnownParams()==1);
2334
tassert(v->numUnknownParams()==0);
2335
tassert(v->protocolName()=="SIP");
2336
tassert(v->protocolVersion()=="2.0");
2337
tassert(v->transport()=="UNKNOWN");
2338
tassert(v->sentHost()=="t4.example.com");
2339
tassert(v->sentPort()==0);
2341
tassert(v->exists(resip::p_branch));
2342
tassert(v->param(resip::p_branch).hasMagicCookie());
2343
tassert(v->param(resip::p_branch).getTransactionId()=="asd0f3en");
2344
tassert(v->param(resip::p_branch).clientData().empty());
2347
//Via: SIP/2.0/TCP t5.example.com;branch=z9hG4bK0a9idfnee
2348
tassert(v->numKnownParams()==1);
2349
tassert(v->numUnknownParams()==0);
2350
tassert(v->protocolName()=="SIP");
2351
tassert(v->protocolVersion()=="2.0");
2352
tassert(v->transport()=="TCP");
2353
tassert(v->sentHost()=="t5.example.com");
2354
tassert(v->sentPort()==0);
2356
tassert(v->exists(resip::p_branch));
2357
tassert(v->param(resip::p_branch).hasMagicCookie());
2358
tassert(v->param(resip::p_branch).getTransactionId()=="0a9idfnee");
2359
tassert(v->param(resip::p_branch).clientData().empty());
2362
tassert(msg->exists(resip::h_ContentLength));
2363
tassert(msg->header(resip::h_ContentLength).value()==0);
2364
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
2365
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
2367
InfoLog(<< "In case transports:" );
2368
InfoLog(<< "Original text:" << std::endl << txt );
2369
InfoLog(<< "Encoded form:" << std::endl << encoded );
2370
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
2383
This MESSAGE request contains two body parts. The second part is
2384
binary encoded and contains null (0x00) characters. Receivers must
2385
take care to frame the received message properly.
2387
Parsers must accept this message as well formed, even if the
2388
application above the parser does not support multipart/signed.
2390
Additional examples of multipart/mime messages, in particular S/MIME
2391
messages, are available in the security call flow examples document
2394
MESSAGE sip:kumiko@example.org SIP/2.0
2395
Via: SIP/2.0/UDP 127.0.0.1:5070;branch=z9hG4bK-d87543-4dade06d0bdb11ee-1--d87543-;rport
2397
Route: <sip:127.0.0.1:5080>
2398
Identity: r5mwreLuyDRYBi/0TiPwEsY3rEVsk/G2WxhgTV1PF7hHuLIK0YWVKZhKv9Mj8UeXqkMVbnVq37CD+813gvYjcBUaZngQmXc9WNZSDNGCzA+fWl9MEUHWIZo1CeJebdY/XlgKeTa0Olvq0rt70Q5jiSfbqMJmQFteeivUhkMWYUA=
2399
Contact: <sip:fluffy@127.0.0.1:5070>
2400
To: <sip:kumiko@example.org>
2401
From: <sip:fluffy@example.com>;tag=2fb0dcc9
2402
Call-ID: 3d9485ad0c49859b@Zmx1ZmZ5LW1hYy0xNi5sb2NhbA..
2404
Content-Transfer-Encoding: binary
2405
Content-Type: multipart/mixed;boundary=7a9cbec02ceef655
2406
Date: Sat, 15 Oct 2005 04:44:56 GMT
2407
User-Agent: SIPimp.org/0.2.5 (curses)
2411
Content-Type: text/plain
2412
Content-Transfer-Encoding: binary
2416
Content-Type: application/octet-stream
2417
Content-Transfer-Encoding: binary
2420
ļæ½ļæ½C0ļæ½?1 0+0 *ļæ½Hļæ½ļæ½
2421
1ļæ½ 0ļæ½0|0p10 UUS10U
2422
California10USan Jose10U
2423
sipit1)0'U Sipit Test Certificate Authorityļæ½ q30+0
2425
ļæ½ļæ½ļæ½ļæ½fļæ½Hļæ½R-ļæ½åļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½fYqbļæ½ļæ½ļæ½*ļæ½ļæ½5
2426
hļæ½ļæ½ļæ½<ļæ½+ļæ½uļæ½ļæ½dļæ½Y=ļæ½G(ļæ½b ļæ½ļæ½Atļæ½3
2427
ļæ½ļæ½ļæ½Ūļæ½B.{rļæ½Ņļæ½É®.ļæ½ļæ½ļæ½ļæ½ļæ½/;~Oļæ½'ļæ½Tmä¶Ŗ:ļæ½>fļæ½ļæ½]ļæ½ļæ½Kļæ½ļæ½ļæ½ļæ½ļæ½ļæ½-ļæ½Oļæ½{eļæ½ļæ½ļæ½
2428
--7a9cbec02ceef655--
2433
FILE* fid= fopen("mpart01.dat","r");
2440
result = fread(&mBuf,1,1024,fid);
2441
txt += resip::Data(mBuf,result);
2444
resip::SipMessage* msg = resip::SipMessage::make(txt);
2453
std::auto_ptr<resip::SipMessage> message(msg);
2454
msg->parseAllHeaders();
2456
resip::SipMessage copy(*msg);
2458
resip::Data encoded;
2460
resip::oDataStream str(encoded);
2463
resip::Data copyEncoded;
2465
resip::oDataStream str(copyEncoded);
2470
//MESSAGE sip:kumiko@example.org SIP/2.0
2471
tassert(msg->header(resip::h_RequestLine).method()==resip::MESSAGE);
2472
tassert(msg->header(resip::h_RequestLine).unknownMethodName()=="MESSAGE");
2473
tassert(msg->header(resip::h_RequestLine).uri().scheme()=="sip");
2474
tassert(msg->header(resip::h_RequestLine).uri().user()=="kumiko");
2475
tassert(msg->header(resip::h_RequestLine).uri().password().empty());
2476
tassert(msg->header(resip::h_RequestLine).uri().host()=="example.org");
2477
tassert(msg->header(resip::h_RequestLine).uri().port()==0);
2478
tassert(!(msg->header(resip::h_RequestLine).uri().hasEmbedded()));
2479
tassert(msg->header(resip::h_RequestLine).uri().numKnownParams()==0);
2480
tassert(msg->header(resip::h_RequestLine).uri().numUnknownParams()==0);
2481
tassert(msg->header(resip::h_RequestLine).getSipVersion()=="SIP/2.0");
2484
tassert(msg->exists(resip::h_Vias));
2485
tassert(msg->header(resip::h_Vias).size()==1);
2486
resip::ParserContainer<resip::Via>::iterator v=msg->header(resip::h_Vias).begin();
2488
//Via: SIP/2.0/UDP 127.0.0.1:5070;branch=z9hG4bK-d87543-4dade06d0bdb11ee-1--d87543-;rport
2489
tassert(v->numKnownParams()==2);
2490
tassert(v->numUnknownParams()==0);
2491
tassert(v->protocolName()=="SIP");
2492
tassert(v->protocolVersion()=="2.0");
2493
tassert(v->transport()=="UDP");
2494
tassert(v->sentHost()=="127.0.0.1");
2495
tassert(v->sentPort()==5070);
2497
tassert(v->exists(resip::p_branch));
2498
tassert(v->param(resip::p_branch).hasMagicCookie());
2499
// .bwc. This branch parameter has old resip-specific tokens in it. The
2500
// "d87543" used to be the resip cookie, but the resip cookie has since
2501
// changed. So, the whole branch param is taken as the transaction id.
2502
tassert(v->param(resip::p_branch).getTransactionId()==
2503
"-d87543-4dade06d0bdb11ee-1--d87543-");
2504
tassert(v->param(resip::p_branch).clientData().empty());
2506
tassert(v->exists(resip::p_rport));
2507
tassert(!(v->param(resip::p_rport).hasValue()));
2508
tassert(v->param(resip::p_rport).port()==0);
2511
tassert(msg->exists(resip::h_MaxForwards));
2512
tassert(msg->header(resip::h_MaxForwards).value()==70);
2513
tassert(msg->header(resip::h_MaxForwards).numKnownParams()==0);
2514
tassert(msg->header(resip::h_MaxForwards).numUnknownParams()==0);
2516
//Route: <sip:127.0.0.1:5080>
2517
tassert(msg->exists(resip::h_Routes));
2518
tassert(msg->header(resip::h_Routes).size()==1);
2519
resip::ParserContainer<resip::NameAddr>::iterator r=msg->header(resip::h_Routes).begin();
2521
tassert(r->numKnownParams()==0);
2522
tassert(r->numUnknownParams()==0);
2523
tassert(r->displayName()=="");
2524
tassert(r->uri().scheme()=="sip");
2525
tassert(r->uri().user()=="");
2526
tassert(r->uri().password()=="");
2527
tassert(r->uri().host()=="127.0.0.1");
2528
tassert(r->uri().port()==5080);
2529
tassert(!(r->uri().hasEmbedded()));
2530
tassert(r->uri().numKnownParams()==0);
2531
tassert(r->uri().numUnknownParams()==0);
2534
//Identity: r5mwreLuyDRYBi/0TiPwEsY3rEVsk/G2WxhgTV1PF7hHuLIK0YWVKZhKv9Mj8UeXqkMVbnVq37CD+813gvYjcBUaZngQmXc9WNZSDNGCzA+fWl9MEUHWIZo1CeJebdY/XlgKeTa0Olvq0rt70Q5jiSfbqMJmQFteeivUhkMWYUA=
2535
tassert(msg->exists(resip::h_Identity));
2536
tassert(msg->header(resip::h_Identity).value()=="r5mwreLuyDRYBi/0TiPwEsY3rEVsk/G2WxhgTV1PF7hHuLIK0YWVKZhKv9Mj8UeXqkMVbnVq37CD+813gvYjcBUaZngQmXc9WNZSDNGCzA+fWl9MEUHWIZo1CeJebdY/XlgKeTa0Olvq0rt70Q5jiSfbqMJmQFteeivUhkMWYUA=");
2537
tassert(msg->header(resip::h_Identity).numKnownParams()==0);
2538
tassert(msg->header(resip::h_Identity).numUnknownParams()==0);
2540
//Contact: <sip:fluffy@127.0.0.1:5070>
2541
tassert(msg->exists(resip::h_Contacts));
2542
tassert(msg->header(resip::h_Contacts).size()==1);
2543
resip::ParserContainer<resip::NameAddr>::iterator m=msg->header(resip::h_Contacts).begin();
2545
tassert(m->displayName()=="");
2546
tassert(m->numKnownParams()==0);
2547
tassert(m->numUnknownParams()==0);
2548
tassert(!(m->isAllContacts()));
2549
tassert(m->uri().numKnownParams()==0);
2550
tassert(m->uri().numUnknownParams()==0);
2551
tassert(m->uri().scheme()=="sip");
2552
tassert(m->uri().user()=="fluffy");
2553
tassert(m->uri().password().empty());
2554
tassert(m->uri().host()=="127.0.0.1");
2555
tassert(m->uri().port()==5070);
2556
tassert(!(m->uri().hasEmbedded()));
2558
//To: <sip:kumiko@example.org>
2559
tassert(msg->exists(resip::h_To));
2560
tassert(msg->header(resip::h_To).displayName()=="");
2561
tassert(msg->header(resip::h_To).numKnownParams()==0);
2562
tassert(msg->header(resip::h_To).numUnknownParams()==0);
2563
tassert(!(msg->header(resip::h_To).isAllContacts()));
2564
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
2565
tassert(msg->header(resip::h_To).uri().user()=="kumiko");
2566
tassert(msg->header(resip::h_To).uri().password().empty());
2567
tassert(msg->header(resip::h_To).uri().host()=="example.org");
2568
tassert(msg->header(resip::h_To).uri().port()==0);
2569
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
2570
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
2571
tassert(msg->header(resip::h_To).uri().numUnknownParams()==0);
2573
//From: <sip:fluffy@example.com>;tag=2fb0dcc9
2574
tassert(msg->exists(resip::h_From));
2575
tassert(msg->header(resip::h_From).displayName()=="");
2576
tassert(msg->header(resip::h_From).numKnownParams()==1);
2577
tassert(msg->header(resip::h_From).numUnknownParams()==0);
2578
tassert(msg->header(resip::h_From).exists(resip::p_tag));
2579
tassert(msg->header(resip::h_From).param(resip::p_tag)=="2fb0dcc9");
2580
tassert(!(msg->header(resip::h_From).isAllContacts()));
2581
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
2582
tassert(msg->header(resip::h_From).uri().user()=="fluffy");
2583
tassert(msg->header(resip::h_From).uri().password().empty());
2584
tassert(msg->header(resip::h_From).uri().host()=="example.com");
2585
tassert(msg->header(resip::h_From).uri().port()==0);
2586
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
2587
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
2588
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
2590
//Call-ID: 3d9485ad0c49859b@Zmx1ZmZ5LW1hYy0xNi5sb2NhbA..
2591
tassert(msg->exists(resip::h_CallID));
2592
tassert(msg->header(resip::h_CallID).value()=="3d9485ad0c49859b@Zmx1ZmZ5LW1hYy0xNi5sb2NhbA..");
2593
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
2594
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
2597
tassert(msg->exists(resip::h_CSeq));
2598
tassert(msg->header(resip::h_CSeq).method()==resip::MESSAGE);
2599
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="MESSAGE");
2600
tassert(msg->header(resip::h_CSeq).sequence()==1);
2601
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
2602
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
2604
// .bwc. There appears to be some controversy over how this particular
2605
// header should be implemented...
2606
//Content-Transfer-Encoding: binary
2607
tassert(msg->exists(resip::h_ContentTransferEncoding));
2608
tassert(msg->header(resip::h_ContentTransferEncoding).value()=="binary");
2609
tassert(msg->header(resip::h_ContentTransferEncoding).numKnownParams()==0);
2610
tassert(msg->header(resip::h_ContentTransferEncoding).numUnknownParams()==0);
2612
//Content-Type: multipart/mixed;boundary=7a9cbec02ceef655
2613
tassert(msg->exists(resip::h_ContentType));
2614
tassert(msg->header(resip::h_ContentType).type()=="multipart");
2615
tassert(msg->header(resip::h_ContentType).subType()=="mixed");
2616
tassert(msg->header(resip::h_ContentType).numKnownParams()==1);
2617
tassert(msg->header(resip::h_ContentType).numUnknownParams()==0);
2619
tassert(msg->header(resip::h_ContentType).exists(resip::p_boundary));
2620
tassert(msg->header(resip::h_ContentType).param(resip::p_boundary)=="7a9cbec02ceef655");
2622
//Date: Sat, 15 Oct 2005 04:44:56 GMT
2623
tassert(msg->exists(resip::h_Date));
2624
tassert(msg->header(resip::h_Date).dayOfWeek()==resip::Sat);
2625
tassert(msg->header(resip::h_Date).dayOfMonth()==15);
2626
tassert(msg->header(resip::h_Date).month()==resip::Oct);
2627
tassert(msg->header(resip::h_Date).year()==2005);
2628
tassert(msg->header(resip::h_Date).hour()==4);
2629
tassert(msg->header(resip::h_Date).minute()==44);
2630
tassert(msg->header(resip::h_Date).second()==56);
2631
tassert(msg->header(resip::h_Date).numKnownParams()==0);
2632
tassert(msg->header(resip::h_Date).numUnknownParams()==0);
2634
//User-Agent: SIPimp.org/0.2.5 (curses)
2635
tassert(msg->exists(resip::h_UserAgent));
2636
tassert(msg->header(resip::h_UserAgent).value()=="SIPimp.org/0.2.5 (curses)");
2637
tassert(msg->header(resip::h_UserAgent).numKnownParams()==0);
2638
tassert(msg->header(resip::h_UserAgent).numUnknownParams()==0);
2640
//Content-Length: 553
2641
tassert(msg->exists(resip::h_ContentLength));
2642
tassert(msg->header(resip::h_ContentLength).value()==553);
2643
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
2644
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
2647
InfoLog(<< "In case mpart01:" );
2648
InfoLog(<< "Original text:" << std::endl << txt );
2649
InfoLog(<< "Encoded form:" << std::endl << encoded );
2650
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
2662
This 200 response contains a reason phrase other than "OK". The
2663
reason phrase is intended for human consumption and may contain any
2666
Reason-Phrase = *(reserved / unreserved / escaped
2667
/ UTF8-NONASCII / UTF8-CONT / SP / HTAB)
2669
This particular response contains unreserved and non-ascii UTF-8
2670
characters. This response is well formed. A parser must accept this
2674
SIP/2.0 200 = 2**3 * 5**2 Š½Š¾ ŃŃŠ¾ Š“ŠµŠ²ŃŠ½Š¾ŃŃŠ¾ Š“ŠµŠ²ŃŃŃ - ŠæŃŠ¾ŃŃŠ¾Šµ
2675
Via: SIP/2.0/UDP 192.0.2.198;branch=z9hG4bK1324923
2676
Call-ID: unreason.1234ksdfak3j2erwedfsASdf
2678
From: sip:user@example.com;tag=11141343
2679
To: sip:user@example.edu;tag=2229
2681
Content-Type: application/sdp
2682
Contact: <sip:user@host198.example.com>
2685
o=mhandley 29739 7272939 IN IP4 192.0.2.198
2687
c=IN IP4 192.0.2.198
2689
m=audio 49217 RTP/AVP 0 12
2690
m=video 3227 RTP/AVP 31
2694
FILE* fid= fopen("unreason.dat","r");
2701
result = fread(&mBuf,1,1024,fid);
2702
txt += resip::Data(mBuf,result);
2705
resip::SipMessage* msg = resip::SipMessage::make(txt);
2714
std::auto_ptr<resip::SipMessage> message(msg);
2715
msg->parseAllHeaders();
2717
resip::SipMessage copy(*msg);
2719
resip::Data encoded;
2721
resip::oDataStream str(encoded);
2724
resip::Data copyEncoded;
2726
resip::oDataStream str(copyEncoded);
2731
//SIP/2.0 200 = 2**3 * 5**2 Š½Š¾ ŃŃŠ¾ Š“ŠµŠ²ŃŠ½Š¾ŃŃŠ¾ Š“ŠµŠ²ŃŃŃ - ŠæŃŠ¾ŃŃŠ¾Šµ
2732
tassert(msg->header(resip::h_StatusLine).responseCode()==200);
2733
tassert(msg->header(resip::h_StatusLine).getSipVersion()=="SIP/2.0");
2735
resip::Data binaryReason("= 2**3 * 5**2 ");
2736
binaryReason+=(char)0xD0;
2737
binaryReason+=(char)0xBD;
2738
binaryReason+=(char)0xD0;
2739
binaryReason+=(char)0xBE;
2740
binaryReason+=(char)0x20;
2741
binaryReason+=(char)0xD1;
2742
binaryReason+=(char)0x81;
2743
binaryReason+=(char)0xD1;
2744
binaryReason+=(char)0x82;
2745
binaryReason+=(char)0xD0;
2746
binaryReason+=(char)0xBE;
2747
binaryReason+=(char)0x20;
2748
binaryReason+=(char)0xD0;
2749
binaryReason+=(char)0xB4;
2750
binaryReason+=(char)0xD0;
2751
binaryReason+=(char)0xB5;
2752
binaryReason+=(char)0xD0;
2753
binaryReason+=(char)0xB2;
2754
binaryReason+=(char)0xD1;
2755
binaryReason+=(char)0x8F;
2756
binaryReason+=(char)0xD0;
2757
binaryReason+=(char)0xBD;
2758
binaryReason+=(char)0xD0;
2759
binaryReason+=(char)0xBE;
2760
binaryReason+=(char)0xD1;
2761
binaryReason+=(char)0x81;
2762
binaryReason+=(char)0xD1;
2763
binaryReason+=(char)0x82;
2764
binaryReason+=(char)0xD0;
2765
binaryReason+=(char)0xBE;
2766
binaryReason+=(char)0x20;
2767
binaryReason+=(char)0xD0;
2768
binaryReason+=(char)0xB4;
2769
binaryReason+=(char)0xD0;
2770
binaryReason+=(char)0xB5;
2771
binaryReason+=(char)0xD0;
2772
binaryReason+=(char)0xB2;
2773
binaryReason+=(char)0xD1;
2774
binaryReason+=(char)0x8F;
2775
binaryReason+=(char)0xD1;
2776
binaryReason+=(char)0x82;
2777
binaryReason+=(char)0xD1;
2778
binaryReason+=(char)0x8C;
2779
binaryReason+=(char)0x20;
2780
binaryReason+=(char)0x2D;
2781
binaryReason+=(char)0x20;
2782
binaryReason+=(char)0xD0;
2783
binaryReason+=(char)0xBF;
2784
binaryReason+=(char)0xD1;
2785
binaryReason+=(char)0x80;
2786
binaryReason+=(char)0xD0;
2787
binaryReason+=(char)0xBE;
2788
binaryReason+=(char)0xD1;
2789
binaryReason+=(char)0x81;
2790
binaryReason+=(char)0xD1;
2791
binaryReason+=(char)0x82;
2792
binaryReason+=(char)0xD0;
2793
binaryReason+=(char)0xBE;
2794
binaryReason+=(char)0xD0;
2795
binaryReason+=(char)0xB5;
2796
tassert(msg->header(resip::h_StatusLine).reason()==binaryReason);
2799
tassert(msg->exists(resip::h_Vias));
2800
tassert(msg->header(resip::h_Vias).size()==1);
2801
resip::ParserContainer<resip::Via>::iterator v=msg->header(resip::h_Vias).begin();
2803
//Via: SIP/2.0/UDP 192.0.2.198;branch=z9hG4bK1324923
2804
tassert(v->numKnownParams()==1);
2805
tassert(v->numUnknownParams()==0);
2806
tassert(v->protocolName()=="SIP");
2807
tassert(v->protocolVersion()=="2.0");
2808
tassert(v->transport()=="UDP");
2809
tassert(v->sentHost()=="192.0.2.198");
2810
tassert(v->sentPort()==0);
2812
tassert(v->exists(resip::p_branch));
2813
tassert(v->param(resip::p_branch).hasMagicCookie());
2814
tassert(v->param(resip::p_branch).getTransactionId()=="1324923");
2815
tassert(v->param(resip::p_branch).clientData().empty());
2817
//Call-ID: unreason.1234ksdfak3j2erwedfsASdf
2818
tassert(msg->exists(resip::h_CallID));
2819
tassert(msg->header(resip::h_CallID).value()=="unreason.1234ksdfak3j2erwedfsASdf");
2820
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
2821
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
2824
tassert(msg->exists(resip::h_CSeq));
2825
tassert(msg->header(resip::h_CSeq).method()==resip::INVITE);
2826
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="INVITE");
2827
tassert(msg->header(resip::h_CSeq).sequence()==35);
2828
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
2829
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
2831
//From: sip:user@example.com;tag=11141343
2832
tassert(msg->exists(resip::h_From));
2833
tassert(msg->header(resip::h_From).displayName()=="");
2834
tassert(msg->header(resip::h_From).numKnownParams()==1);
2835
tassert(msg->header(resip::h_From).numUnknownParams()==0);
2836
tassert(msg->header(resip::h_From).exists(resip::p_tag));
2837
tassert(msg->header(resip::h_From).param(resip::p_tag)=="11141343");
2838
tassert(!(msg->header(resip::h_From).isAllContacts()));
2839
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
2840
tassert(msg->header(resip::h_From).uri().user()=="user");
2841
tassert(msg->header(resip::h_From).uri().password().empty());
2842
tassert(msg->header(resip::h_From).uri().host()=="example.com");
2843
tassert(msg->header(resip::h_From).uri().port()==0);
2844
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
2845
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
2846
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
2848
//To: sip:user@example.edu;tag=2229
2849
tassert(msg->exists(resip::h_To));
2850
tassert(msg->header(resip::h_To).displayName()=="");
2851
tassert(msg->header(resip::h_To).numKnownParams()==1);
2852
tassert(msg->header(resip::h_To).numUnknownParams()==0);
2853
tassert(msg->header(resip::h_To).exists(resip::p_tag));
2854
tassert(msg->header(resip::h_To).param(resip::p_tag)=="2229");
2855
tassert(!(msg->header(resip::h_To).isAllContacts()));
2856
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
2857
tassert(msg->header(resip::h_To).uri().user()=="user");
2858
tassert(msg->header(resip::h_To).uri().password().empty());
2859
tassert(msg->header(resip::h_To).uri().host()=="example.edu");
2860
tassert(msg->header(resip::h_To).uri().port()==0);
2861
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
2862
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
2863
tassert(msg->header(resip::h_To).uri().numUnknownParams()==0);
2865
//Content-Length: 154
2866
tassert(msg->exists(resip::h_ContentLength));
2867
tassert(msg->header(resip::h_ContentLength).value()==154);
2868
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
2869
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
2871
//Content-Type: application/sdp
2872
tassert(msg->exists(resip::h_ContentType));
2873
tassert(msg->header(resip::h_ContentType).type()=="application");
2874
tassert(msg->header(resip::h_ContentType).subType()=="sdp");
2875
tassert(msg->header(resip::h_ContentType).numKnownParams()==0);
2876
tassert(msg->header(resip::h_ContentType).numUnknownParams()==0);
2878
//Contact: <sip:user@host198.example.com>
2879
tassert(msg->exists(resip::h_Contacts));
2880
tassert(msg->header(resip::h_Contacts).size()==1);
2881
resip::ParserContainer<resip::NameAddr>::iterator m=msg->header(resip::h_Contacts).begin();
2883
tassert(m->displayName()=="");
2884
tassert(m->numKnownParams()==0);
2885
tassert(m->numUnknownParams()==0);
2886
tassert(!(m->isAllContacts()));
2887
tassert(m->uri().numKnownParams()==0);
2888
tassert(m->uri().numUnknownParams()==0);
2889
tassert(m->uri().scheme()=="sip");
2890
tassert(m->uri().user()=="user");
2891
tassert(m->uri().password().empty());
2892
tassert(m->uri().host()=="host198.example.com");
2893
tassert(m->uri().port()==0);
2894
tassert(!(m->uri().hasEmbedded()));
2897
InfoLog(<< "In case unreason:" );
2898
InfoLog(<< "Original text:" << std::endl << txt );
2899
InfoLog(<< "Encoded form:" << std::endl << encoded );
2900
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
2913
This well-formed response contains no reason phrase. A parser must
2914
accept this message. The space character after the reason code is
2915
required. If it were not present, this message could be rejected as
2916
invalid (a liberal receiver would accept it anyway).
2919
Via: SIP/2.0/UDP 192.0.2.105;branch=z9hG4bK2398ndaoe
2920
Call-ID: noreason.asndj203insdf99223ndf
2922
From: <sip:user@example.com>;tag=39ansfi3
2923
To: <sip:user@example.edu>;tag=902jndnke3
2925
Contact: <sip:user@host105.example.com>
2929
FILE* fid= fopen("noreason.dat","r");
2936
result = fread(&mBuf,1,1024,fid);
2937
txt += resip::Data(mBuf,result);
2940
resip::SipMessage* msg = resip::SipMessage::make(txt);
2949
std::auto_ptr<resip::SipMessage> message(msg);
2950
msg->parseAllHeaders();
2952
resip::SipMessage copy(*msg);
2954
resip::Data encoded;
2956
resip::oDataStream str(encoded);
2959
resip::Data copyEncoded;
2961
resip::oDataStream str(copyEncoded);
2967
tassert(msg->header(resip::h_StatusLine).responseCode()==100);
2968
tassert(msg->header(resip::h_StatusLine).getSipVersion()=="SIP/2.0");
2969
tassert(msg->header(resip::h_StatusLine).reason()=="");
2972
tassert(msg->exists(resip::h_Vias));
2973
tassert(msg->header(resip::h_Vias).size()==1);
2974
resip::ParserContainer<resip::Via>::iterator v=msg->header(resip::h_Vias).begin();
2976
//Via: SIP/2.0/UDP 192.0.2.105;branch=z9hG4bK2398ndaoe
2977
tassert(v->numKnownParams()==1);
2978
tassert(v->numUnknownParams()==0);
2979
tassert(v->protocolName()=="SIP");
2980
tassert(v->protocolVersion()=="2.0");
2981
tassert(v->transport()=="UDP");
2982
tassert(v->sentHost()=="192.0.2.105");
2983
tassert(v->sentPort()==0);
2985
tassert(v->exists(resip::p_branch));
2986
tassert(v->param(resip::p_branch).hasMagicCookie());
2987
tassert(v->param(resip::p_branch).getTransactionId()=="2398ndaoe");
2988
tassert(v->param(resip::p_branch).clientData().empty());
2990
//Call-ID: noreason.asndj203insdf99223ndf
2991
tassert(msg->exists(resip::h_CallID));
2992
tassert(msg->header(resip::h_CallID).value()=="noreason.asndj203insdf99223ndf");
2993
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
2994
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
2997
tassert(msg->exists(resip::h_CSeq));
2998
tassert(msg->header(resip::h_CSeq).method()==resip::INVITE);
2999
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="INVITE");
3000
tassert(msg->header(resip::h_CSeq).sequence()==35);
3001
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
3002
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
3004
//From: <sip:user@example.com>;tag=39ansfi3
3005
tassert(msg->exists(resip::h_From));
3006
tassert(msg->header(resip::h_From).displayName()=="");
3007
tassert(msg->header(resip::h_From).numKnownParams()==1);
3008
tassert(msg->header(resip::h_From).numUnknownParams()==0);
3009
tassert(msg->header(resip::h_From).exists(resip::p_tag));
3010
tassert(msg->header(resip::h_From).param(resip::p_tag)=="39ansfi3");
3011
tassert(!(msg->header(resip::h_From).isAllContacts()));
3012
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
3013
tassert(msg->header(resip::h_From).uri().user()=="user");
3014
tassert(msg->header(resip::h_From).uri().password().empty());
3015
tassert(msg->header(resip::h_From).uri().host()=="example.com");
3016
tassert(msg->header(resip::h_From).uri().port()==0);
3017
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
3018
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
3019
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
3021
//To: <sip:user@example.edu>;tag=902jndnke3
3022
tassert(msg->exists(resip::h_To));
3023
tassert(msg->header(resip::h_To).displayName()=="");
3024
tassert(msg->header(resip::h_To).numKnownParams()==1);
3025
tassert(msg->header(resip::h_To).numUnknownParams()==0);
3026
tassert(msg->header(resip::h_To).exists(resip::p_tag));
3027
tassert(msg->header(resip::h_To).param(resip::p_tag)=="902jndnke3");
3028
tassert(!(msg->header(resip::h_To).isAllContacts()));
3029
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
3030
tassert(msg->header(resip::h_To).uri().user()=="user");
3031
tassert(msg->header(resip::h_To).uri().password().empty());
3032
tassert(msg->header(resip::h_To).uri().host()=="example.edu");
3033
tassert(msg->header(resip::h_To).uri().port()==0);
3034
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
3035
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
3036
tassert(msg->header(resip::h_To).uri().numUnknownParams()==0);
3039
tassert(msg->exists(resip::h_ContentLength));
3040
tassert(msg->header(resip::h_ContentLength).value()==0);
3041
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
3042
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
3044
//Contact: <sip:user@host105.example.com>
3045
tassert(msg->exists(resip::h_Contacts));
3046
tassert(msg->header(resip::h_Contacts).size()==1);
3047
resip::ParserContainer<resip::NameAddr>::iterator m=msg->header(resip::h_Contacts).begin();
3049
tassert(m->displayName()=="");
3050
tassert(m->numKnownParams()==0);
3051
tassert(m->numUnknownParams()==0);
3052
tassert(!(m->isAllContacts()));
3053
tassert(m->uri().numKnownParams()==0);
3054
tassert(m->uri().numUnknownParams()==0);
3055
tassert(m->uri().scheme()=="sip");
3056
tassert(m->uri().user()=="user");
3057
tassert(m->uri().password().empty());
3058
tassert(m->uri().host()=="host105.example.com");
3059
tassert(m->uri().port()==0);
3060
tassert(!(m->uri().hasEmbedded()));
3063
InfoLog(<< "In case noreason:" );
3064
InfoLog(<< "Original text:" << std::endl << txt );
3065
InfoLog(<< "Encoded form:" << std::endl << encoded );
3066
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
3079
The Via header field of this request contains additional semicolons
3080
and commas without parameters or values. The Contact header field
3081
contains additional semicolons without parameters. This message is
3082
syntactically invalid.
3084
An element receiving this request should respond with a 400 Bad
3087
INVITE sip:user@example.com SIP/2.0
3088
To: sip:j.user@example.com
3089
From: sip:caller@example.net;tag=134161461246
3091
Call-ID: badinv01.0ha0isndaksdjasdf3234nas
3093
Via: SIP/2.0/UDP 192.0.2.15;;,;,,
3094
Contact: "Joe" <sip:joe@example.org>;;;;
3096
Content-Type: application/sdp
3099
o=mhandley 29739 7272939 IN IP4 192.0.2.15
3103
m=audio 49217 RTP/AVP 0 12
3104
m=video 3227 RTP/AVP 31
3108
FILE* fid= fopen("badinv01.dat","r");
3115
result = fread(&mBuf,1,1024,fid);
3116
txt += resip::Data(mBuf,result);
3119
resip::SipMessage* msg = resip::SipMessage::make(txt);
3126
std::auto_ptr<resip::SipMessage> message(msg);
3127
msg->parseAllHeaders();
3129
resip::SipMessage copy(*msg);
3131
resip::Data encoded;
3133
resip::oDataStream str(encoded);
3136
resip::Data copyEncoded;
3138
resip::oDataStream str(copyEncoded);
3142
InfoLog(<< "In case badinv01:" );
3143
InfoLog(<< "Original text:" << std::endl << txt );
3144
InfoLog(<< "Encoded form:" << std::endl << encoded );
3145
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
3158
This is a request message with a Content Length that is larger than
3159
the actual length of the body.
3161
When sent over UDP (as this message ostensibly was), the receiving
3162
element should respond with a 400 Bad Request error. If this message
3163
arrived over a stream-based transport, such as TCP, there's not much
3164
the receiving party could do but wait for more data on the stream and
3165
close the connection if none is forthcoming within a reasonable
3168
INVITE sip:user@example.com SIP/2.0
3170
To: sip:j.user@example.com
3171
From: sip:caller@example.net;tag=93942939o2
3172
Contact: <sip:caller@hungry.example.net>
3173
Call-ID: clerr.0ha0isndaksdjweiafasdk3
3175
Via: SIP/2.0/UDP host5.example.com;branch=z9hG4bK-39234-23523
3176
Content-Type: application/sdp
3177
Content-Length: 9999
3180
o=mhandley 29739 7272939 IN IP4 192.0.2.155
3182
c=IN IP4 192.0.2.155
3184
m=audio 49217 RTP/AVP 0 12
3185
m=video 3227 RTP/AVP 31
3189
FILE* fid= fopen("clerr.dat","r");
3196
result = fread(&mBuf,1,1024,fid);
3197
txt += resip::Data(mBuf,result);
3200
resip::SipMessage* msg = resip::SipMessage::make(txt);
3208
std::auto_ptr<resip::SipMessage> message(msg);
3209
msg->parseAllHeaders();
3211
resip::SipMessage copy(*msg);
3213
resip::Data encoded;
3215
resip::oDataStream str(encoded);
3218
resip::Data copyEncoded;
3220
resip::oDataStream str(copyEncoded);
3224
InfoLog(<< "In case clerr:" );
3225
InfoLog(<< "Original text:" << std::endl << txt );
3226
InfoLog(<< "Encoded form:" << std::endl << encoded );
3227
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
3240
This request has a negative value for Content-Length.
3242
An element receiving this message should respond with an error. This
3243
request appeared over UDP, so the remainder of the datagram can
3244
simply be discarded. If a request like this arrives over TCP, the
3245
framing error is not recoverable, and the connection should be
3246
closed. The same behavior is appropriate for messages that arrive
3247
without a numeric value in the Content-Length header field, such as
3250
Content-Length: five
3252
Implementors should take extra precautions if the technique they
3253
choose for converting this ascii field into an integral form can
3254
return a negative value. In particular, the result must not be used
3255
as a counter or array index.
3258
INVITE sip:user@example.com SIP/2.0
3260
To: sip:j.user@example.com
3261
From: sip:caller@example.net;tag=32394234
3262
Call-ID: ncl.0ha0isndaksdj2193423r542w35
3264
Via: SIP/2.0/UDP 192.0.2.53;branch=z9hG4bKkdjuw
3265
Contact: <sip:caller@example53.example.net>
3266
Content-Type: application/sdp
3267
Content-Length: -999
3270
o=mhandley 29739 7272939 IN IP4 192.0.2.53
3274
m=audio 49217 RTP/AVP 0 12
3275
m=video 3227 RTP/AVP 31
3279
FILE* fid= fopen("ncl.dat","r");
3286
result = fread(&mBuf,1,1024,fid);
3287
txt += resip::Data(mBuf,result);
3290
resip::SipMessage* msg = resip::SipMessage::make(txt);
3297
std::auto_ptr<resip::SipMessage> message(msg);
3298
msg->parseAllHeaders();
3300
resip::SipMessage copy(*msg);
3302
resip::Data encoded;
3304
resip::oDataStream str(encoded);
3307
resip::Data copyEncoded;
3309
resip::oDataStream str(copyEncoded);
3313
InfoLog(<< "In case ncl:" );
3314
InfoLog(<< "Original text:" << std::endl << txt );
3315
InfoLog(<< "Encoded form:" << std::endl << encoded );
3316
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
3329
This request contains several scalar header field values outside
3332
o The CSeq sequence number is >2**32-1.
3334
o The Max-Forwards value is >255.
3336
o The Expires value is >2**32-1.
3338
o The Contact expires parameter value is >2**32-1.
3340
An element receiving this request should respond with a 400 Bad
3341
Request due to the CSeq error. If only the Max-Forwards field were
3342
in error, the element could choose to process the request as if the
3343
field were absent. If only the expiry values were in error, the
3344
element could treat them as if they contained the default values for
3345
expiration (3600 in this case).
3347
Other scalar request fields that may contain aberrant values include,
3348
but are not limited to, the Contact q value, the Timestamp value, and
3349
the Via ttl parameter.
3352
REGISTER sip:example.com SIP/2.0
3353
Via: SIP/2.0/TCP host129.example.com;branch=z9hG4bK342sdfoi3
3354
To: <sip:user@example.com>
3355
From: <sip:user@example.com>;tag=239232jh3
3356
CSeq: 36893488147419103232 REGISTER
3357
Call-ID: scalar02.23o0pd9vanlq3wnrlnewofjas9ui32
3359
Expires: 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3360
Contact: <sip:user@host129.example.com>
3361
;expires=280297596632815
3366
FILE* fid= fopen("scalar02.dat","r");
3373
result = fread(&mBuf,1,1024,fid);
3374
txt += resip::Data(mBuf,result);
3377
resip::SipMessage* msg = resip::SipMessage::make(txt);
3384
std::auto_ptr<resip::SipMessage> message(msg);
3385
msg->parseAllHeaders();
3387
resip::SipMessage copy(*msg);
3389
resip::Data encoded;
3391
resip::oDataStream str(encoded);
3394
resip::Data copyEncoded;
3396
resip::oDataStream str(copyEncoded);
3400
InfoLog(<< "In case scalar02:" );
3401
InfoLog(<< "Original text:" << std::endl << txt );
3402
InfoLog(<< "Encoded form:" << std::endl << encoded );
3403
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
3416
This response contains several scalar header field values outside
3419
o The CSeq sequence number is >2**32-1.
3421
o The Retry-After field is unreasonably large (note that RFC 3261
3422
does not define a legal range for this field).
3424
o The Warning field has a warning-value with more than 3 digits.
3426
An element receiving this response will simply discard it.
3428
SIP/2.0 503 Service Unavailable
3429
Via: SIP/2.0/TCP host129.example.com;branch=z9hG4bKzzxdiwo34sw;received=192.0.2.129
3430
To: <sip:user@example.com>
3431
From: <sip:other@example.net>;tag=2easdjfejw
3432
CSeq: 9292394834772304023312 OPTIONS
3433
Call-ID: scalarlg.noase0of0234hn2qofoaf0232aewf2394r
3434
Retry-After: 949302838503028349304023988
3435
Warning: 1812 overture "In Progress"
3440
FILE* fid= fopen("scalarlg.dat","r");
3447
result = fread(&mBuf,1,1024,fid);
3448
txt += resip::Data(mBuf,result);
3451
resip::SipMessage* msg = resip::SipMessage::make(txt);
3458
std::auto_ptr<resip::SipMessage> message(msg);
3459
msg->parseAllHeaders();
3461
resip::SipMessage copy(*msg);
3463
resip::Data encoded;
3465
resip::oDataStream str(encoded);
3468
resip::Data copyEncoded;
3470
resip::oDataStream str(copyEncoded);
3474
InfoLog(<< "In case scalarlg:" );
3475
InfoLog(<< "Original text:" << std::endl << txt );
3476
InfoLog(<< "Encoded form:" << std::endl << encoded );
3477
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
3490
This is a request with an unterminated quote in the display name of
3491
the To field. An element receiving this request should return a 400
3494
An element could attempt to infer a terminating quote and accept the
3495
message. Such an element needs to take care that it makes a
3496
reasonable inference when it encounters
3498
To: "Mr J. User <sip:j.user@example.com> <sip:realj@example.net>
3500
INVITE sip:user@example.com SIP/2.0
3501
To: "Mr. J. User <sip:j.user@example.com>
3502
From: sip:caller@example.net;tag=93334
3504
Call-ID: quotbal.aksdj
3505
Contact: <sip:caller@host59.example.net>
3507
Via: SIP/2.0/UDP 192.0.2.59:5050;branch=z9hG4bKkdjuw39234
3508
Content-Type: application/sdp
3512
o=mhandley 29739 7272939 IN IP4 192.0.2.15
3516
m=audio 49217 RTP/AVP 0 12
3517
m=video 3227 RTP/AVP 31
3521
FILE* fid= fopen("quotbal.dat","r");
3528
result = fread(&mBuf,1,1024,fid);
3529
txt += resip::Data(mBuf,result);
3532
resip::SipMessage* msg = resip::SipMessage::make(txt);
3539
std::auto_ptr<resip::SipMessage> message(msg);
3540
msg->parseAllHeaders();
3542
resip::SipMessage copy(*msg);
3544
resip::Data encoded;
3546
resip::oDataStream str(encoded);
3549
resip::Data copyEncoded;
3551
resip::oDataStream str(copyEncoded);
3555
InfoLog(<< "In case quotbal:" );
3556
InfoLog(<< "Original text:" << std::endl << txt );
3557
InfoLog(<< "Encoded form:" << std::endl << encoded );
3558
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
3571
This INVITE request is invalid because the Request-URI has been
3572
enclosed within in "<>".
3574
It is reasonable always to reject a request with this error with a
3575
400 Bad Request. Elements attempting to be liberal with what they
3576
accept may choose to ignore the brackets. If the element forwards
3577
the request, it must not include the brackets in the messages it
3580
INVITE <sip:user@example.com> SIP/2.0
3581
To: sip:user@example.com
3582
From: sip:caller@example.net;tag=39291
3584
Call-ID: ltgtruri.1@192.0.2.5
3586
Via: SIP/2.0/UDP 192.0.2.5
3587
Contact: <sip:caller@host5.example.net>
3588
Content-Type: application/sdp
3592
o=mhandley 29739 7272939 IN IP4 192.0.2.5
3596
m=audio 49217 RTP/AVP 0 12
3597
m=video 3227 RTP/AVP 31
3601
FILE* fid= fopen("ltgtruri.dat","r");
3608
result = fread(&mBuf,1,1024,fid);
3609
txt += resip::Data(mBuf,result);
3612
resip::SipMessage* msg = resip::SipMessage::make(txt);
3619
std::auto_ptr<resip::SipMessage> message(msg);
3620
msg->parseAllHeaders();
3622
resip::SipMessage copy(*msg);
3624
resip::Data encoded;
3626
resip::oDataStream str(encoded);
3629
resip::Data copyEncoded;
3631
resip::oDataStream str(copyEncoded);
3635
InfoLog(<< "In case ltgtruri:" );
3636
InfoLog(<< "Original text:" << std::endl << txt );
3637
InfoLog(<< "Encoded form:" << std::endl << encoded );
3638
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
3650
This INVITE has illegal LWS within the Request-URI.
3652
An element receiving this request should respond with a 400 Bad
3655
An element could attempt to ignore the embedded LWS for those schemes
3656
(like SIP) where doing so would not introduce ambiguity.
3658
INVITE sip:user@example.com; lr SIP/2.0
3659
To: sip:user@example.com;tag=3xfe-9921883-z9f
3660
From: sip:caller@example.net;tag=231413434
3662
Call-ID: lwsruri.asdfasdoeoi2323-asdfwrn23-asd834rk423
3663
CSeq: 2130706432 INVITE
3664
Via: SIP/2.0/UDP 192.0.2.1:5060;branch=z9hG4bKkdjuw2395
3665
Contact: <sip:caller@host1.example.net>
3666
Content-Type: application/sdp
3670
o=mhandley 29739 7272939 IN IP4 192.0.2.1
3674
m=audio 49217 RTP/AVP 0 12
3675
m=video 3227 RTP/AVP 31
3679
FILE* fid= fopen("lwsruri.dat","r");
3686
result = fread(&mBuf,1,1024,fid);
3687
txt += resip::Data(mBuf,result);
3690
resip::SipMessage* msg = resip::SipMessage::make(txt);
3697
std::auto_ptr<resip::SipMessage> message(msg);
3698
msg->parseAllHeaders();
3700
resip::SipMessage copy(*msg);
3702
resip::Data encoded;
3704
resip::oDataStream str(encoded);
3707
resip::Data copyEncoded;
3709
resip::oDataStream str(copyEncoded);
3713
InfoLog(<< "In case lwsruri:" );
3714
InfoLog(<< "Original text:" << std::endl << txt );
3715
InfoLog(<< "Encoded form:" << std::endl << encoded );
3716
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
3729
This INVITE has illegal multiple SP characters between elements of
3732
It is acceptable to reject this request as malformed. An element
3733
that is liberal in what it accepts may ignore these extra SP
3734
characters when processing the request. If the element forwards the
3735
request, it must not include these extra SP characters in the
3738
INVITE sip:user@example.com SIP/2.0
3740
To: sip:user@example.com
3741
From: sip:caller@example.net;tag=8814
3742
Call-ID: lwsstart.dfknq234oi243099adsdfnawe3@example.com
3743
CSeq: 1893884 INVITE
3744
Via: SIP/2.0/UDP host1.example.com;branch=z9hG4bKkdjuw3923
3745
Contact: <sip:caller@host1.example.net>
3746
Content-Type: application/sdp
3750
o=mhandley 29739 7272939 IN IP4 192.0.2.1
3754
m=audio 49217 RTP/AVP 0 12
3755
m=video 3227 RTP/AVP 31
3759
FILE* fid= fopen("lwsstart.dat","r");
3766
result = fread(&mBuf,1,1024,fid);
3767
txt += resip::Data(mBuf,result);
3770
resip::SipMessage* msg = resip::SipMessage::make(txt);
3777
std::auto_ptr<resip::SipMessage> message(msg);
3778
msg->parseAllHeaders();
3780
resip::SipMessage copy(*msg);
3782
resip::Data encoded;
3784
resip::oDataStream str(encoded);
3787
resip::Data copyEncoded;
3789
resip::oDataStream str(copyEncoded);
3793
InfoLog(<< "In case lwsstart:" );
3794
InfoLog(<< "Original text:" << std::endl << txt );
3795
InfoLog(<< "Encoded form:" << std::endl << encoded );
3796
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
3809
This OPTIONS request contains SP characters between the SIP-Version
3810
field and the CRLF terminating the Request-Line.
3812
It is acceptable to reject this request as malformed. An element
3813
that is liberal in what it accepts may ignore these extra SP
3814
characters when processing the request. If the element forwards the
3815
request, it must not include these extra SP characters in the
3818
OPTIONS sip:remote-target@example.com SIP/2.0
3819
Via: SIP/2.0/TCP host1.examle.com;branch=z9hG4bK299342093
3820
To: <sip:remote-target@example.com>
3821
From: <sip:local-resource@example.com>;tag=329429089
3822
Call-ID: trws.oicu34958239neffasdhr2345r
3823
Accept: application/sdp
3824
CSeq: 238923 OPTIONS
3830
FILE* fid= fopen("trws.dat","r");
3837
result = fread(&mBuf,1,1024,fid);
3838
txt += resip::Data(mBuf,result);
3841
resip::SipMessage* msg = resip::SipMessage::make(txt);
3848
std::auto_ptr<resip::SipMessage> message(msg);
3849
msg->parseAllHeaders();
3851
resip::SipMessage copy(*msg);
3853
resip::Data encoded;
3855
resip::oDataStream str(encoded);
3858
resip::Data copyEncoded;
3860
resip::oDataStream str(copyEncoded);
3864
InfoLog(<< "In case trws:" );
3865
InfoLog(<< "Original text:" << std::endl << txt );
3866
InfoLog(<< "Encoded form:" << std::endl << encoded );
3867
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
3880
This INVITE is malformed, as the SIP Request-URI contains escaped
3883
It is acceptable for an element to reject this request with a 400 Bad
3884
Request. An element could choose to be liberal in what it accepts
3885
and ignore the escaped headers. If the element is a proxy, the
3886
escaped headers must not appear in the Request-URI of the forwarded
3887
request (and most certainly must not be translated into the actual
3888
header of the forwarded request).
3890
INVITE sip:user@example.com?Route=%3Csip:example.com%3E SIP/2.0
3891
To: sip:user@example.com
3892
From: sip:caller@example.net;tag=341518
3894
Contact: <sip:caller@host39923.example.net>
3895
Call-ID: escruri.23940-asdfhj-aje3br-234q098w-fawerh2q-h4n5
3896
CSeq: 149209342 INVITE
3897
Via: SIP/2.0/UDP host-of-the-hour.example.com;branch=z9hG4bKkdjuw
3898
Content-Type: application/sdp
3902
o=mhandley 29739 7272939 IN IP4 192.0.2.1
3906
m=audio 49217 RTP/AVP 0 12
3907
m=video 3227 RTP/AVP 31
3911
FILE* fid= fopen("escruri.dat","r");
3918
result = fread(&mBuf,1,1024,fid);
3919
txt += resip::Data(mBuf,result);
3922
resip::SipMessage* msg = resip::SipMessage::make(txt);
3929
std::auto_ptr<resip::SipMessage> message(msg);
3930
msg->parseAllHeaders();
3932
resip::SipMessage copy(*msg);
3934
resip::Data encoded;
3936
resip::oDataStream str(encoded);
3939
resip::Data copyEncoded;
3941
resip::oDataStream str(copyEncoded);
3945
InfoLog(<< "In case escruri:" );
3946
InfoLog(<< "Original text:" << std::endl << txt );
3947
InfoLog(<< "Encoded form:" << std::endl << encoded );
3948
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
3961
This INVITE is invalid, as it contains a non-GMT time zone in the SIP
3964
It is acceptable to reject this request as malformed (though an
3965
element shouldn't do that unless the contents of the Date header
3966
field were actually important to its processing). An element wishing
3967
to be liberal in what it accepts could ignore this value altogether
3968
if it wasn't going to use the Date header field anyway. Otherwise,
3969
it could attempt to interpret this date and adjust it to GMT.
3971
RFC 3261 explicitly defines the only acceptable time zone designation
3972
as "GMT". "UT", while synonymous with GMT per [RFC2822], is not
3973
valid. "UTC" and "UCT" are also invalid.
3975
INVITE sip:user@example.com SIP/2.0
3976
To: sip:user@example.com
3977
From: sip:caller@example.net;tag=2234923
3979
Call-ID: baddate.239423mnsadf3j23lj42--sedfnm234
3980
CSeq: 1392934 INVITE
3981
Via: SIP/2.0/UDP host.example.com;branch=z9hG4bKkdjuw
3982
Date: Fri, 01 Jan 2010 16:00:00 EST
3983
Contact: <sip:caller@host5.example.net>
3984
Content-Type: application/sdp
3988
o=mhandley 29739 7272939 IN IP4 192.0.2.5
3992
m=audio 49217 RTP/AVP 0 12
3993
m=video 3227 RTP/AVP 31
3997
FILE* fid= fopen("baddate.dat","r");
4004
result = fread(&mBuf,1,1024,fid);
4005
txt += resip::Data(mBuf,result);
4008
resip::SipMessage* msg = resip::SipMessage::make(txt);
4015
std::auto_ptr<resip::SipMessage> message(msg);
4016
msg->parseAllHeaders();
4018
resip::SipMessage copy(*msg);
4020
resip::Data encoded;
4022
resip::oDataStream str(encoded);
4025
resip::Data copyEncoded;
4027
resip::oDataStream str(copyEncoded);
4031
InfoLog(<< "In case baddate:" );
4032
InfoLog(<< "Original text:" << std::endl << txt );
4033
InfoLog(<< "Encoded form:" << std::endl << encoded );
4034
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
4047
This REGISTER request is malformed. The SIP URI contained in the
4048
Contact Header field has an escaped header, so the field must be in
4049
name-addr form (which implies that the URI must be enclosed in <>).
4051
It is reasonable for an element receiving this request to respond
4052
with a 400 Bad Request. An element choosing to be liberal in what it
4053
accepts could infer the angle brackets since there is no ambiguity in
4054
this example. In general, that won't be possible.
4056
REGISTER sip:example.com SIP/2.0
4057
To: sip:user@example.com
4058
From: sip:user@example.com;tag=998332
4060
Call-ID: regbadct.k345asrl3fdbv@10.0.0.1
4062
Via: SIP/2.0/UDP 135.180.130.133:5060;branch=z9hG4bKkdjuw
4063
Contact: sip:user@example.com?Route=%3Csip:sip.example.com%3E
4068
FILE* fid= fopen("regbadct.dat","r");
4075
result = fread(&mBuf,1,1024,fid);
4076
txt += resip::Data(mBuf,result);
4079
resip::SipMessage* msg = resip::SipMessage::make(txt);
4086
std::auto_ptr<resip::SipMessage> message(msg);
4087
msg->parseAllHeaders();
4089
resip::SipMessage copy(*msg);
4091
resip::Data encoded;
4093
resip::oDataStream str(encoded);
4096
resip::Data copyEncoded;
4098
resip::oDataStream str(copyEncoded);
4102
InfoLog(<< "In case regbadct:" );
4103
InfoLog(<< "Original text:" << std::endl << txt );
4104
InfoLog(<< "Encoded form:" << std::endl << encoded );
4105
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
4118
This request is malformed, since the addr-spec in the To header field
4119
contains spaces. Parsers receiving this request must not break. It
4120
is reasonable to reject this request with a 400 Bad Request response.
4121
Elements attempting to be liberal may ignore the spaces.
4123
OPTIONS sip:user@example.org SIP/2.0
4124
Via: SIP/2.0/UDP host4.example.com:5060;branch=z9hG4bKkdju43234
4126
From: "Bell, Alexander" <sip:a.g.bell@example.com>;tag=433423
4127
To: "Watson, Thomas" < sip:t.watson@example.org >
4128
Call-ID: badaspec.sdf0234n2nds0a099u23h3hnnw009cdkne3
4129
Accept: application/sdp
4130
CSeq: 3923239 OPTIONS
4135
FILE* fid= fopen("badaspec.dat","r");
4142
result = fread(&mBuf,1,1024,fid);
4143
txt += resip::Data(mBuf,result);
4146
resip::SipMessage* msg = resip::SipMessage::make(txt);
4153
std::auto_ptr<resip::SipMessage> message(msg);
4154
msg->parseAllHeaders();
4156
resip::SipMessage copy(*msg);
4158
resip::Data encoded;
4160
resip::oDataStream str(encoded);
4163
resip::Data copyEncoded;
4165
resip::oDataStream str(copyEncoded);
4171
InfoLog(<< "In case badaspec:" );
4172
InfoLog(<< "Original text:" << std::endl << txt );
4173
InfoLog(<< "Encoded form:" << std::endl << encoded );
4174
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
4187
This OPTIONS request is malformed, since the display names in the To
4188
and From header fields contain non-token characters but are unquoted.
4190
It is reasonable always to reject this kind of error with a 400 Bad
4193
An element may attempt to be liberal in what it receives and infer
4194
the missing quotes. If this element were a proxy, it must not
4195
propagate the error into the request it forwards. As a consequence,
4196
if the fields are covered by a signature, there's not much point in
4197
trying to be liberal - the message should simply be rejected.
4199
OPTIONS sip:t.watson@example.org SIP/2.0
4200
Via: SIP/2.0/UDP c.example.com:5060;branch=z9hG4bKkdjuw
4202
From: Bell, Alexander <sip:a.g.bell@example.com>;tag=43
4203
To: Watson, Thomas <sip:t.watson@example.org>
4204
Call-ID: baddn.31415@c.example.com
4205
Accept: application/sdp
4206
CSeq: 3923239 OPTIONS
4210
FILE* fid= fopen("baddn.dat","r");
4217
result = fread(&mBuf,1,1024,fid);
4218
txt += resip::Data(mBuf,result);
4221
resip::SipMessage* msg = resip::SipMessage::make(txt);
4228
std::auto_ptr<resip::SipMessage> message(msg);
4229
msg->parseAllHeaders();
4231
resip::SipMessage copy(*msg);
4233
resip::Data encoded;
4235
resip::oDataStream str(encoded);
4238
resip::Data copyEncoded;
4240
resip::oDataStream str(copyEncoded);
4244
InfoLog(<< "In case baddn:" );
4245
InfoLog(<< "Original text:" << std::endl << txt );
4246
InfoLog(<< "Encoded form:" << std::endl << encoded );
4247
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
4260
To an element implementing [RFC3261], this request is malformed due
4261
to its high version number.
4263
The element should respond to the request with a 505 Version Not
4266
OPTIONS sip:t.watson@example.org SIP/7.0
4267
Via: SIP/7.0/UDP c.example.com;branch=z9hG4bKkdjuw
4269
From: A. Bell <sip:a.g.bell@example.com>;tag=qweoiqpe
4270
To: T. Watson <sip:t.watson@example.org>
4271
Call-ID: badvers.31417@c.example.com
4277
FILE* fid= fopen("badvers.dat","r");
4284
result = fread(&mBuf,1,1024,fid);
4285
txt += resip::Data(mBuf,result);
4288
resip::SipMessage* msg = resip::SipMessage::make(txt);
4295
std::auto_ptr<resip::SipMessage> message(msg);
4296
msg->parseAllHeaders();
4298
resip::SipMessage copy(*msg);
4300
resip::Data encoded;
4302
resip::oDataStream str(encoded);
4305
resip::Data copyEncoded;
4307
resip::oDataStream str(copyEncoded);
4311
InfoLog(<< "In case badvers:" );
4312
InfoLog(<< "Original text:" << std::endl << txt );
4313
InfoLog(<< "Encoded form:" << std::endl << encoded );
4314
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
4327
This request has mismatching values for the method in the start line
4328
and the CSeq header field. Any element receiving this request will
4329
respond with a 400 Bad Request.
4331
OPTIONS sip:user@example.com SIP/2.0
4332
To: sip:j.user@example.com
4333
From: sip:caller@example.net;tag=34525
4335
Call-ID: mismatch01.dj0234sxdfl3
4337
Via: SIP/2.0/UDP host.example.com;branch=z9hG4bKkdjuw
4342
FILE* fid= fopen("mismatch01.dat","r");
4349
result = fread(&mBuf,1,1024,fid);
4350
txt += resip::Data(mBuf,result);
4353
resip::SipMessage* msg = resip::SipMessage::make(txt);
4360
std::auto_ptr<resip::SipMessage> message(msg);
4361
msg->parseAllHeaders();
4363
resip::SipMessage copy(*msg);
4365
resip::Data encoded;
4367
resip::oDataStream str(encoded);
4370
resip::Data copyEncoded;
4372
resip::oDataStream str(copyEncoded);
4376
InfoLog(<< "In case mismatch01:" );
4377
InfoLog(<< "Original text:" << std::endl << txt );
4378
InfoLog(<< "Encoded form:" << std::endl << encoded );
4379
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
4392
This message has an unknown method in the start line, and a CSeq
4393
method tag that does not match.
4395
Any element receiving this response should respond with a 501 Not
4396
Implemented. A 400 Bad Request is also acceptable, but choosing a
4397
501 (particularly at proxies) has better future-proof
4400
NEWMETHOD sip:user@example.com SIP/2.0
4401
To: sip:j.user@example.com
4402
From: sip:caller@example.net;tag=34525
4404
Call-ID: mismatch02.dj0234sxdfl3
4406
Contact: <sip:caller@host.example.net>
4407
Via: SIP/2.0/UDP host.example.net;branch=z9hG4bKkdjuw
4408
Content-Type: application/sdp
4412
o=mhandley 29739 7272939 IN IP4 192.0.2.1
4414
m=audio 49217 RTP/AVP 0 12
4415
m=video 3227 RTP/AVP 31
4419
FILE* fid= fopen("mismatch02.dat","r");
4426
result = fread(&mBuf,1,1024,fid);
4427
txt += resip::Data(mBuf,result);
4430
resip::SipMessage* msg = resip::SipMessage::make(txt);
4437
std::auto_ptr<resip::SipMessage> message(msg);
4438
msg->parseAllHeaders();
4440
resip::SipMessage copy(*msg);
4442
resip::Data encoded;
4444
resip::oDataStream str(encoded);
4447
resip::Data copyEncoded;
4449
resip::oDataStream str(copyEncoded);
4453
InfoLog(<< "In case mismatch02:" );
4454
InfoLog(<< "Original text:" << std::endl << txt );
4455
InfoLog(<< "Encoded form:" << std::endl << encoded );
4456
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
4469
This response has a response code larger than 699. An element
4470
receiving this response should simply drop it.
4472
SIP/2.0 4294967301 better not break the receiver
4473
Via: SIP/2.0/UDP 192.0.2.105;branch=z9hG4bK2398ndaoe
4474
Call-ID: bigcode.asdof3uj203asdnf3429uasdhfas3ehjasdfas9i
4476
From: <sip:user@example.com>;tag=39ansfi3
4477
To: <sip:user@example.edu>;tag=902jndnke3
4479
Contact: <sip:user@host105.example.com>
4483
FILE* fid= fopen("bigcode.dat","r");
4490
result = fread(&mBuf,1,1024,fid);
4491
txt += resip::Data(mBuf,result);
4494
resip::SipMessage* msg = resip::SipMessage::make(txt);
4501
std::auto_ptr<resip::SipMessage> message(msg);
4502
msg->parseAllHeaders();
4504
resip::SipMessage copy(*msg);
4506
resip::Data encoded;
4508
resip::oDataStream str(encoded);
4511
resip::Data copyEncoded;
4513
resip::oDataStream str(copyEncoded);
4517
InfoLog(<< "In case bigcode:" );
4518
InfoLog(<< "Original text:" << std::endl << txt );
4519
InfoLog(<< "Encoded form:" << std::endl << encoded );
4520
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
4533
This request indicates support for RFC 3261-style transaction
4534
identifiers by providing the z9hG4bK prefix to the branch parameter,
4535
but it provides no identifier. A parser must not break when
4536
receiving this message. An element receiving this request could
4537
reject the request with a 400 Response (preferably statelessly, as
4538
other requests from the source are likely also to have a malformed
4539
branch parameter), or it could fall back to the RFC 2543-style
4540
transaction identifier.
4542
OPTIONS sip:user@example.com SIP/2.0
4543
To: sip:user@example.com
4544
From: sip:caller@example.org;tag=33242
4546
Via: SIP/2.0/UDP 192.0.2.1;branch=z9hG4bK
4547
Accept: application/sdp
4548
Call-ID: badbranch.sadonfo23i420jv0as0derf3j3n
4554
FILE* fid= fopen("badbranch.dat","r");
4561
result = fread(&mBuf,1,1024,fid);
4562
txt += resip::Data(mBuf,result);
4565
resip::SipMessage* msg = resip::SipMessage::make(txt);
4574
std::auto_ptr<resip::SipMessage> message(msg);
4575
msg->parseAllHeaders();
4577
resip::SipMessage copy(*msg);
4579
resip::Data encoded;
4581
resip::oDataStream str(encoded);
4584
resip::Data copyEncoded;
4586
resip::oDataStream str(copyEncoded);
4591
//OPTIONS sip:user@example.com SIP/2.0
4592
tassert(msg->header(resip::h_RequestLine).method()==resip::OPTIONS);
4593
tassert(msg->header(resip::h_RequestLine).unknownMethodName()=="OPTIONS");
4594
tassert(msg->header(resip::h_RequestLine).uri().scheme()=="sip");
4595
tassert(msg->header(resip::h_RequestLine).uri().user()=="user");
4596
tassert(msg->header(resip::h_RequestLine).uri().password().empty());
4597
tassert(msg->header(resip::h_RequestLine).uri().host()=="example.com");
4598
tassert(msg->header(resip::h_RequestLine).uri().port()==0);
4599
tassert(!(msg->header(resip::h_RequestLine).uri().hasEmbedded()));
4600
tassert(msg->header(resip::h_RequestLine).uri().numKnownParams()==0);
4601
tassert(msg->header(resip::h_RequestLine).uri().numUnknownParams()==0);
4602
tassert(msg->header(resip::h_RequestLine).getSipVersion()=="SIP/2.0");
4604
//To: sip:user@example.com
4605
tassert(msg->exists(resip::h_To));
4606
tassert(msg->header(resip::h_To).displayName()=="");
4607
tassert(msg->header(resip::h_To).numKnownParams()==0);
4608
tassert(msg->header(resip::h_To).numUnknownParams()==0);
4609
tassert(!(msg->header(resip::h_To).isAllContacts()));
4610
tassert(msg->header(resip::h_To).uri().scheme()=="sip");
4611
tassert(msg->header(resip::h_To).uri().user()=="user");
4612
tassert(msg->header(resip::h_To).uri().password().empty());
4613
tassert(msg->header(resip::h_To).uri().host()=="example.com");
4614
tassert(msg->header(resip::h_To).uri().port()==0);
4615
tassert(!(msg->header(resip::h_To).uri().hasEmbedded()));
4616
tassert(msg->header(resip::h_To).uri().numKnownParams()==0);
4617
tassert(msg->header(resip::h_To).uri().numUnknownParams()==0);
4619
//From: sip:caller@example.org;tag=33242
4620
tassert(msg->exists(resip::h_From));
4621
tassert(msg->header(resip::h_From).displayName()=="");
4622
tassert(msg->header(resip::h_From).numKnownParams()==1);
4623
tassert(msg->header(resip::h_From).numUnknownParams()==0);
4624
tassert(msg->header(resip::h_From).exists(resip::p_tag));
4625
tassert(msg->header(resip::h_From).param(resip::p_tag)=="33242");
4626
tassert(!(msg->header(resip::h_From).isAllContacts()));
4627
tassert(msg->header(resip::h_From).uri().scheme()=="sip");
4628
tassert(msg->header(resip::h_From).uri().user()=="caller");
4629
tassert(msg->header(resip::h_From).uri().password().empty());
4630
tassert(msg->header(resip::h_From).uri().host()=="example.org");
4631
tassert(msg->header(resip::h_From).uri().port()==0);
4632
tassert(!(msg->header(resip::h_From).uri().hasEmbedded()));
4633
tassert(msg->header(resip::h_From).uri().numKnownParams()==0);
4634
tassert(msg->header(resip::h_From).uri().numUnknownParams()==0);
4637
tassert(msg->exists(resip::h_MaxForwards));
4638
tassert(msg->header(resip::h_MaxForwards).value()==3);
4639
tassert(msg->header(resip::h_MaxForwards).numKnownParams()==0);
4640
tassert(msg->header(resip::h_MaxForwards).numUnknownParams()==0);
4643
tassert(msg->exists(resip::h_Vias));
4644
tassert(msg->header(resip::h_Vias).size()==1);
4645
resip::ParserContainer<resip::Via>::iterator v=msg->header(resip::h_Vias).begin();
4647
//Via: SIP/2.0/UDP 192.0.2.1;branch=z9hG4bK
4648
tassert(v->numKnownParams()==1);
4649
tassert(v->numUnknownParams()==0);
4650
tassert(v->protocolName()=="SIP");
4651
tassert(v->protocolVersion()=="2.0");
4652
tassert(v->transport()=="UDP");
4653
tassert(v->sentHost()=="192.0.2.1");
4654
tassert(v->sentPort()==0);
4656
tassert(v->exists(resip::p_branch));
4657
tassert(v->param(resip::p_branch).hasMagicCookie());
4658
tassert(v->param(resip::p_branch).getTransactionId()=="");
4659
tassert(v->param(resip::p_branch).clientData().empty());
4661
//Accept: application/sdp
4662
tassert(msg->exists(resip::h_Accepts));
4663
tassert(msg->header(resip::h_Accepts).size()==1);
4665
resip::Mimes::iterator a=msg->header(resip::h_Accepts).begin();
4667
tassert(a->type()=="application");
4668
tassert(a->subType()=="sdp");
4669
tassert(a->numKnownParams()==0);
4670
tassert(a->numUnknownParams()==0);
4672
//Call-ID: badbranch.sadonfo23i420jv0as0derf3j3n
4673
tassert(msg->exists(resip::h_CallID));
4674
tassert(msg->header(resip::h_CallID).value()=="badbranch.sadonfo23i420jv0as0derf3j3n");
4675
tassert(msg->header(resip::h_CallID).numKnownParams()==0);
4676
tassert(msg->header(resip::h_CallID).numUnknownParams()==0);
4679
tassert(msg->exists(resip::h_CSeq));
4680
tassert(msg->header(resip::h_CSeq).method()==resip::OPTIONS);
4681
tassert(msg->header(resip::h_CSeq).unknownMethodName()=="OPTIONS");
4682
tassert(msg->header(resip::h_CSeq).sequence()==8);
4683
tassert(msg->header(resip::h_CSeq).numKnownParams()==0);
4684
tassert(msg->header(resip::h_CSeq).numUnknownParams()==0);
4687
tassert(msg->exists(resip::h_ContentLength));
4688
tassert(msg->header(resip::h_ContentLength).value()==0);
4689
tassert(msg->header(resip::h_ContentLength).numKnownParams()==0);
4690
tassert(msg->header(resip::h_ContentLength).numUnknownParams()==0);
4693
InfoLog(<< "In case badbranch:" );
4694
InfoLog(<< "Original text:" << std::endl << txt );
4695
InfoLog(<< "Encoded form:" << std::endl << encoded );
4696
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
4710
Via: SIP/2.0/UDP 192.0.2.198;branch=z9hG4bK1324923
4711
Via: SIP/2.0/UDP 255.255.255.255;branch=z9hG4bK1saber23
4712
Call-ID: bcast.0384840201234ksdfak3j2erwedfsASdf
4714
From: sip:user@example.com;tag=11141343
4715
To: sip:user@example.edu;tag=2229
4717
Content-Type: application/sdp
4718
Contact: <sip:user@host28.example.com>
4721
o=mhandley 29739 7272939 IN IP4 192.0.2.198
4723
c=IN IP4 192.0.2.198
4725
m=audio 49217 RTP/AVP 0 12
4726
m=video 3227 RTP/AVP 31
4730
FILE* fid= fopen("bcast.dat","r");
4737
result = fread(&mBuf,1,1024,fid);
4738
txt += resip::Data(mBuf,result);
4741
resip::SipMessage* msg = resip::SipMessage::make(txt);
4750
std::auto_ptr<resip::SipMessage> message(msg);
4751
msg->parseAllHeaders();
4753
resip::SipMessage copy(*msg);
4755
resip::Data encoded;
4757
resip::oDataStream str(encoded);
4760
resip::Data copyEncoded;
4762
resip::oDataStream str(copyEncoded);
4766
InfoLog(<< "In case bcast:" );
4767
InfoLog(<< "Original text:" << std::endl << txt );
4768
InfoLog(<< "Encoded form:" << std::endl << encoded );
4769
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
4782
OPTIONS sip:user@example.com SIP/2.0
4783
To: sip:j_user@example.com
4784
From: sip:caller@example.net;tag=242etr
4786
Call-ID: bext01.0ha0isndaksdj
4787
Require: nothingSupportsThis, nothingSupportsThisEither
4788
Proxy-Require: noProxiesSupportThis, norDoAnyProxiesSupportThis
4790
Via: SIP/2.0/TLS fold-and-staple.example.com;branch=z9hG4bKkdjuw
4795
FILE* fid= fopen("bext01.dat","r");
4802
result = fread(&mBuf,1,1024,fid);
4803
txt += resip::Data(mBuf,result);
4806
resip::SipMessage* msg = resip::SipMessage::make(txt);
4815
std::auto_ptr<resip::SipMessage> message(msg);
4816
msg->parseAllHeaders();
4818
resip::SipMessage copy(*msg);
4820
resip::Data encoded;
4822
resip::oDataStream str(encoded);
4825
resip::Data copyEncoded;
4827
resip::oDataStream str(copyEncoded);
4831
InfoLog(<< "In case bext01:" );
4832
InfoLog(<< "Original text:" << std::endl << txt );
4833
InfoLog(<< "Encoded form:" << std::endl << encoded );
4834
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
4847
REGISTER sip:example.com SIP/2.0
4848
Via: SIP/2.0/UDP saturn.example.com:5060;branch=z9hG4bKkdjuw
4850
From: sip:watson@example.com;tag=DkfVgjkrtMwaerKKpe
4851
To: sip:watson@example.com
4852
Call-ID: cparam01.70710@saturn.example.com
4854
Contact: sip:+19725552222@gw1.example.net;unknownparam
4859
FILE* fid= fopen("cparam01.dat","r");
4866
result = fread(&mBuf,1,1024,fid);
4867
txt += resip::Data(mBuf,result);
4870
resip::SipMessage* msg = resip::SipMessage::make(txt);
4879
std::auto_ptr<resip::SipMessage> message(msg);
4880
msg->parseAllHeaders();
4882
resip::SipMessage copy(*msg);
4884
resip::Data encoded;
4886
resip::oDataStream str(encoded);
4889
resip::Data copyEncoded;
4891
resip::oDataStream str(copyEncoded);
4895
InfoLog(<< "In case cparam01:" );
4896
InfoLog(<< "Original text:" << std::endl << txt );
4897
InfoLog(<< "Encoded form:" << std::endl << encoded );
4898
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
4911
REGISTER sip:example.com SIP/2.0
4912
Via: SIP/2.0/UDP saturn.example.com:5060;branch=z9hG4bKkdjuw
4914
From: sip:watson@example.com;tag=838293
4915
To: sip:watson@example.com
4916
Call-ID: cparam02.70710@saturn.example.com
4918
Contact: <sip:+19725552222@gw1.example.net;unknownparam>
4923
FILE* fid= fopen("cparam02.dat","r");
4930
result = fread(&mBuf,1,1024,fid);
4931
txt += resip::Data(mBuf,result);
4934
resip::SipMessage* msg = resip::SipMessage::make(txt);
4943
std::auto_ptr<resip::SipMessage> message(msg);
4944
msg->parseAllHeaders();
4946
resip::SipMessage copy(*msg);
4948
resip::Data encoded;
4950
resip::oDataStream str(encoded);
4953
resip::Data copyEncoded;
4955
resip::oDataStream str(copyEncoded);
4959
InfoLog(<< "In case cparam02:" );
4960
InfoLog(<< "Original text:" << std::endl << txt );
4961
InfoLog(<< "Encoded form:" << std::endl << encoded );
4962
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
4975
INVITE sip:user@example.com SIP/2.0
4977
Via: SIP/2.0/UDP 192.0.2.95;branch=z9hG4bKkdj.insuf
4978
Content-Type: application/sdp
4982
o=mhandley 29739 7272939 IN IP4 192.0.2.95
4986
m=audio 49217 RTP/AVP 0 12
4987
m=video 3227 RTP/AVP 31
4991
FILE* fid= fopen("insuf.dat","r");
4998
result = fread(&mBuf,1,1024,fid);
4999
txt += resip::Data(mBuf,result);
5002
resip::SipMessage* msg = resip::SipMessage::make(txt);
5011
std::auto_ptr<resip::SipMessage> message(msg);
5012
msg->parseAllHeaders();
5014
resip::SipMessage copy(*msg);
5016
resip::Data encoded;
5018
resip::oDataStream str(encoded);
5021
resip::Data copyEncoded;
5023
resip::oDataStream str(copyEncoded);
5027
InfoLog(<< "In case insuf:" );
5028
InfoLog(<< "Original text:" << std::endl << txt );
5029
InfoLog(<< "Encoded form:" << std::endl << encoded );
5030
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
5043
INVITE sip:UserB@example.com SIP/2.0
5044
Via: SIP/2.0/UDP iftgw.example.com
5045
From: <sip:+13035551111@ift.client.example.net;user=phone>
5046
Record-Route: <sip:UserB@example.com;maddr=ss1.example.com>
5047
To: sip:+16505552222@ss1.example.net;user=phone
5048
Call-ID: inv2543.1717@ift.client.example.com
5050
Content-Type: application/sdp
5053
o=mhandley 29739 7272939 IN IP4 192.0.2.5
5057
m=audio 49217 RTP/AVP 0
5060
FILE* fid= fopen("inv2543.dat","r");
5067
result = fread(&mBuf,1,1024,fid);
5068
txt += resip::Data(mBuf,result);
5071
resip::SipMessage* msg = resip::SipMessage::make(txt);
5080
std::auto_ptr<resip::SipMessage> message(msg);
5081
msg->parseAllHeaders();
5083
resip::SipMessage copy(*msg);
5085
resip::Data encoded;
5087
resip::oDataStream str(encoded);
5090
resip::Data copyEncoded;
5092
resip::oDataStream str(copyEncoded);
5096
InfoLog(<< "In case inv2543:" );
5097
InfoLog(<< "Original text:" << std::endl << txt );
5098
InfoLog(<< "Encoded form:" << std::endl << encoded );
5099
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
5112
INVITE sip:user@example.com SIP/2.0
5113
Contact: <sip:caller@host5.example.net>
5114
To: sip:j.user@example.com
5115
From: sip:caller@example.net;tag=8392034
5117
Call-ID: invut.0ha0isndaksdjadsfij34n23d
5119
Via: SIP/2.0/UDP somehost.example.com;branch=z9hG4bKkdjuw
5120
Content-Type: application/unknownformat
5128
FILE* fid= fopen("invut.dat","r");
5135
result = fread(&mBuf,1,1024,fid);
5136
txt += resip::Data(mBuf,result);
5139
resip::SipMessage* msg = resip::SipMessage::make(txt);
5148
std::auto_ptr<resip::SipMessage> message(msg);
5149
msg->parseAllHeaders();
5151
resip::SipMessage copy(*msg);
5153
resip::Data encoded;
5155
resip::oDataStream str(encoded);
5158
resip::Data copyEncoded;
5160
resip::oDataStream str(copyEncoded);
5164
InfoLog(<< "In case invut:" );
5165
InfoLog(<< "Original text:" << std::endl << txt );
5166
InfoLog(<< "Encoded form:" << std::endl << encoded );
5167
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
5180
OPTIONS sip:user@example.com SIP/2.0
5181
Via: SIP/2.0/UDP host5.example.net;branch=z9hG4bK293423
5182
To: sip:user@example.com
5183
From: sip:other@example.net;tag=3923942
5184
Call-ID: mcl01.fhn2323orihawfdoa3o4r52o3irsdf
5189
Content-Type: text/plain
5191
There's no way to know how many octets are supposed to be here.
5195
FILE* fid= fopen("mcl01.dat","r");
5202
result = fread(&mBuf,1,1024,fid);
5203
txt += resip::Data(mBuf,result);
5206
resip::SipMessage* msg = resip::SipMessage::make(txt);
5215
std::auto_ptr<resip::SipMessage> message(msg);
5216
msg->parseAllHeaders();
5218
resip::SipMessage copy(*msg);
5220
resip::Data encoded;
5222
resip::oDataStream str(encoded);
5225
resip::Data copyEncoded;
5227
resip::oDataStream str(copyEncoded);
5231
InfoLog(<< "In case mcl01:" );
5232
InfoLog(<< "Original text:" << std::endl << txt );
5233
InfoLog(<< "Encoded form:" << std::endl << encoded );
5234
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
5247
INVITE sip:user@company.com SIP/2.0
5248
Contact: <sip:caller@host25.example.net>
5249
Via: SIP/2.0/UDP 192.0.2.25;branch=z9hG4bKkdjuw
5252
Call-ID: multi01.98asdh@192.0.2.1
5254
Call-ID: multi01.98asdh@192.0.2.2
5255
From: sip:caller@example.com;tag=3413415
5256
To: sip:user@example.com
5257
To: sip:other@example.net
5258
From: sip:caller@example.net;tag=2923420123
5259
Content-Type: application/sdp
5261
Contact: <sip:caller@host36.example.net>
5265
o=mhandley 29739 7272939 IN IP4 192.0.2.25
5269
m=audio 49217 RTP/AVP 0 12
5270
m=video 3227 RTP/AVP 31
5275
FILE* fid= fopen("multi01.dat","r");
5282
result = fread(&mBuf,1,1024,fid);
5283
txt += resip::Data(mBuf,result);
5286
resip::SipMessage* msg = resip::SipMessage::make(txt);
5295
std::auto_ptr<resip::SipMessage> message(msg);
5296
msg->parseAllHeaders();
5298
resip::SipMessage copy(*msg);
5300
resip::Data encoded;
5302
resip::oDataStream str(encoded);
5305
resip::Data copyEncoded;
5307
resip::oDataStream str(copyEncoded);
5311
InfoLog(<< "In case multi01:" );
5312
InfoLog(<< "Original text:" << std::endl << txt );
5313
InfoLog(<< "Encoded form:" << std::endl << encoded );
5314
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
5327
OPTIONS soap.beep://192.0.2.103:3002 SIP/2.0
5328
To: sip:user@example.com
5329
From: sip:caller@example.net;tag=384
5331
Call-ID: novelsc.asdfasser0q239nwsdfasdkl34
5332
CSeq: 3923423 OPTIONS
5333
Via: SIP/2.0/TCP host9.example.com;branch=z9hG4bKkdjuw39234
5338
FILE* fid= fopen("novelsc.dat","r");
5345
result = fread(&mBuf,1,1024,fid);
5346
txt += resip::Data(mBuf,result);
5349
resip::SipMessage* msg = resip::SipMessage::make(txt);
5358
std::auto_ptr<resip::SipMessage> message(msg);
5359
msg->parseAllHeaders();
5361
resip::SipMessage copy(*msg);
5363
resip::Data encoded;
5365
resip::oDataStream str(encoded);
5368
resip::Data copyEncoded;
5370
resip::oDataStream str(copyEncoded);
5374
InfoLog(<< "In case novelsc:" );
5375
InfoLog(<< "Original text:" << std::endl << txt );
5376
InfoLog(<< "Encoded form:" << std::endl << encoded );
5377
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
5390
REGISTER sip:example.com SIP/2.0
5391
To: sip:j.user@example.com
5392
From: sip:j.user@example.com;tag=87321hj23128
5394
Call-ID: regaut01.0ha0isndaksdj
5396
Via: SIP/2.0/TCP 192.0.2.253;branch=z9hG4bKkdjuw
5397
Authorization: NoOneKnowsThisScheme opaque-data=here
5402
FILE* fid= fopen("regaut01.dat","r");
5409
result = fread(&mBuf,1,1024,fid);
5410
txt += resip::Data(mBuf,result);
5413
resip::SipMessage* msg = resip::SipMessage::make(txt);
5422
std::auto_ptr<resip::SipMessage> message(msg);
5423
msg->parseAllHeaders();
5425
resip::SipMessage copy(*msg);
5427
resip::Data encoded;
5429
resip::oDataStream str(encoded);
5432
resip::Data copyEncoded;
5434
resip::oDataStream str(copyEncoded);
5438
InfoLog(<< "In case regaut01:" );
5439
InfoLog(<< "Original text:" << std::endl << txt );
5440
InfoLog(<< "Encoded form:" << std::endl << encoded );
5441
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
5454
REGISTER sip:example.com SIP/2.0
5455
To: sip:user@example.com
5456
From: sip:user@example.com;tag=8
5458
Call-ID: regescrt.k345asrl3fdbv@192.0.2.1
5459
CSeq: 14398234 REGISTER
5460
Via: SIP/2.0/UDP host5.example.com;branch=z9hG4bKkdjuw
5461
M: <sip:user@example.com?Route=%3Csip:sip.example.com%3E>
5466
FILE* fid= fopen("regescrt.dat","r");
5473
result = fread(&mBuf,1,1024,fid);
5474
txt += resip::Data(mBuf,result);
5477
resip::SipMessage* msg = resip::SipMessage::make(txt);
5486
std::auto_ptr<resip::SipMessage> message(msg);
5487
msg->parseAllHeaders();
5489
resip::SipMessage copy(*msg);
5491
resip::Data encoded;
5493
resip::oDataStream str(encoded);
5496
resip::Data copyEncoded;
5498
resip::oDataStream str(copyEncoded);
5502
InfoLog(<< "In case regescrt:" );
5503
InfoLog(<< "Original text:" << std::endl << txt );
5504
InfoLog(<< "Encoded form:" << std::endl << encoded );
5505
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
5518
INVITE sip:user@example.com SIP/2.0
5519
To: sip:j_user@example.com
5520
Contact: <sip:caller@host15.example.net>
5521
From: sip:caller@example.net;tag=234
5523
Call-ID: sdp01.ndaksdj9342dasdd
5524
Accept: text/nobodyKnowsThis
5526
Via: SIP/2.0/UDP 192.0.2.15;branch=z9hG4bKkdjuw
5528
Content-Type: application/sdp
5531
o=mhandley 29739 7272939 IN IP4 192.0.2.5
5535
m=audio 49217 RTP/AVP 0 12
5536
m=video 3227 RTP/AVP 31
5540
FILE* fid= fopen("sdp01.dat","r");
5547
result = fread(&mBuf,1,1024,fid);
5548
txt += resip::Data(mBuf,result);
5551
resip::SipMessage* msg = resip::SipMessage::make(txt);
5560
std::auto_ptr<resip::SipMessage> message(msg);
5561
msg->parseAllHeaders();
5563
resip::SipMessage copy(*msg);
5565
resip::Data encoded;
5567
resip::oDataStream str(encoded);
5570
resip::Data copyEncoded;
5572
resip::oDataStream str(copyEncoded);
5576
InfoLog(<< "In case sdp01:" );
5577
InfoLog(<< "Original text:" << std::endl << txt );
5578
InfoLog(<< "Encoded form:" << std::endl << encoded );
5579
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
5592
OPTIONS nobodyKnowsThisScheme:totallyopaquecontent SIP/2.0
5593
To: sip:user@example.com
5594
From: sip:caller@example.net;tag=384
5596
Call-ID: unkscm.nasdfasser0q239nwsdfasdkl34
5597
CSeq: 3923423 OPTIONS
5598
Via: SIP/2.0/TCP host9.example.com;branch=z9hG4bKkdjuw39234
5603
FILE* fid= fopen("unkscm.dat","r");
5610
result = fread(&mBuf,1,1024,fid);
5611
txt += resip::Data(mBuf,result);
5614
resip::SipMessage* msg = resip::SipMessage::make(txt);
5623
std::auto_ptr<resip::SipMessage> message(msg);
5624
msg->parseAllHeaders();
5626
resip::SipMessage copy(*msg);
5628
resip::Data encoded;
5630
resip::oDataStream str(encoded);
5633
resip::Data copyEncoded;
5635
resip::oDataStream str(copyEncoded);
5639
InfoLog(<< "In case unkscm:" );
5640
InfoLog(<< "Original text:" << std::endl << txt );
5641
InfoLog(<< "Encoded form:" << std::endl << encoded );
5642
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
5655
REGISTER sip:example.com SIP/2.0
5657
From: <http://www.example.com>;tag=3234233
5658
Call-ID: unksm2.daksdj@hyphenated-host.example.com
5659
CSeq: 234902 REGISTER
5661
Via: SIP/2.0/UDP 192.0.2.21:5060;branch=z9hG4bKkdjuw
5662
Contact: <name:John_Smith>
5667
FILE* fid= fopen("unksm2.dat","r");
5674
result = fread(&mBuf,1,1024,fid);
5675
txt += resip::Data(mBuf,result);
5678
resip::SipMessage* msg = resip::SipMessage::make(txt);
5687
std::auto_ptr<resip::SipMessage> message(msg);
5688
msg->parseAllHeaders();
5690
resip::SipMessage copy(*msg);
5692
resip::Data encoded;
5694
resip::oDataStream str(encoded);
5697
resip::Data copyEncoded;
5699
resip::oDataStream str(copyEncoded);
5703
InfoLog(<< "In case unksm2:" );
5704
InfoLog(<< "Original text:" << std::endl << txt );
5705
InfoLog(<< "Encoded form:" << std::endl << encoded );
5706
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
5719
OPTIONS sip:user@example.com SIP/2.0
5720
To: sip:user@example.com
5721
From: sip:caller@example.net;tag=3ghsd41
5722
Call-ID: zeromf.jfasdlfnm2o2l43r5u0asdfas
5723
CSeq: 39234321 OPTIONS
5724
Via: SIP/2.0/UDP host1.example.com;branch=z9hG4bKkdjuw2349i
5730
FILE* fid= fopen("zeromf.dat","r");
5737
result = fread(&mBuf,1,1024,fid);
5738
txt += resip::Data(mBuf,result);
5741
resip::SipMessage* msg = resip::SipMessage::make(txt);
5750
std::auto_ptr<resip::SipMessage> message(msg);
5751
msg->parseAllHeaders();
5753
resip::SipMessage copy(*msg);
5755
resip::Data encoded;
5757
resip::oDataStream str(encoded);
5760
resip::Data copyEncoded;
5762
resip::oDataStream str(copyEncoded);
5766
InfoLog(<< "In case zeromf:" );
5767
InfoLog(<< "Original text:" << std::endl << txt );
5768
InfoLog(<< "Encoded form:" << std::endl << encoded );
5769
InfoLog(<< "Encoded form of copy:" << std::endl << copyEncoded );
5780
resip::SipMessage::checkContentLength=true;
5782
resip::Log::initialize("cout", "DEBUG", "RFC4475TortureTests");
5787
catch(resip::BaseException& e)
5791
InfoLog(<< "Exception caught in test case wsinv : " << e );
5792
InfoLog(<< "This message was valid." );
5800
catch(resip::BaseException& e)
5804
InfoLog(<< "Exception caught in test case intmeth : " << e );
5805
InfoLog(<< "This message was valid." );
5813
catch(resip::BaseException& e)
5817
InfoLog(<< "Exception caught in test case esc01 : " << e );
5818
InfoLog(<< "This message was valid." );
5826
catch(resip::BaseException& e)
5830
InfoLog(<< "Exception caught in test case escnull : " << e );
5831
InfoLog(<< "This message was valid." );
5839
catch(resip::BaseException& e)
5843
InfoLog(<< "Exception caught in test case esc02 : " << e );
5844
InfoLog(<< "This message was valid." );
5852
catch(resip::BaseException& e)
5856
InfoLog(<< "Exception caught in test case lwsdisp : " << e );
5857
InfoLog(<< "This message was valid." );
5865
catch(resip::BaseException& e)
5869
InfoLog(<< "Exception caught in test case longreq : " << e );
5870
InfoLog(<< "This message was valid." );
5878
catch(resip::BaseException& e)
5882
InfoLog(<< "Exception caught in test case dblreq : " << e );
5883
InfoLog(<< "This message was valid." );
5891
catch(resip::BaseException& e)
5895
InfoLog(<< "Exception caught in test case semiuri : " << e );
5896
InfoLog(<< "This message was valid." );
5904
catch(resip::BaseException& e)
5908
InfoLog(<< "Exception caught in test case transports : " << e );
5909
InfoLog(<< "This message was valid." );
5917
catch(resip::BaseException& e)
5921
InfoLog(<< "Exception caught in test case mpart01 : " << e );
5922
InfoLog(<< "This message was valid." );
5930
catch(resip::BaseException& e)
5934
InfoLog(<< "Exception caught in test case unreason : " << e );
5935
InfoLog(<< "This message was valid." );
5943
catch(resip::BaseException& e)
5947
InfoLog(<< "Exception caught in test case noreason : " << e );
5948
InfoLog(<< "This message was valid." );
5956
catch(resip::BaseException& e)
5958
InfoLog(<< "Exception caught in test case badinv01 : " << e );
5959
InfoLog(<< "This message wasn't valid." );
5967
catch(resip::BaseException& e)
5969
InfoLog(<< "Exception caught in test case clerr : " << e );
5970
InfoLog(<< "This message wasn't valid." );
5978
catch(resip::BaseException& e)
5980
InfoLog(<< "Exception caught in test case scalar02 : " << e );
5981
InfoLog(<< "This message wasn't valid." );
5989
catch(resip::BaseException& e)
5991
InfoLog(<< "Exception caught in test case scalarlg : " << e );
5992
InfoLog(<< "This message wasn't valid." );
6000
catch(resip::BaseException& e)
6002
InfoLog(<< "Exception caught in test case quotbal : " << e );
6003
InfoLog(<< "This message wasn't valid." );
6011
catch(resip::BaseException& e)
6013
InfoLog(<< "Exception caught in test case ltgtruri : " << e );
6014
InfoLog(<< "This message wasn't valid." );
6022
catch(resip::BaseException& e)
6024
InfoLog(<< "Exception caught in test case lwsruri : " << e );
6025
InfoLog(<< "This message wasn't valid." );
6033
catch(resip::BaseException& e)
6035
InfoLog(<< "Exception caught in test case lwsstart : " << e );
6036
InfoLog(<< "This message wasn't valid." );
6044
catch(resip::BaseException& e)
6046
InfoLog(<< "Exception caught in test case trws : " << e );
6047
InfoLog(<< "This message wasn't valid." );
6055
catch(resip::BaseException& e)
6057
InfoLog(<< "Exception caught in test case escruri : " << e );
6058
InfoLog(<< "This message wasn't valid." );
6066
catch(resip::BaseException& e)
6068
InfoLog(<< "Exception caught in test case baddate : " << e );
6069
InfoLog(<< "This message wasn't valid." );
6077
catch(resip::BaseException& e)
6079
InfoLog(<< "Exception caught in test case regbadct : " << e );
6080
InfoLog(<< "This message wasn't valid." );
6088
catch(resip::BaseException& e)
6090
InfoLog(<< "Exception caught in test case badaspec : " << e );
6091
InfoLog(<< "This message wasn't valid." );
6099
catch(resip::BaseException& e)
6101
InfoLog(<< "Exception caught in test case baddn : " << e );
6102
InfoLog(<< "This message wasn't valid." );
6110
catch(resip::BaseException& e)
6112
InfoLog(<< "Exception caught in test case badvers : " << e );
6113
InfoLog(<< "This message wasn't valid." );
6121
catch(resip::BaseException& e)
6123
InfoLog(<< "Exception caught in test case mismatch01 : " << e );
6124
InfoLog(<< "This message wasn't valid." );
6132
catch(resip::BaseException& e)
6134
InfoLog(<< "Exception caught in test case mismatch02 : " << e );
6135
InfoLog(<< "This message wasn't valid." );
6143
catch(resip::BaseException& e)
6145
InfoLog(<< "Exception caught in test case bigcode : " << e );
6146
InfoLog(<< "This message wasn't valid." );
6154
catch(resip::BaseException& e)
6158
InfoLog(<< "Exception caught in test case badbranch : " << e );
6159
InfoLog(<< "This message was (syntactically) valid." );
6167
catch(resip::BaseException& e)
6169
InfoLog(<< "Exception caught in test case bcast : " << e );
6170
InfoLog(<< "This message was/wasn't valid." );
6178
catch(resip::BaseException& e)
6180
InfoLog(<< "Exception caught in test case bext01 : " << e );
6181
InfoLog(<< "This message was/wasn't valid." );
6189
catch(resip::BaseException& e)
6191
InfoLog(<< "Exception caught in test case cparam01 : " << e );
6192
InfoLog(<< "This message was/wasn't valid." );
6200
catch(resip::BaseException& e)
6202
InfoLog(<< "Exception caught in test case cparam02 : " << e );
6203
InfoLog(<< "This message was/wasn't valid." );
6211
catch(resip::BaseException& e)
6213
InfoLog(<< "Exception caught in test case insuf : " << e );
6214
InfoLog(<< "This message was/wasn't valid." );
6222
catch(resip::BaseException& e)
6224
InfoLog(<< "Exception caught in test case inv2543 : " << e );
6225
InfoLog(<< "This message was/wasn't valid." );
6233
catch(resip::BaseException& e)
6235
InfoLog(<< "Exception caught in test case invut : " << e );
6236
InfoLog(<< "This message was/wasn't valid." );
6244
catch(resip::BaseException& e)
6246
InfoLog(<< "Exception caught in test case mcl01 : " << e );
6247
InfoLog(<< "This message was/wasn't valid." );
6255
catch(resip::BaseException& e)
6257
InfoLog(<< "Exception caught in test case multi01 : " << e );
6258
InfoLog(<< "This message was/wasn't valid." );
6266
catch(resip::BaseException& e)
6268
InfoLog(<< "Exception caught in test case ncl : " << e );
6269
InfoLog(<< "This message wasn't valid." );
6277
catch(resip::BaseException& e)
6279
InfoLog(<< "Exception caught in test case novelsc : " << e );
6280
InfoLog(<< "This message was/wasn't valid." );
6288
catch(resip::BaseException& e)
6290
InfoLog(<< "Exception caught in test case regaut01 : " << e );
6291
InfoLog(<< "This message was/wasn't valid." );
6299
catch(resip::BaseException& e)
6301
InfoLog(<< "Exception caught in test case regescrt : " << e );
6302
InfoLog(<< "This message was/wasn't valid." );
6310
catch(resip::BaseException& e)
6312
InfoLog(<< "Exception caught in test case sdp01 : " << e );
6313
InfoLog(<< "This message was/wasn't valid." );
6321
catch(resip::BaseException& e)
6323
InfoLog(<< "Exception caught in test case unkscm : " << e );
6324
InfoLog(<< "This message was/wasn't valid." );
6332
catch(resip::BaseException& e)
6334
InfoLog(<< "Exception caught in test case unksm2 : " << e );
6335
InfoLog(<< "This message was/wasn't valid." );
6343
catch(resip::BaseException& e)
6345
InfoLog(<< "Exception caught in test case zeromf : " << e );
6346
InfoLog(<< "This message was/wasn't valid." );
6352
/* ====================================================================
6353
* The Vovida Software License, Version 1.0
6355
* Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
6357
* Redistribution and use in source and binary forms, with or without
6358
* modification, are permitted provided that the following conditions
6361
* 1. Redistributions of source code must retain the above copyright
6362
* notice, this list of conditions and the following disclaimer.
6364
* 2. Redistributions in binary form must reproduce the above copyright
6365
* notice, this list of conditions and the following disclaimer in
6366
* the documentation and/or other materials provided with the
6369
* 3. The names "VOCAL", "Vovida Open Communication Application Library",
6370
* and "Vovida Open Communication Application Library (VOCAL)" must
6371
* not be used to endorse or promote products derived from this
6372
* software without prior written permission. For written
6373
* permission, please contact vocal@vovida.org.
6375
* 4. Products derived from this software may not be called "VOCAL", nor
6376
* may "VOCAL" appear in their name, without prior written
6377
* permission of Vovida Networks, Inc.
6379
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
6380
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
6381
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
6382
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
6383
* NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
6384
* IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
6385
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
6386
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
6387
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
6388
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
6389
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
6390
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
6393
* ====================================================================
6395
* This software consists of voluntary contributions made by Vovida
6396
* Networks, Inc. and many individuals on behalf of Vovida Networks,
6397
* Inc. For more information on Vovida Networks, Inc., please see
6398
* <http://www.vovida.org/>.