1
#if defined(HAVE_CONFIG_H)
9
#include "rutil/DnsUtil.hxx"
10
#include "rutil/Inserter.hxx"
11
#include "rutil/Logger.hxx"
12
#include "resip/stack/Helper.hxx"
13
#include "resip/stack/SipMessage.hxx"
14
#include "resip/stack/SipStack.hxx"
15
#include "resip/stack/Uri.hxx"
17
#include "resip/stack/ssl/Security.hxx"
20
using namespace resip;
23
#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
27
main(int argc, char* argv[])
29
Log::initialize(Log::Cout, Log::Info ,"testDtlsTransport");
32
Security* serverSecurity = new Security();
33
SipStack serverStack(serverSecurity);
35
serverStack.addTransport(DTLS, 15060, V4, StunDisabled, Data::Empty, "127.0.0.1");
36
SipStack clientStack(serverSecurity);
37
clientStack.addTransport(DTLS, 25060, V4);
39
NameAddr target("sip:bob@127.0.0.1:15060;transport=dtls");
40
NameAddr from("sip:alice@127.0.0.1");
42
contact.uri().user() = "alice";
44
SipMessage * msg = Helper::makeRequest(target, from, contact, INVITE);
45
clientStack.send(*msg);
52
serverStack.buildFdSet(fdset);
53
fdset.selectMilliSeconds(50);
54
serverStack.process(fdset);
57
SipMessage* msg = serverStack.receive();
58
if (msg && msg->isRequest())
60
SipMessage* resp = Helper::makeResponse(*msg, 400);
61
serverStack.send(*resp);
62
InfoLog( << "Generated 400 to: " << msg->brief());
69
clientStack.buildFdSet(fdset);
70
fdset.selectMilliSeconds(50);
71
clientStack.process(fdset);
74
msg = clientStack.receive();
77
InfoLog( << "Got from server: " << msg->brief());
84
/* ====================================================================
85
* The Vovida Software License, Version 1.0
87
* Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
89
* Redistribution and use in source and binary forms, with or without
90
* modification, are permitted provided that the following conditions
93
* 1. Redistributions of source code must retain the above copyright
94
* notice, this list of conditions and the following disclaimer.
96
* 2. Redistributions in binary form must reproduce the above copyright
97
* notice, this list of conditions and the following disclaimer in
98
* the documentation and/or other materials provided with the
101
* 3. The names "VOCAL", "Vovida Open Communication Application Library",
102
* and "Vovida Open Communication Application Library (VOCAL)" must
103
* not be used to endorse or promote products derived from this
104
* software without prior written permission. For written
105
* permission, please contact vocal@vovida.org.
107
* 4. Products derived from this software may not be called "VOCAL", nor
108
* may "VOCAL" appear in their name, without prior written
109
* permission of Vovida Networks, Inc.
111
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
112
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
113
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
114
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
115
* NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
116
* IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
117
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
118
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
119
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
120
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
121
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
122
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
125
* ====================================================================
127
* This software consists of voluntary contributions made by Vovida
128
* Networks, Inc. and many individuals on behalf of Vovida Networks,
129
* Inc. For more information on Vovida Networks, Inc., please see
130
* <http://www.vovida.org/>.