reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
HEPSipMessageLoggingHandler.cxx
Go to the documentation of this file.
1#if defined(HAVE_CONFIG_H)
2#include "config.h"
3#endif
4
5#include <stdexcept>
6
10#include "rutil/Logger.hxx"
11
12#include <utility>
13
14using namespace resip;
15using namespace std;
16
17#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
18
20 : mHepAgent(agent)
21{
22 if (!mHepAgent)
23 {
24 ErrLog(<<"agent must not be NULL");
25 throw std::runtime_error("agent must not be NULL");
26 }
27}
28
29void
30HEPSipMessageLoggingHandler::outboundMessage(const Tuple &source, const Tuple &destination, const SipMessage &msg)
31{
32 sendToHOMER(source, destination, msg);
33}
34
35void
36HEPSipMessageLoggingHandler::outboundRetransmit(const Tuple &source, const Tuple &destination, const SendData &data)
37{
38 // FIXME - implement for SendData
39}
40
41void
42HEPSipMessageLoggingHandler::inboundMessage(const Tuple& source, const Tuple& destination, const SipMessage &msg)
43{
44 sendToHOMER(source, destination, msg);
45}
46
47void
48HEPSipMessageLoggingHandler::sendToHOMER(const Tuple& source, const Tuple& destination, const SipMessage &msg)
49{
50 mHepAgent->sendToHOMER<SipMessage>(source.getType(),
51 source.toGenericIPAddress(), destination.toGenericIPAddress(),
52 HepAgent::SIP, msg,
53 msg.exists(h_CallId) ? msg.header(h_CallId).value() : Data::Empty);
54}
55
56/* ====================================================================
57 *
58 * Copyright 2016 Daniel Pocock http://danielpocock.com All rights reserved.
59 *
60 * Redistribution and use in source and binary forms, with or without
61 * modification, are permitted provided that the following conditions
62 * are met:
63 *
64 * 1. Redistributions of source code must retain the above copyright
65 * notice, this list of conditions and the following disclaimer.
66 *
67 * 2. Redistributions in binary form must reproduce the above copyright
68 * notice, this list of conditions and the following disclaimer in
69 * the documentation and/or other materials provided with the
70 * distribution.
71 *
72 * 3. Neither the name of the author(s) nor the names of any contributors
73 * may be used to endorse or promote products derived from this software
74 * without specific prior written permission.
75 *
76 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
77 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
78 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
79 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
80 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
81 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
82 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
83 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
84 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
85 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
86 * SUCH DAMAGE.
87 *
88 * ====================================================================
89 *
90 *
91 */
#define ErrLog(args_)
Definition Logger.hxx:137
static const Data Empty
Constant that represents a zero-length data.
Definition Data.hxx:882
virtual void outboundRetransmit(const Tuple &source, const Tuple &destination, const SendData &data)
virtual void sendToHOMER(const Tuple &source, const Tuple &destination, const SipMessage &msg)
virtual void inboundMessage(const Tuple &source, const Tuple &destination, const SipMessage &msg)
HEPSipMessageLoggingHandler(std::shared_ptr< HepAgent > agent)
virtual void outboundMessage(const Tuple &source, const Tuple &destination, const SipMessage &msg)
Represents a SIP message.
const RequestLine & header(const RequestLineType &l) const
Returns the RequestLine. This is only valid for request messages.
bool exists(const HeaderBase &headerType) const
Returns true if the given header field is present, false otherwise.
Represents a network address.
Definition Tuple.hxx:59
GenericIPAddress toGenericIPAddress() const
Definition Tuple.cxx:1169
TransportType getType() const
Definition Tuple.hxx:122
dcm! – add UnusedChecking(_enum) below;
H_CallId h_CallId
Definition Headers.cxx:266