This file is indexed.

/usr/include/x86_64-linux-gnu/zypp/PluginScript.h is in libzypp-dev 14.29.1-2.

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
/*---------------------------------------------------------------------\
|                          ____ _   __ __ ___                          |
|                         |__  / \ / / . \ . \                         |
|                           / / \ V /|  _/  _/                         |
|                          / /__ | | | | | |                           |
|                         /_____||_| |_| |_|                           |
|                                                                      |
\---------------------------------------------------------------------*/
/** \file	zypp/PluginScript.h
 *
*/
#ifndef ZYPP_PLUGINSCRIPT_H
#define ZYPP_PLUGINSCRIPT_H

#include <iosfwd>
#include <string>
#include <vector>

#include "zypp/base/PtrTypes.h"
#include "zypp/Pathname.h"

#include "zypp/PluginFrame.h"
#include "zypp/PluginScriptException.h"

///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////

  /**
   * \brief Interface to pluigin scripts using a \c Stomp inspired communication protocol.
   *
   * \note \ref PluginScript is copyable and assignable, but the connection is shared
   * among multiple copies. It gets automatically closed if the last copy goes out of
   * scope.
   *
   * Timeout when sending/receiving data to/from a plugin default to 30 sec. The value
   * (in seconds) my be changed via the environment variables \c ZYPP_PLUGIN_SEND_TIMEOUT,
   * \c ZYPP_PLUGIN_RECEIVE_TIMEOUT or \c ZYPP_PLUGIN_TIMEOUT (both: send and receive).
   *
   * \code
   *  // Setup comnnection to plugin script
   *  PluginScript scr;
   *  PluginScript::Arguments args;
   *  args.push_back( "-v" );
   *  scr.open( "/soem/testplugin", args );
   *
   *  // send frame to plugin
   *  PluginFrame f( "COMMAND" );
   *  f.setHeader( "key", "value" );
   *  f.setBody( "some\ndata" );
   *  scr.send( f );
   *
   *  // receive frame from plugin
   *  PluginFrame r( scr.receive() );
   *
   *  // explicitly close or let PluginScript go out of scope
   *  scr.close();
   * \endcode
   *
   * \see http://stomp.codehaus.org/
   */
  class PluginScript
  {
    friend std::ostream & operator<<( std::ostream & str, const PluginScript & obj );

    public:
      /** Commandline arguments passed to a script on \ref open. */
      typedef std::vector<std::string> Arguments;

      /** \c pid_t(-1) constant indicating no connection. */
      static const pid_t NotConnected;

    public:
      /** \name Get/set the global timeout settings.
       * Timeout when sending/receiving data to/from a plugin default to 30 sec. The value
       * (in seconds) my be changed via the environment variables \c ZYPP_PLUGIN_SEND_TIMEOUT,
       * \c ZYPP_PLUGIN_RECEIVE_TIMEOUT or \c ZYPP_PLUGIN_TIMEOUT (both: send and receive).
       */
      //@{
	/** Global default timeout (sec.) when sending data. */
	static long defaultSendTimeout();

	/** Global default timeout (sec.) when receiving data. */
	static long defaultReceiveTimeout();

	/** Set global default timeout (sec.) when sending data. */
	static void defaultSendTimeout( long newval_r );

	/** Set global default timeout (sec.) when receiving data. */
	static void defaultReceiveTimeout( long newval_r );

	/** Set global default timeout (sec.) (both: send and receive).*/
	static void defaultTimeout( long newval_r )
	{ defaultSendTimeout( newval_r ); defaultReceiveTimeout( newval_r ); }
      //@}

    public:
      /** Default ctor. */
      PluginScript();

      /** Ctor taking script path and no arguments. */
      PluginScript( const Pathname & script_r );

      /** Ctor taking script path and script arguments. */
      PluginScript( const Pathname & script_r, const Arguments & args_r );

    public:
      /** Return the script path if set. */
      const Pathname & script() const;

      /** Return the script arguments if set. */
      const Arguments & args() const;

      /** Whether we are connected to a script. */
      bool isOpen() const;

      /** Return a connected scripts pid or \ref NotConnected. */
      pid_t getPid() const;

      /** Remembers a scripts return value after \ref close until next \ref open. */
      int lastReturn() const;

      /** Remembers a scripts execError string after \ref close until next \ref open.
       * \see \ref ExternalProgram::execError.
       */
      const std::string & lastExecError() const;

     public:
      /** \name Get/set local timeout settings. */
      //@{
	/** Local default timeout (sec.) when sending data. */
	long sendTimeout() const;

	/** Local default timeout (sec.) when receiving data. */
	long receiveTimeout() const;

	/** Set local default timeout (sec.) when sending data. */
	void sendTimeout( long newval_r );

	/** Set local default timeout (sec.) when receiving data. */
	void receiveTimeout( long newval_r );

	/** Set local default timeout (sec.) (both: send and receive).*/
	void timeout( long newval_r )
	{ sendTimeout( newval_r ); receiveTimeout( newval_r ); }
      //@}

   public:
      /** Setup connection and execute script.
       * \throw PluginScriptException if already connected to a script
       * \throw PluginScriptException if script does not exist or is not executable
       * \throw PluginScriptException on error
       */
      void open();

      /** \overload taking script path and no arguments. */
      void open( const Pathname & script_r );

      /** \overload taking script path and script arguments. */
      void open( const Pathname & script_r, const Arguments & args_r );

      /** Close any open connection. */
      int close();

    public:
      /** Send a \ref PluginFrame.
       * \throw PluginScriptNotConnected
       * \throw PluginScriptSendTimeout
       * \throw PluginScriptDiedUnexpectedly (does not \ref close)
       * \throw PluginScriptException on error
       *
       */
      void send( const PluginFrame & frame_r ) const;

      /** Receive a \ref PluginFrame.
       * \throw PluginScriptNotConnected
       * \throw PluginScriptReceiveTimeout
       * \throw PluginScriptDiedUnexpectedly (does not \ref close)
       * \throw PluginScriptException on error
       */
      PluginFrame receive() const;

    public:
      /** Implementation. */
      class Impl;
    private:
      /** Pointer to implementation. */
      RW_pointer<Impl> _pimpl;
  };

  /** \relates PluginScript Stream output */
  std::ostream & operator<<( std::ostream & str, const PluginScript & obj );

  /////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
#endif // ZYPP_PLUGINSCRIPT_H