|
reSIProcate/stack
9694
|
#include "resip/stack/SipStack.hxx"#include "resip/stack/Transport.hxx"#include "resip/stack/Uri.hxx"#include "resip/stack/Helper.hxx"#include "resip/stack/test/TestSupport.hxx"#include "rutil/Logger.hxx"#include "rutil/DataStream.hxx"
Go to the source code of this file.
Defines | |
| #define | RESIPROCATE_SUBSYSTEM Subsystem::APP |
| #define | CRLF "\r\n" |
Functions | |
| void | doit (int serverResponse, int expectedRetrans, int expectedClientResponse) |
| int | main (int argc, char *argv[]) |
Variables | |
| SipStack * | client = 0 |
| Fifo< Message > | received |
| #define CRLF "\r\n" |
Definition at line 13 of file testNonInviteClientTx.cxx.
| #define RESIPROCATE_SUBSYSTEM Subsystem::APP |
Definition at line 12 of file testNonInviteClientTx.cxx.
| void doit | ( | int | serverResponse, |
| int | expectedRetrans, | ||
| int | expectedClientResponse | ||
| ) |
Definition at line 60 of file testNonInviteClientTx.cxx.
References client, resip::SipMessage::encode(), resip::Uri::host(), InfoLog, resip::TestSupport::makeMessage(), resip::Helper::makeRegister(), resip::Helper::makeResponse(), resip::Uri::port(), resip::SipStack::process(), resip::SipStack::send(), and resip::NameAddr::uri().
Referenced by main().
{
InfoLog (<< "Running test: " << serverResponse << " " << expectedRetrans << " " << expectedClientResponse);
NameAddr me;
me.uri().host() = "localhost";
me.uri().port() = 5070;
SipMessage* reg = Helper::makeRegister(me, me);
InfoLog (<< "Sending: " << *reg);
Data encoded(2048, true);
DataStream strm(encoded);
reg->encode(strm);
strm.flush();
client->send(*reg); // send message down the stack
FdSet fdset;
client->process(fdset);
// read the message off the stack
Data fromStack;
getFromWire(fromStack);
InfoLog(<< "Received from wire " << fromStack);
SipMessage* message = TestSupport::makeMessage(fromStack);
// send the response message
SipMessage* response = Helper::makeResponse(*message, 100);
InfoLog (<< "sending to wire = " << endl << *response);
Data encodedResponse(2048, true);
DataStream estrm(encodedResponse);
response->encode(estrm);
estrm.flush();
// sendToWire(encodedResponse);
while (1)
{
client->process(fdset);
usleep(20);
}
}

| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 24 of file testNonInviteClientTx.cxx.
References resip::SipStack::addTransport(), client, resip::Log::Cout, resip::Log::Debug, DebugLog, doit(), InfoLog, resip::Log::initialize(), and resip::UDP.
{
Log::initialize(Log::Cout, Log::Debug, argv[0]);
DebugLog( << "Starting up, making stack");
InfoLog( << "Starting up, making stack");
client = new SipStack();
client->addTransport(UDP, 5070);
// Test 1:
// client sends a reg, server does nothing, client should retransmit 10
// times, client should receive 408
// Test 2:
// client sends a reg, server sends 100, client should retransmit 7 times
// client should receive 408
// Test 3:
// client sends a reg, server sends 200, client shouldn't retransmit at all
// client should receive 200
// Test 4:
// client sends a reg, server sends 400, client shouldn't retransmit at all
// client should receive 400
//doit(100, 7, 408);
doit(200, 1, 200);
// doit(400, 1, 400);
//doit(0, 10, 408);
return 0;
}

Definition at line 16 of file testNonInviteClientTx.cxx.
Referenced by doit(), main(), processInject(), and processTimeouts().
Definition at line 17 of file testNonInviteClientTx.cxx.
Referenced by main(), Client::process(), resip::Transport::stampReceived(), Client::thread(), and Server::thread().
1.7.5.1