/usr/include/gloox/jingleplugin.h is in libgloox-dev 1.0.18-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 | /*
Copyright (c) 2008-2016 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef JINGLEPLUGIN_H__
#define JINGLEPLUGIN_H__
#include "macros.h"
#include "util.h"
#include <string>
#include <list>
namespace gloox
{
class Tag;
namespace Jingle
{
class Plugin;
class PluginFactory;
/**
* The type of Jingle plugin.
*/
enum JinglePluginType
{
PluginNone, /**< Invalid plugin type. */
PluginContent, /**< A plugin abstracting a <content> element. May contain further plugins. */
PluginFileTransfer, /**< A plugin for File Transfer. */
PluginICEUDP, /**< A plugin for ICE UDP transport negotiation. */
PluginReason, /**< An abstraction of a Jingle (@xep{0166}) session terminate reason. */
PluginUser /**< User-supplied plugins must use IDs above this. Do
* not hard-code PluginUser's value anywhere, it is subject
* to change. */
};
/**
* A list of Jingle plugins.
*/
typedef std::list<const Plugin*> PluginList;
/**
* @brief An abstraction of a Jingle plugin. This is part of Jingle (@xep{0166} et al.)
*
* This is the base class for Content and all other pluggable Jingle-related containers, e.g.
* session information, such as the 'ringing' info in Jingle Audio, or Jingle DTMF, etc.
*
* A Plugin abstracts the XML that gets sent and received as part of a Jingle session negotiation.
*
* XEP Version: 1.1
*
* @author Jakob Schröter <js@camaya.net>
* @since 1.0.5
*/
class GLOOX_API Plugin
{
friend class PluginFactory;
public:
/**
* Simple initializer.
*/
Plugin( JinglePluginType type ) : m_factory( 0 ), m_pluginType( type ) {}
/**
* Virtual destructor.
*/
virtual ~Plugin() { util::clearList( m_plugins ) ; }
/**
* Adds another Plugin as child.
* @param plugin A plugin to be embedded. Will be owned by this instance and deleted in the destructor.
*/
void addPlugin( const Plugin* plugin ) { if( plugin ) m_plugins.push_back( plugin ); }
/**
* Finds a Jingle::Plugin of a particular type.
* @param type JinglePluginType to search for.
* @return A pointer to the first Jingle::Plugin of the given type, or 0 if none was found.
*/
const Plugin* findPlugin( int type ) const
{
PluginList::const_iterator it = m_plugins.begin();
for( ; it != m_plugins.end() && (*it)->pluginType() != type; ++it ) ;
return it != m_plugins.end() ? (*it) : 0;
}
/**
* Finds a Jingle::Plugin of a particular type.
* Example:
* @code
* const MyPlugin* c = plugin.findPlugin<MyPlugin>( PluginMyPlugin );
* @endcode
* @param type The plugin type to look for.
* @return The static_cast' type, or 0 if none was found.
*/
template< class T >
inline const T* findPlugin( int type ) const
{
return static_cast<const T*>( findPlugin( type ) );
}
/**
* Returns a reference to a list of embedded plugins.
* @return A reference to a list of embedded plugins.
*/
const PluginList& plugins() const { return m_plugins; }
/**
* Reimplement this function if your plugin wants to add anything to the list of
* features announced via Disco.
* @return A list of additional feature strings.
*/
virtual const StringList features() const { return StringList(); }
/**
* Returns an XPath expression that describes a path to child elements of a
* jingle element that the plugin handles.
* The result should be a single Tag.
*
* @return The plugin's filter string.
*/
virtual const std::string& filterString() const = 0;
/**
* Returns a Tag representation of the plugin.
* @return A Tag representation of the plugin.
*/
virtual Tag* tag() const = 0;
/**
* Returns a new instance of the same plugin type,
* based on the Tag provided.
* @param tag The Tag to parse and create a new instance from.
* @return The new plugin instance.
*/
virtual Plugin* newInstance( const Tag* tag ) const = 0;
/**
* Creates an identical deep copy of the current instance.
* @return An identical deep copy of the current instance.
*/
virtual Plugin* clone() const = 0;
/**
* Returns the plugin type.
* @return The plugin type.
*/
JinglePluginType pluginType() const { return m_pluginType; }
protected:
PluginList m_plugins;
PluginFactory* m_factory;
private:
void setFactory( PluginFactory* factory ) { m_factory = factory; }
JinglePluginType m_pluginType;
};
}
}
#endif // JINGLEPLUGIN_H__
|