This file is indexed.

/usr/include/repro/stateAgents/PresenceSubscriptionHandler.hxx is in libresiprocate-1.11-dev 1:1.11.0~beta5-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#if !defined(PresenceSubscriptionHandler_hxx)
#define PresenceSubscriptionHandler_hxx

#include <set>
#include "resip/dum/ServerSubscription.hxx"
#include "resip/dum/DumCommand.hxx"
#include "resip/dum/SubscriptionHandler.hxx"
#include "resip/dum/DialogUsageManager.hxx"
#include <resip/dum/InMemorySyncRegDb.hxx>
#include <resip/dum/InMemorySyncPubDb.hxx>

namespace repro
{
class Dispatcher;
}

namespace resip
{
class SipMessage;
class SecurityAttributes;
class Data;
class Contents;
}

namespace repro
{

class PresenceSubscriptionHandler;

// This class is used to do an aynchronous check for user existence
class PresenceUserExists : public resip::DumCommand
{
public:
   PresenceUserExists(resip::DialogUsageManager& dum, PresenceSubscriptionHandler* handler, resip::ServerSubscriptionHandle h,
      bool sendAcceptReject, const resip::Uri& aor) :
      mDum(dum), mSubscriptionHandler(handler), mServerSubscriptionHandle(h), mSendAcceptReject(sendAcceptReject),
      mUserExists(false), mAor(aor) { mTu = &dum; }
   PresenceUserExists(const PresenceUserExists& orig) : DumCommand(orig),
      mDum(orig.mDum), mSubscriptionHandler(orig.mSubscriptionHandler), mServerSubscriptionHandle(orig.mServerSubscriptionHandle),
      mSendAcceptReject(orig.mSendAcceptReject), mUserExists(orig.mUserExists), mAor(orig.mAor)  {}
   virtual PresenceUserExists* clone() const { return new PresenceUserExists(*this); }

   virtual EncodeStream& encode(EncodeStream& ostr) const { ostr << "PresenceUserExists: " << mAor; return ostr; }
   virtual EncodeStream& encodeBrief(EncodeStream& ostr) const { return encode(ostr); }

   virtual void executeCommand();
   virtual void setUserExists(bool exists) { mUserExists = exists; }
   virtual bool getUserExists() { return mUserExists; }

   virtual const resip::Data getUser() { return mAor.user(); }
   virtual const resip::Data getDomain() { return mAor.host(); }

private:
   resip::DialogUsageManager& mDum;
   PresenceSubscriptionHandler* mSubscriptionHandler;
   resip::ServerSubscriptionHandle mServerSubscriptionHandle;
   bool mSendAcceptReject;
   bool mUserExists;
   resip::Uri mAor;
};

class PresenceServerSubscriptionRegFunctor;
class PresenceServerSubscriptionFunctor;
class PresenceServerRegStateChangeCommand;
class PresenceServerDocStateChangeCommand;
class PresenceServerCheckDocExpiredCommand;
class PresenceSubscriptionHandler : public resip::ServerSubscriptionHandler, 
                                    public resip::PublicationPersistenceManager::ETagMerger,
                                    public resip::InMemorySyncRegDbHandler,
                                    public resip::InMemorySyncPubDbHandler
{
public:
    PresenceSubscriptionHandler(resip::DialogUsageManager& dum,
                               repro::Dispatcher* userDispatcher,
                               bool presenceUsesRegistrationState,
                               bool PresenceNotifyClosedStateForNonPublishedUsers);
    virtual ~PresenceSubscriptionHandler();

    // ServerSubscriptionHandler interfaces
    virtual void onNewSubscription(resip::ServerSubscriptionHandle h, const resip::SipMessage& sub);
    virtual void onRefresh(resip::ServerSubscriptionHandle, const resip::SipMessage& sub);
    virtual void onPublished(resip::ServerSubscriptionHandle associated,
                             resip::ServerPublicationHandle publication,
                             const resip::Contents* contents,
                             const resip::SecurityAttributes* attrs);
    virtual void onTerminated(resip::ServerSubscriptionHandle);
    virtual void onError(resip::ServerSubscriptionHandle, const resip::SipMessage& msg);

    // PublicationPersistenceManager::ETagMerger interface
    virtual bool mergeETag(resip::Contents* eTagDest, resip::Contents* eTagSrc, bool isFirst);

    // InMemorySyncRegDb handler interface
    virtual void onAorModified(const resip::Uri& aor, const resip::ContactList& contacts);

    // InMemorySyncPubDb handler interface
    virtual void onDocumentModified(bool sync, const resip::Data& eventType, const resip::Data& documentKey, const resip::Data& eTag, UInt64 expirationTime, UInt64 lastUpdated, const resip::Contents* contents, const resip::SecurityAttributes* securityAttributes);
    virtual void onDocumentRemoved(bool sync, const resip::Data& eventType, const resip::Data& documentKey, const resip::Data& eTag, UInt64 lastUpdated);

protected:
    resip::DialogUsageManager& mDum;
    resip::InMemorySyncPubDb* mPublicationDb;
    resip::InMemorySyncRegDb* mRegistrationDb;
    void notifyPresence(resip::ServerSubscriptionHandle h, bool sendAcceptReject);
    void notifyPresenceNoPublication(resip::ServerSubscriptionHandle h, bool sendAcceptReject, const resip::Uri& aor, bool isRegistered, UInt64 regMaxExpires);
    bool sendPublishedPresence(resip::ServerSubscriptionHandle h, bool sendAcceptReject);
    void adjustNotifyExpiresTime(resip::SipMessage& notify, UInt64 regMaxExpires);
    void fabricateSimplePresence(resip::ServerSubscriptionHandle h, bool sendAcceptReject, const resip::Uri& aor, bool online, UInt64 regMaxExpires);
    void continueNotifyPresenceAfterUserExistsCheck(resip::ServerSubscriptionHandle h, bool sendAcceptReject, const resip::Uri& aor, bool userExists);
    bool checkRegistrationStateChanged(const resip::Uri& aor, bool registered, UInt64 regMaxExpires);
    void notifySubscriptions(const resip::Data& documentKey);
    void checkExpired(const resip::Data& documentKey, const resip::Data& eTag, UInt64 lastUpdated);
    friend class PresenceServerSubscriptionRegFunctor;
    friend class PresenceServerSubscriptionFunctor;
    friend class PresenceServerRegStateChangeCommand;
    friend class PresenceServerDocStateChangeCommand;
    friend class PresenceServerCheckDocExpiredCommand;
    friend class PresenceUserExists;

    bool mPresenceUsesRegistrationState;
    bool mPresenceNotifyClosedStateForNonPublishedUsers;
    Dispatcher* mUserDispatcher;
    std::set<resip::Uri> mOnlineAors;
};
 
}

#endif

/* ====================================================================
*
* Copyright (c) 2015 SIP Spectrum, Inc.  All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
*    notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
*    notice, this list of conditions and the following disclaimer in
*    the documentation and/or other materials provided with the
*    distribution.
*
* 3. Neither the name of the author(s) nor the names of any contributors
*    may be used to endorse or promote products derived from this software
*    without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* ====================================================================
*
*/
/*
* vi: set shiftwidth=3 expandtab:
*/