/[resiprocate]/main/resip/dum/test/limpc.cxx
ViewVC logotype

Annotation of /main/resip/dum/test/limpc.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7265 - (hide annotations) (download)
Tue Sep 25 21:44:52 2007 UTC (12 years, 1 month ago) by bcampen
File MIME type: text/plain
File size: 3945 byte(s)
Proper shutdown for limpc (nothing was getting destroyed like it should).

1 jason 4076 #if defined(HAVE_CONFIG_HXX)
2 derek 5283 #include "resip/stack/config.hxx"
3 jason 4076 #endif
4    
5     #include <cstring>
6     #include <cassert>
7    
8     #ifndef __APPLE__
9     bool TRUE=true;
10     bool FALSE=false;
11     #endif
12    
13 jason 4383 #include "UserAgent.hxx"
14 derek 5283 #include "resip/stack/Security.hxx"
15     #include "resip/stack/SipStack.hxx"
16     #include "resip/stack/Uri.hxx"
17 jason 5276 #include "rutil/Logger.hxx"
18 jason 4076
19 bcampen 7265 #include <signal.h>
20    
21 jason 4076 using namespace resip;
22     using namespace std;
23    
24     #define RESIPROCATE_SUBSYSTEM Subsystem::SIP
25    
26 bcampen 7265 static bool finished = false;
27    
28     static void
29     signalHandler(int signo)
30     {
31     std::cerr << "Shutting down" << endl;
32     finished = true;
33     }
34    
35 jason 4076 int
36     main(int argc, char* argv[])
37     {
38 bcampen 7265 #ifndef _WIN32
39     if ( signal( SIGPIPE, SIG_IGN) == SIG_ERR)
40     {
41     cerr << "Couldn't install signal handler for SIGPIPE" << endl;
42     exit(-1);
43     }
44     #endif
45    
46     if ( signal( SIGINT, signalHandler ) == SIG_ERR )
47     {
48     cerr << "Couldn't install signal handler for SIGINT" << endl;
49     exit( -1 );
50     }
51    
52     if ( signal( SIGTERM, signalHandler ) == SIG_ERR )
53     {
54     cerr << "Couldn't install signal handler for SIGTERM" << endl;
55     exit( -1 );
56     }
57    
58 jason 4076 try
59     {
60     UserAgent ua(argc, argv);
61 jason 4383 ua.startup();
62    
63 jason 4076 InfoLog(<< argv[0] << " starting");
64 bcampen 7265 while(!finished)
65 jason 4076 {
66     ua.process();
67     }
68     }
69     catch (BaseSecurity::Exception& e)
70     {
71     WarningLog (<< "Couldn't set up security object");
72     exit(-1);
73     }
74     catch (BaseException& e)
75     {
76     ErrLog (<< "Caught: " << e);
77     exit(-1);
78     }
79     catch( ... )
80     {
81     ErrLog( << "Caught non-resip exception" );
82     exit(-1);
83     }
84    
85     return 0;
86     }
87    
88     /* ====================================================================
89     * The Vovida Software License, Version 1.0
90     *
91     * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
92     *
93     * Redistribution and use in source and binary forms, with or without
94     * modification, are permitted provided that the following conditions
95     * are met:
96     *
97     * 1. Redistributions of source code must retain the above copyright
98     * notice, this list of conditions and the following disclaimer.
99     *
100     * 2. Redistributions in binary form must reproduce the above copyright
101     * notice, this list of conditions and the following disclaimer in
102     * the documentation and/or other materials provided with the
103     * distribution.
104     *
105     * 3. The names "VOCAL", "Vovida Open Communication Application Library",
106     * and "Vovida Open Communication Application Library (VOCAL)" must
107     * not be used to endorse or promote products derived from this
108     * software without prior written permission. For written
109     * permission, please contact vocal@vovida.org.
110     *
111     * 4. Products derived from this software may not be called "VOCAL", nor
112     * may "VOCAL" appear in their name, without prior written
113     * permission of Vovida Networks, Inc.
114     *
115     * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
116     * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
117     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
118     * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
119     * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
120     * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
121     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
122     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
123     * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
124     * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
125     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
126     * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
127     * DAMAGE.
128     *
129     * ====================================================================
130     *
131     * This software consists of voluntary contributions made by Vovida
132     * Networks, Inc. and many individuals on behalf of Vovida Networks,
133     * Inc. For more information on Vovida Networks, Inc., please see
134     * <http://www.vovida.org/>.
135     *
136     */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27