reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
CertSubscriptionHandler.cxx
Go to the documentation of this file.
4
5using namespace repro;
6using namespace resip;
7
9{
10}
11
12void
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 {
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
36void
38 ServerPublicationHandle publication,
39 const Contents* contents,
40 const SecurityAttributes* attrs)
41{
42 associated->send(associated->update(contents));
43}
44
45
46void
50
51void
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
virtual void onPublished(resip::ServerSubscriptionHandle associated, resip::ServerPublicationHandle publication, const resip::Contents *contents, const resip::SecurityAttributes *attrs)
virtual void onTerminated(resip::ServerSubscriptionHandle)
CertSubscriptionHandler(resip::Security &security)
virtual void onError(resip::ServerSubscriptionHandle, const resip::SipMessage &msg)
virtual void onNewSubscription(resip::ServerSubscriptionHandle h, const resip::SipMessage &sub)
void generateUserCert(const Data &aor, int expireDays=365, int keyLen=2048)
bool hasUserCert(const Data &aor) const
Data getUserCertDER(const Data &aor) const
const Data & getDocumentKey() const noexcept
Base class for all SIP body types.
Definition Contents.hxx:51
void setSubscriptionState(SubscriptionState state)
std::shared_ptr< SipMessage > update(const Contents *document)
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.
SIP body type for holding X509 contents (MIME content-type application/pkix-cert).
This Class is used to implement a primitive form of RPC using loose XML formatting.
dcm! – add UnusedChecking(_enum) below;