reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
PresencePublicationHandler.cxx
Go to the documentation of this file.
3
7#include <rutil/Logger.hxx>
8
9using namespace repro;
10using namespace resip;
11
12#define RESIPROCATE_SUBSYSTEM resip::Subsystem::REPRO
13
15 : mPublicationDb(dum.getPublicationPersistenceManager())
16{
17}
18
19void
21 const Data& etag,
22 const SipMessage& pub,
23 const Contents* contents,
24 const SecurityAttributes* attrs,
25 uint32_t expires)
26{
27 if (h->getDocumentKey() == h->getPublisher()) // Ensures this is not a third party publication
28 {
29 InfoLog(<< "PresencePublicationHandler::onInitial: etag=" << etag << ", expires=" << expires << ", msg=" << std::endl << pub);
30 h->send(h->accept(200));
31 }
32 else
33 {
34 WarningLog(<< "PresencePublicationHandler::onInitial: etag=" << etag << " rejected since thirdparty publication: dockey=" << h->getDocumentKey() << " doesn't match publisher=" << h->getPublisher());
35 h->send(h->accept(403));
36 }
37}
38
39void
41{
42 InfoLog(<< "PresencePublicationHandler::onExpired: etag=" << etag);
43}
44
45void
47 const Data& etag,
48 const SipMessage& pub,
49 const Contents* contents,
50 const SecurityAttributes* attrs,
51 uint32_t expires)
52{
53 if (h->getDocumentKey() == h->getPublisher()) // Ensures this is not a third party publication
54 {
55 InfoLog(<< "PresencePublicationHandler::onRefresh: etag=" << etag << ", expires=" << expires << ", msg=" << std::endl << pub);
56 h->send(h->accept(200));
57 }
58 else
59 {
60 WarningLog(<< "PresencePublicationHandler::onRefresh: etag=" << etag << " rejected since thirdparty publication: dockey=" << h->getDocumentKey() << " doesn't match publisher=" << h->getPublisher());
61 h->send(h->accept(403));
62 }
63}
64
65void
67 const Data& etag,
68 const SipMessage& pub,
69 const Contents* contents,
70 const SecurityAttributes* attrs,
71 uint32_t expires)
72{
73 if (h->getDocumentKey() == h->getPublisher()) // Ensures this is not a third party publication
74 {
75 InfoLog(<< "PresencePublicationHandler::onUpdate: etag=" << etag << ", expires=" << expires << ", msg=" << std::endl << pub);
76 h->send(h->accept(200));
77 }
78 else
79 {
80 WarningLog(<< "PresencePublicationHandler::onUpdate: etag=" << etag << " rejected since thirdparty publication: dockey=" << h->getDocumentKey() << " doesn't match publisher=" << h->getPublisher());
81 h->send(h->accept(403));
82 }
83}
84
85void
87{
88 InfoLog(<< "PresencePublicationHandler::onRemoved: etag=" << etag << ", expires=" << expires << ", msg=" << std::endl << pub);
89}
90
91
92/* ====================================================================
93*
94* Copyright (c) 2015 SIP Spectrum, Inc. All rights reserved.
95*
96* Redistribution and use in source and binary forms, with or without
97* modification, are permitted provided that the following conditions
98* are met:
99*
100* 1. Redistributions of source code must retain the above copyright
101* notice, this list of conditions and the following disclaimer.
102*
103* 2. Redistributions in binary form must reproduce the above copyright
104* notice, this list of conditions and the following disclaimer in
105* the documentation and/or other materials provided with the
106* distribution.
107*
108* 3. Neither the name of the author(s) nor the names of any contributors
109* may be used to endorse or promote products derived from this software
110* without specific prior written permission.
111*
112* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
113* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
114* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
115* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
116* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
117* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
118* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
119* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
120* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
121* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
122* SUCH DAMAGE.
123*
124* ====================================================================
125*
126*/
127/*
128* vi: set shiftwidth=3 expandtab:
129*/
#define InfoLog(args_)
Definition Logger.hxx:131
#define WarningLog(args_)
Definition Logger.hxx:134
virtual void onRefresh(resip::ServerPublicationHandle, const resip::Data &etag, const resip::SipMessage &pub, const resip::Contents *contents, const resip::SecurityAttributes *attrs, uint32_t expires)
virtual void onRemoved(resip::ServerPublicationHandle h, const resip::Data &etag, const resip::SipMessage &pub, uint32_t expires)
virtual void onUpdate(resip::ServerPublicationHandle h, const resip::Data &etag, const resip::SipMessage &pub, const resip::Contents *contents, const resip::SecurityAttributes *attrs, uint32_t expires)
virtual void onInitial(resip::ServerPublicationHandle h, const resip::Data &etag, const resip::SipMessage &pub, const resip::Contents *contents, const resip::SecurityAttributes *attrs, uint32_t expires)
virtual void onExpired(resip::ServerPublicationHandle h, const resip::Data &etag)
PresencePublicationHandler(resip::DialogUsageManager &dum)
Base class for all SIP body types.
Definition Contents.hxx:51
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
Represents a SIP message.
This Class is used to implement a primitive form of RPC using loose XML formatting.
dcm! – add UnusedChecking(_enum) below;
unsigned int uint32_t
Definition stdint.h:85