This file is indexed.

/usr/include/libinfinoted-plugin-manager-0.7/infinoted/infinoted-parameter.h is in libinfinity-0.7-dev 0.7.1-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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
/* libinfinity - a GObject-based infinote implementation
 * Copyright (C) 2007-2015 Armin Burgmeier <armin@arbur.net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

#ifndef __INFINOTED_PARAMETER_H__
#define __INFINOTED_PARAMETER_H__

#include <libinfinity/common/inf-xmpp-connection.h>
#include <libinfinity/inf-config.h>

#include <glib.h>

G_BEGIN_DECLS

#define INFINOTED_PARAMETER_TYPED_VALUE_TYPE        (infinoted_parameter_typed_value_get_type())

/**
 * InfinotedParameterType:
 * @INFINOTED_PARAMETER_BOOLEAN: A boolean parameter.
 * @INFINOTED_PARAMETER_INT: A signed integer parameter.
 * @INFINOTED_PARAMETER_STRING: A string parameter.
 * @INFINOTED_PARAMETER_STRING_LIST: An array of strings.
 *
 * Allowed types for a parameter that can be given to a infinoted plugin.
 */
typedef enum _InfinotedParameterType {
  INFINOTED_PARAMETER_BOOLEAN,
  INFINOTED_PARAMETER_INT,
  INFINOTED_PARAMETER_STRING,
  INFINOTED_PARAMETER_STRING_LIST
} InfinotedParameterType;

/**
 * InfinotedParameterFlags:
 * @INFINOTED_PARAMETER_REQUIRED: The parameter is required and cannot be
 * omitted.
 *
 * Additional flags for parameters that can be given to infinoted plugins.
 */
typedef enum _InfinotedParameterFlags {
  INFINOTED_PARAMETER_REQUIRED = 1 << 0
} InfinotedParameterFlags;

/**
 * InfinotedParameterValue:
 * @yesno: The parameter value for type %INFINOTED_PARAMETER_BOOLEAN.
 * @number: The parameter value for type %INFINOTED_PARAMETER_INT.
 * @str: The parameter value for type %INFINOTED_PARAMETER_STRING.
 * @strv: The parameter value for type %INFINOTED_PARAMETER_STRING_LIST.
 *
 * Holds the value of a infinoted parameter. The type of the parameter must
 * be known. See also #InfinotedParameterTypedValue.
 */
typedef union _InfinotedParameterValue InfinotedParameterValue;
union _InfinotedParameterValue {
  gboolean yesno;
  gint number;
  gchar* str;
  gchar** strv;
};

/**
 * InfinotedParameterTypedValue:
 * @type: The type of the parameter.
 * @value: The value of the parameter.
 *
 * Holds the type and value of a parameter that can be passed to an
 * infinoted plugin.
 */
typedef struct _InfinotedParameterTypedValue InfinotedParameterTypedValue;
struct _InfinotedParameterTypedValue {
  InfinotedParameterType type;
  InfinotedParameterValue value;
};

/**
 * InfinotedParameterConvertFunc:
 * @out: Location where the converted value should be written to.
 * @in: Location where the original input value should be taken from.
 * @error: Location for error information, if any, or %NULL.
 *
 * Definition of a parameter conversion function. A parameter conversion
 * function transforms the value of a read which is one of the
 * @InfinotedParameterValue enumeration to its final internal representation.
 * It can change the C type of the parameter, and it can also validate the
 * input and produce an error if the input value is invalid.
 *
 * While plugin developers can write their own conversion functions, many are
 * already provided by libinfinoted-plugin-manager that cover the most basic
 * usecases. These functions are 
 * infinoted_parameter_convert_string(),
 * infinoted_parameter_convert_string_list(),
 * infinoted_parameter_convert_filename(),
 * infinoted_parameter_convert_boolean(),
 * infinoted_parameter_convert_port(),
 * infinoted_parameter_convert_nonnegative(),
 * infinoted_parameter_convert_positive(),
 * infinoted_parameter_convert_security_policy() and
 * infinoted_parameter_convert_ip_address().
 *
 * Returns: %TRUE on success or %FALSE if an error occurred.
 */
typedef gboolean(*InfinotedParameterConvertFunc)(gpointer out,
                                                 gpointer in,
                                                 GError** error);

