This file is indexed.

/usr/include/ptclib/xmpp_c2s.h is in libpt-dev 2.10.10~dfsg-4.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/*
 * xmpp_c2s.h
 *
 * Extensible Messaging and Presence Protocol (XMPP) Core
 * Client to Server communication classes
 *
 * Portable Windows Library
 *
 * Copyright (c) 2004 Reitek S.p.A.
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific language governing rights and limitations
 * under the License.
 *
 * The Original Code is Portable Windows Library.
 *
 * The Initial Developer of the Original Code is Post Increment
 *
 * Contributor(s): ______________________________________.
 *
 * $Revision: 24875 $
 * $Author: rjongbloed $
 * $Date: 2010-11-12 02:03:15 -0600 (Fri, 12 Nov 2010) $
 */

#ifndef PTLIB_XMPP_C2S_H
#define PTLIB_XMPP_C2S_H

#ifdef P_USE_PRAGMA
#pragma interface
#endif

#include <ptclib/xmpp.h>

#if P_EXPAT

#include <ptclib/psasl.h>
#include <ptlib/sockets.h>


///////////////////////////////////////////////////////

namespace XMPP
{
  namespace C2S
  {

    /** XMPP client to server TCP transport
     */
    class TCPTransport : public Transport
    {
      PCLASSINFO(TCPTransport, Transport);

    public:
      TCPTransport(const PString& hostname);
      TCPTransport(const PString& hostname, WORD port);
      ~TCPTransport();

      const PString&  GetServerHost() const   { return m_Hostname; }
      WORD            GetServerPort() const   { return m_Port; }

      virtual PBoolean Open();
      virtual PBoolean Close();

    protected:
      PString         m_Hostname;
      WORD            m_Port;
      PTCPSocket *    m_Socket;
    };
  

    /** This class handles the client side of a C2S (Client to Server)
        XMPP stream.
     */
    class StreamHandler : public BaseStreamHandler
    {
      PCLASSINFO(StreamHandler, BaseStreamHandler);

    public:
      StreamHandler(const JID& jid, const PString& pwd, PBoolean newAccount = false);
      ~StreamHandler();

      virtual PBoolean IsEstablished() const        { return m_State == Established; }

      virtual PBoolean Start(Transport * transport = 0);

      /** Request the delivery of the specified stanza
      NOTE: the StreamHandler takes ownership of the stanza
      and will take care of deleting it.
      BIG NOTE: use this method and not Write() if you want to
      get a notification when an answer to an iq arrives
      */
      PBoolean    Send(Stanza * stanza);

      void    SetVersion(WORD major, WORD minor);
      void    GetVersion(WORD& major, WORD& minor) const;

      const JID&  GetJID() const  { return m_JID; }

      /** These notifier lists after when a client session is
      established (i.e. after the handshake and authentication
      steps are completed) or is released. The parameter passed
      to the notifiers is a reference to the stream handler
      */
      PNotifierList&  SessionEstablishedHandlers()  { return m_SessionEstablishedHandlers; }
      PNotifierList&  SessionReleasedHandlers()     { return m_SessionReleasedHandlers; }

      /** These notifier lists are fired when a XMPP stanza or a
      stream error is received. For the notifier lists to be fired
      the stream must be already in the established state (i.e.
      after the bind and the session state). The parameter passed
      to the notifiers is a reference to the received pdu
      */
      PNotifierList&  ErrorHandlers()     { return m_ErrorHandlers; }
      PNotifierList&  MessageHandlers()   { return m_MessageHandlers; }
      PNotifierList&  PresenceHandlers()  { return m_PresenceHandlers; }
      PNotifierList&  IQHandlers()        { return m_IQHandlers; }

      /** A notifier list for a specific namespace. The list will
      be fired only upon receiving an IQ with the child element
      of the specified namespace
      */
      PNotifierList&  IQNamespaceHandlers(const PString& xml_namespace);

      /** A notifier list for a particular message originator. The list will
      be fired only upon receiving a message from the specified jid.
      NOTE: if a matching notifier list is found and it's not emnpty, the
      generic MessageHandlers list IS NOT fired.
      */
      PNotifierList&  MessageSenderHandlers(const JID& from);

      /** JEP-0030 Service Discovery access methods.
          The response handler will receive a PIQ stanza (a smart
          pointer to a XMPP::IQ)
       */
      virtual PBoolean DiscoverItems(
        const PString& jid,           ///< JID to which a query will be send
        PNotifier * responseHandler,  ///< Handler function for responses
        const PString& node = PString::Empty() ///< Optional node
      );
      virtual PBoolean DiscoverInfo(
        const PString& jid,           ///< JID to which a query will be send
        PNotifier * responseHandler,  ///< Handler function for responses
        const PString& node = PString::Empty() ///< Optional node
      );

    protected:
      virtual void    OnOpen(Stream& stream, INT);
      virtual void    OnClose(Stream& stream, INT);
      virtual void    StartRegistration();
      virtual void    StartAuthNegotiation();

      virtual void    OnSessionEstablished();
      virtual void    OnSessionReleased();
      virtual void    OnElement(PXML& pdu);
      virtual void    OnError(PXML& pdu);

      virtual void    OnMessage(XMPP::Message& pdu);
      virtual void    OnPresence(XMPP::Presence& pdu);
      virtual void    OnIQ(XMPP::IQ& pdu);

      // State handlers
      virtual void    HandleNullState(PXML& pdu);
      virtual void    HandleRegStartedState(PXML& pdu);
      virtual void    HandleTLSStartedState(PXML& pdu);
#if P_SASL
      virtual void    HandleSASLStartedState(PXML& pdu);
#endif
      virtual void    HandleNonSASLStartedState(PXML& pdu);
      virtual void    HandleStreamSentState(PXML& pdu);
      virtual void    HandleBindSentState(PXML& pdu);
      virtual void    HandleSessionSentState(PXML& pdu);
      virtual void    HandleEstablishedState(PXML& pdu);

      virtual PBoolean    Discover(const PString& xmlns,
                               const PString& jid,
                               PNotifier * responseHandler,
                               const PString& node);

      WORD                m_VersionMajor;
      WORD                m_VersionMinor;
      PString             m_StreamID;
      PBoolean                m_NewAccount;
      JID                 m_JID;
      const PString       m_Password;
#if P_SASL
      PSASLClient         m_SASL;
      PString             m_Mechanism;
#endif
      PBoolean                m_HasBind;
      PBoolean                m_HasSession;

      PNotifierList       m_SessionEstablishedHandlers;
      PNotifierList       m_SessionReleasedHandlers;
      PNotifierList       m_ErrorHandlers;
      PNotifierList       m_MessageHandlers;
      PNotifierList       m_PresenceHandlers;
      PNotifierList       m_IQHandlers;
      PDictionary<PString, PNotifierList> m_IQNamespaceHandlers;
      PDictionary<JID, PNotifierList> m_MessageSenderHandlers;

      PMutex              m_PendingIQsLock;
      StanzaList          m_PendingIQs;

      enum StreamState
      {
        Null,
        RegStarted,
        TLSStarted,
        SASLStarted,
        NonSASLStarted, ///< non SASL authentication (JEP-0078)
        StreamSent,
        BindSent,
        SessionSent,
        Established
      };

      virtual void SetState(StreamState s);

      StreamState m_State;
    };

  }  // namespace C2S
} // namespace XMPP


#endif  // P_EXPAT

#endif  // PTLIB_XMPP_C2S_H

// End of File ///////////////////////////////////////////////////////////////