reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
PrivateKeySubscriptionHandler.cxx
Go to the documentation of this file.
1
#include "
resip/stack/Pkcs8Contents.hxx
"
2
#include "
resip/stack/ssl/Security.hxx
"
3
#include "
resip/dum/ServerSubscription.hxx
"
4
#include "
resip/dum/ServerPublication.hxx
"
5
#include "
repro/stateAgents/PrivateKeySubscriptionHandler.hxx
"
6
7
using namespace
repro
;
8
using namespace
resip
;
9
10
PrivateKeySubscriptionHandler::PrivateKeySubscriptionHandler
(
resip::Security
& security) : mSecurity(security)
11
{
12
}
13
14
void
15
PrivateKeySubscriptionHandler::onNewSubscription
(
ServerSubscriptionHandle
h,
const
SipMessage
& sub)
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
{
23
h->
setSubscriptionState
(
Active
);
24
h->
send
(h->
accept
(200));
25
26
Pkcs8Contents
pkcs(mSecurity.
getUserPrivateKeyDER
(h->
getDocumentKey
()));
27
h->
send
(h->
update
(&pkcs));
28
}
29
else
30
{
31
h->
send
(h->
reject
(404));
32
}
33
}
34
35
void
36
PrivateKeySubscriptionHandler::onPublished
(
ServerSubscriptionHandle
associated,
37
ServerPublicationHandle
publication,
38
const
Contents
* contents,
39
const
SecurityAttributes
* attrs)
40
{
41
associated->
send
(associated->
update
(contents));
42
}
43
44
void
45
PrivateKeySubscriptionHandler::onTerminated
(
ServerSubscriptionHandle
)
46
{
47
}
48
49
void
50
PrivateKeySubscriptionHandler::onError
(
ServerSubscriptionHandle
,
const
SipMessage
& msg)
51
{
52
}
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
Pkcs8Contents.hxx
PrivateKeySubscriptionHandler.hxx
Security.hxx
ServerPublication.hxx
ServerSubscription.hxx
repro::PrivateKeySubscriptionHandler::onTerminated
virtual void onTerminated(resip::ServerSubscriptionHandle)
Definition
PrivateKeySubscriptionHandler.cxx:45
repro::PrivateKeySubscriptionHandler::PrivateKeySubscriptionHandler
PrivateKeySubscriptionHandler(resip::Security &security)
Definition
PrivateKeySubscriptionHandler.cxx:10
repro::PrivateKeySubscriptionHandler::onNewSubscription
virtual void onNewSubscription(resip::ServerSubscriptionHandle h, const resip::SipMessage &sub)
Definition
PrivateKeySubscriptionHandler.cxx:15
repro::PrivateKeySubscriptionHandler::onPublished
virtual void onPublished(resip::ServerSubscriptionHandle associated, resip::ServerPublicationHandle publication, const resip::Contents *contents, const resip::SecurityAttributes *attrs)
Definition
PrivateKeySubscriptionHandler.cxx:36
repro::PrivateKeySubscriptionHandler::onError
virtual void onError(resip::ServerSubscriptionHandle, const resip::SipMessage &msg)
Definition
PrivateKeySubscriptionHandler.cxx:50
resip::BaseSecurity::getUserPrivateKeyDER
Data getUserPrivateKeyDER(const Data &aor) const
Definition
Security.cxx:1501
resip::BaseSecurity::hasUserPrivateKey
bool hasUserPrivateKey(const Data &aor) const
Definition
Security.cxx:1483
resip::BaseSubscription::getDocumentKey
const Data & getDocumentKey() const noexcept
Definition
BaseSubscription.hxx:27
resip::Contents
Base class for all SIP body types.
Definition
Contents.hxx:51
resip::Handle< ServerSubscription >
resip::Pkcs8Contents
SIP body type for holding PKCS8 contents (MIME content-type application/pkcs8).
Definition
Pkcs8Contents.hxx:15
resip::SecurityAttributes
Definition
SecurityAttributes.hxx:22
resip::Security
Definition
Security.hxx:272
resip::ServerSubscription::setSubscriptionState
void setSubscriptionState(SubscriptionState state)
Definition
ServerSubscription.cxx:214
resip::ServerSubscription::update
std::shared_ptr< SipMessage > update(const Contents *document)
Definition
ServerSubscription.cxx:444
resip::ServerSubscription::getSubscriber
const Data & getSubscriber() const noexcept
Definition
ServerSubscription.hxx:27
resip::ServerSubscription::accept
std::shared_ptr< SipMessage > accept(int statusCode=202)
Definition
ServerSubscription.cxx:75
resip::ServerSubscription::send
void send(std::shared_ptr< SipMessage > msg) override
Definition
ServerSubscription.cxx:113
resip::ServerSubscription::reject
std::shared_ptr< SipMessage > reject(int responseCode)
Definition
ServerSubscription.cxx:89
resip::SipMessage
Represents a SIP message.
Definition
SipMessage.hxx:175
repro
This Class is used to implement a primitive form of RPC using loose XML formatting.
Definition
AbstractDb.hxx:16
resip
dcm! – add UnusedChecking(_enum) below;
Definition
AbstractFifo.hxx:16
resip::Active
@ Active
Definition
SubscriptionState.hxx:13
repro
stateAgents
PrivateKeySubscriptionHandler.cxx
Generated by
1.9.8