/**
 * InfinotedParameterInfo:
 * @name: The name of the parameter.
 * @type: The input type of the parameter.
 * @flags: Additional flags for the parameter.
 * @offset: Offset of the output value in the structure of the plugin. Should
 * be determined with %G_STRUCT_OFFSET.
 * @convert: The conversion function for the parameter, see
 * #InfinotedParameterConvertFunc.
 * @short_name: A short name (one character) for the parameter, used for
 * command line option parsing.
 * @description: A description for the parameter that can be shown in
 * <literal>--help</literal> output
 * @arg_description: A description for the argument of the parameter in
 * <literal>--help</literal> output, if any.
 *
 * This structure contains generic information about a parameter that can
 * be passed to an infinoted plugin.
 */
typedef struct _InfinotedParameterInfo InfinotedParameterInfo;
struct _InfinotedParameterInfo {
  const char* name;
  InfinotedParameterType type;
  InfinotedParameterFlags flags;
  size_t offset;
  InfinotedParameterConvertFunc convert;
  char short_name;
  const char* description;
  const char* arg_description;
};

/**
 * InfinotedParameterError:
 * @INFINOTED_PARAMETER_ERROR_REQUIRED: A parameter is required but was not
 * provided to the plugin.
 * @INFINOTED_PARAMETER_ERROR_INVALID_NUMBER: The number given as a parameter
 * is not valid, for example a negative time interval.
 * @INFINOTED_PARAMETER_ERROR_INVALID_FLAG: The flag with the given name does
 * not exist.
 * @INFINOTED_PARAMETER_ERROR_INVALID_SECURITY_POLICY: A security policy given
 * as a parameter is not valid. The only allowed values are
 * &quot;no-tls&quot;, &quot;allow-tls&quot;, and &quot;require-tls&quot;.
 * @INFINOTED_PARAMETER_ERROR_INVALID_IP_ADDRESS: The value given as a
 * parameter is not a valid IP address.
 *
 * Specifies the possible error conditions for errors in the
 * <literal>INFINOTED_PARAMETER_ERROR</literal> domain. These typically
 * occur when parsing and processing input parameters for plugins.
 */
typedef enum _InfinotedParameterError {
  INFINOTED_PARAMETER_ERROR_REQUIRED,
  INFINOTED_PARAMETER_ERROR_INVALID_NUMBER,
  INFINOTED_PARAMETER_ERROR_INVALID_FLAG,
  INFINOTED_PARAMETER_ERROR_INVALID_SECURITY_POLICY,
  INFINOTED_PARAMETER_ERROR_INVALID_IP_ADDRESS
} InfinotedParameterError;

GQuark
infinoted_parameter_error_quark(void);

GType
infinoted_parameter_typed_value_get_type(void) G_GNUC_CONST;

InfinotedParameterTypedValue*
infinoted_parameter_typed_value_new(void);

InfinotedParameterTypedValue*
infinoted_parameter_typed_value_copy(const InfinotedParameterTypedValue* val);

void
infinoted_parameter_typed_value_free(gpointer data);

gboolean
infinoted_parameter_load_from_key_file(const InfinotedParameterInfo* infos,
                                       GKeyFile* key_file,
                                       const gchar* group,
                                       gpointer base,
                                       GError** error);

gboolean
infinoted_parameter_convert_string(gpointer out,
                                   gpointer in,
                                   GError** error);

gboolean
infinoted_parameter_convert_string_list(gpointer out,
                                        gpointer in,
                                        GError** error);

gboolean
infinoted_parameter_convert_filename(gpointer out,
                                     gpointer in,
                                     GError** error);

gboolean
infinoted_parameter_convert_boolean(gpointer out,
                                    gpointer in,
                                    GError** error);

gboolean
infinoted_parameter_convert_port(gpointer out,
                                 gpointer in,
                                 GError** error);

gboolean
infinoted_parameter_convert_nonnegative(gpointer out,
                                        gpointer in,
                                        GError** error);

gboolean
infinoted_parameter_convert_positive(gpointer out,
                                     gpointer in,
                                     GError** error);

gboolean
infinoted_parameter_convert_security_policy(gpointer out,
                                            gpointer in,
                                            GError** error);

gboolean
infinoted_parameter_convert_flags(gpointer out,
                                  gpointer in,
                                  const GFlagsValue* values,
                                  GError** error);

gboolean
infinoted_parameter_convert_ip_address(gpointer out,
                                       gpointer in,
                                       GError** error);

G_END_DECLS

#endif /* __INFINOTED_PARAMETER_H__ */

/* vim:set et sw=2 ts=2: */