reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
HEPRTCPEventLoggingHandler.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
9#include "rutil/Logger.hxx"
10
13
14#include <utility>
15
16using namespace flowmanager;
17using namespace resip;
18using namespace reTurn;
19using namespace std;
20
21#define RESIPROCATE_SUBSYSTEM FlowManagerSubsystem::FLOWMANAGER
22
24 : mHepAgent(agent)
25{
26 if (!mHepAgent)
27 {
28 ErrLog(<<"agent must not be NULL");
29 throw std::runtime_error("agent must not be NULL");
30 }
31}
32
33void
34HEPRTCPEventLoggingHandler::outboundEvent(std::shared_ptr<FlowContext> context, const reTurn::StunTuple& source, const reTurn::StunTuple& destination, const resip::Data& event)
35{
36 sendToHOMER(context, source, destination, event);
37}
38
39void
40HEPRTCPEventLoggingHandler::inboundEvent(std::shared_ptr<FlowContext> context, const reTurn::StunTuple& source, const reTurn::StunTuple& destination, const resip::Data& event)
41{
42 sendToHOMER(context, source, destination, event);
43}
44
45void
46HEPRTCPEventLoggingHandler::sendToHOMER(std::shared_ptr<FlowContext> context, const StunTuple& source, const StunTuple& destination, const Data& event)
47{
48 GenericIPAddress _source, _destination;
49
50 source.toSockaddr(&_source.address);
51 destination.toSockaddr(&_destination.address);
52
53 Data correlationId;
54 if (context)
55 {
56 correlationId = context->getSipCallId();
57 }
58
59 mHepAgent->sendRTCP(resip::UDP,
60 _source, _destination,
61 event,
62 correlationId);
63}
64
65/* ====================================================================
66 *
67 * Copyright 2016 Daniel Pocock http://danielpocock.com All rights reserved.
68 *
69 * Redistribution and use in source and binary forms, with or without
70 * modification, are permitted provided that the following conditions
71 * are met:
72 *
73 * 1. Redistributions of source code must retain the above copyright
74 * notice, this list of conditions and the following disclaimer.
75 *
76 * 2. Redistributions in binary form must reproduce the above copyright
77 * notice, this list of conditions and the following disclaimer in
78 * the documentation and/or other materials provided with the
79 * distribution.
80 *
81 * 3. Neither the name of the author(s) nor the names of any contributors
82 * may be used to endorse or promote products derived from this software
83 * without specific prior written permission.
84 *
85 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
86 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
87 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
88 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
89 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
90 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
91 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
92 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
93 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
94 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
95 * SUCH DAMAGE.
96 *
97 * ====================================================================
98 *
99 *
100 */
#define ErrLog(args_)
Definition Logger.hxx:137
virtual void sendToHOMER(std::shared_ptr< FlowContext > context, const reTurn::StunTuple &source, const reTurn::StunTuple &destination, const resip::Data &event)
virtual void inboundEvent(std::shared_ptr< FlowContext > context, const reTurn::StunTuple &source, const reTurn::StunTuple &destination, const resip::Data &event)
virtual void outboundEvent(std::shared_ptr< FlowContext > context, const reTurn::StunTuple &source, const reTurn::StunTuple &destination, const resip::Data &event)
HEPRTCPEventLoggingHandler(std::shared_ptr< resip::HepAgent > agent)
void toSockaddr(sockaddr *addr) const
Definition StunTuple.cxx:64
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
This class is used during media sessions that use Dtls-Srtp for a media transport.
Definition ErrorCode.hxx:4
dcm! – add UnusedChecking(_enum) below;
Represents an IP-address and port (V4 or V6).