reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
PrivateKeySubscriptionHandler.cxx
Go to the documentation of this file.
6
7using namespace repro;
8using namespace resip;
9
13
14void
16{
17 if (h->getDocumentKey() != h->getSubscriber())
18 {
19 h->send(h->accept(403)); // !jf! is this the correct code?
20 }
21 else if (mSecurity.hasUserPrivateKey(h->getDocumentKey()))
22 {
24 h->send(h->accept(200));
25
27 h->send(h->update(&pkcs));
28 }
29 else
30 {
31 h->send(h->reject(404));
32 }
33}
34
35void
37 ServerPublicationHandle publication,
38 const Contents* contents,
39 const SecurityAttributes* attrs)
40{
41 associated->send(associated->update(contents));
42}
43
44void
48
49void
53
54/* ====================================================================
55*
56* Copyright (c) 2015. All rights reserved.
57*
58* Redistribution and use in source and binary forms, with or without
59* modification, are permitted provided that the following conditions
60* are met:
61*
62* 1. Redistributions of source code must retain the above copyright
63* notice, this list of conditions and the following disclaimer.
64*
65* 2. Redistributions in binary form must reproduce the above copyright
66* notice, this list of conditions and the following disclaimer in
67* the documentation and/or other materials provided with the
68* distribution.
69*
70* 3. Neither the name of the author(s) nor the names of any contributors
71* may be used to endorse or promote products derived from this software
72* without specific prior written permission.
73*
74* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
75* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
76* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
77* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
78* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
79* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
80* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
81* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
82* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
83* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
84* SUCH DAMAGE.
85*
86* ====================================================================
87*
88*/
89/*
90* vi: set shiftwidth=3 expandtab:
91*/
92
virtual void onTerminated(resip::ServerSubscriptionHandle)
virtual void onNewSubscription(resip::ServerSubscriptionHandle h, const resip::SipMessage &sub)
virtual void onPublished(resip::ServerSubscriptionHandle associated, resip::ServerPublicationHandle publication, const resip::Contents *contents, const resip::SecurityAttributes *attrs)
virtual void onError(resip::ServerSubscriptionHandle, const resip::SipMessage &msg)
Data getUserPrivateKeyDER(const Data &aor) const
bool hasUserPrivateKey(const Data &aor) const
const Data & getDocumentKey() const noexcept
Base class for all SIP body types.
Definition Contents.hxx:51
SIP body type for holding PKCS8 contents (MIME content-type application/pkcs8).
void setSubscriptionState(SubscriptionState state)
std::shared_ptr< SipMessage > update(const Contents *document)
const Data & getSubscriber() const noexcept
std::shared_ptr< SipMessage > accept(int statusCode=202)
void send(std::shared_ptr< SipMessage > msg) override
std::shared_ptr< SipMessage > reject(int responseCode)
Represents a SIP message.
This Class is used to implement a primitive form of RPC using loose XML formatting.
dcm! – add UnusedChecking(_enum) below;