reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
CertSubscriptionHandler.cxx
Go to the documentation of this file.
1
#include "
resip/stack/ssl/Security.hxx
"
2
#include "
resip/stack/X509Contents.hxx
"
3
#include "
repro/stateAgents/CertSubscriptionHandler.hxx
"
4
5
using namespace
repro
;
6
using namespace
resip
;
7
8
CertSubscriptionHandler::CertSubscriptionHandler
(
Security
& security) : mSecurity(security)
9
{
10
}
11
12
void
13
CertSubscriptionHandler::onNewSubscription
(
ServerSubscriptionHandle
h,
const
SipMessage
& sub)
14
{
15
if
(!mSecurity.
hasUserCert
(h->
getDocumentKey
()))
16
{
17
// !jf! really need to do this async. send neutral state in the meantime,
18
// blah blah blah
19
mSecurity.
generateUserCert
(h->
getDocumentKey
());
20
}
21
22
if
(mSecurity.
hasUserCert
(h->
getDocumentKey
()))
23
{
24
h->
setSubscriptionState
(
Active
);
25
h->
send
(h->
accept
(200));
26
27
X509Contents
x509(mSecurity.
getUserCertDER
(h->
getDocumentKey
()));
28
h->
send
(h->
update
(&x509));
29
}
30
else
31
{
32
h->
send
(h->
reject
(404));
33
}
34
}
35
36
void
37
CertSubscriptionHandler::onPublished
(
ServerSubscriptionHandle
associated,
38
ServerPublicationHandle
publication,
39
const
Contents
* contents,
40
const
SecurityAttributes
* attrs)
41
{
42
associated->
send
(associated->
update
(contents));
43
}
44
45
46
void
47
CertSubscriptionHandler::onTerminated
(
ServerSubscriptionHandle
)
48
{
49
}
50
51
void
52
CertSubscriptionHandler::onError
(
ServerSubscriptionHandle
,
const
SipMessage
& msg)
53
{
54
}
55
56
/* ====================================================================
57
*
58
* Copyright (c) 2015. 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
/*
92
* vi: set shiftwidth=3 expandtab:
93
*/
94
CertSubscriptionHandler.hxx
Security.hxx
X509Contents.hxx
repro::CertSubscriptionHandler::onPublished
virtual void onPublished(resip::ServerSubscriptionHandle associated, resip::ServerPublicationHandle publication, const resip::Contents *contents, const resip::SecurityAttributes *attrs)
Definition
CertSubscriptionHandler.cxx:37
repro::CertSubscriptionHandler::onTerminated
virtual void onTerminated(resip::ServerSubscriptionHandle)
Definition
CertSubscriptionHandler.cxx:47
repro::CertSubscriptionHandler::CertSubscriptionHandler
CertSubscriptionHandler(resip::Security &security)
Definition
CertSubscriptionHandler.cxx:8
repro::CertSubscriptionHandler::onError
virtual void onError(resip::ServerSubscriptionHandle, const resip::SipMessage &msg)
Definition
CertSubscriptionHandler.cxx:52
repro::CertSubscriptionHandler::onNewSubscription
virtual void onNewSubscription(resip::ServerSubscriptionHandle h, const resip::SipMessage &sub)
Definition
CertSubscriptionHandler.cxx:13
resip::BaseSecurity::generateUserCert
void generateUserCert(const Data &aor, int expireDays=365, int keyLen=2048)
Definition
Security.cxx:1507
resip::BaseSecurity::hasUserCert
bool hasUserCert(const Data &aor) const
Definition
Security.cxx:1397
resip::BaseSecurity::getUserCertDER
Data getUserCertDER(const Data &aor) const
Definition
Security.cxx:1409
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::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::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
resip::X509Contents
SIP body type for holding X509 contents (MIME content-type application/pkix-cert).
Definition
X509Contents.hxx:15
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
CertSubscriptionHandler.cxx
Generated by
1.9.8