File: testEmptyHfv.cxx

package info (click to toggle)
resiprocate 1%3A1.11.0~beta1-3%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 37,944 kB
  • sloc: cpp: 206,325; xml: 12,515; sh: 12,418; ansic: 6,973; makefile: 2,315; php: 1,150; python: 355; sql: 142; objc: 91; perl: 21; csh: 5
file content (48 lines) | stat: -rw-r--r-- 1,090 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "resip/stack/SipMessage.hxx"
#include "resip/stack/HeaderTypes.hxx"

#include "rutil/Log.hxx"

#include <iostream>

using namespace std;
using namespace resip;


#define RESIPROCATE_SUBSYSTEM Subsystem::SIP


int main()
{
   Log::initialize(Log::Cout, Log::Debug ,"testEmptyHfv");   
   resip::Data msg("INVITE sip:foo@bar SIP/2.0\r\n"
                     "Via:\r\n"
                     "From:\r\n"
                     "To:\r\n"
                     "CSeq:\r\n"
                     "Call-ID:\r\n"
                     "Max-Forwards:\r\n"
                   "Content-Length:\r\n\r\n\r\n");
                     
   resip::SipMessage* sip=resip::SipMessage::make(msg);
   
   assert(sip);
   
   try
   {
      if(sip->exists(resip::h_From))
      {
         sip->header(resip::h_From);
         cerr << sip->header(resip::h_From).uri();         
         cerr << "test failed" << endl;
         
         assert(0);         
         return -1;         
      }
   }
   catch(resip::BaseException& e)
   {
      cerr << "Caught: " << e << "as expected, PASSED" << endl;
   }

}