This file is indexed.

/usr/include/libroar/services.h is in libroar-dev 1.0~beta11-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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
//services.h:

/*
 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2014
 *
 *  This file is part of libroar a part of RoarAudio,
 *  a cross-platform sound system for both, home and professional use.
 *  See README for details.
 *
 *  This file is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 3
 *  as published by the Free Software Foundation.
 *
 *  libroar 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this software; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 *  Boston, MA 02110-1301, USA.
 *
 *  NOTE for everyone want's to change something and send patches:
 *  read README and HACKING! There a addition information on
 *  the license of this document you need to read before you send
 *  any patches.
 *
 *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
 *  or libpulse*:
 *  The libs libroaresd, libroararts and libroarpulse link this lib
 *  and are therefore GPL. Because of this it may be illigal to use
 *  them with any software that uses libesd, libartsc or libpulse*.
 */

#ifndef _LIBROARSERVICES_H_
#define _LIBROARSERVICES_H_

#include "libroar.h"

enum roar_service_num {
 // Error value in case any function returns this type.
 // roar_error must be set on return.
 ROAR_SERVICE_NUM_ERROR   = -1,
#define ROAR_SERVICE_NUM_ERROR ROAR_SERVICE_NUM_ERROR
 // reserved for future use.
 ROAR_SERVICE_NUM_DEFAULT =  0,
//#define ROAR_SERVICE_NUM_DEFAULT ROAR_SERVICE_NUM_DEFAULT
 // current number of objects.
 ROAR_SERVICE_NUM_CURRENT =  1,
#define ROAR_SERVICE_NUM_CURRENT ROAR_SERVICE_NUM_CURRENT
 // minumum number of objects. Optional.
 ROAR_SERVICE_NUM_MIN,
#define ROAR_SERVICE_NUM_MIN ROAR_SERVICE_NUM_MIN
 // maximum number of objects. Optional.
 ROAR_SERVICE_NUM_MAX,
#define ROAR_SERVICE_NUM_MAX ROAR_SERVICE_NUM_MAX
 // average number of objects. Optional.
 ROAR_SERVICE_NUM_AVG,
#define ROAR_SERVICE_NUM_AVG ROAR_SERVICE_NUM_AVG
 // Hint for buffer size used to list(). list() can still return 'buffer to short'.
 ROAR_SERVICE_NUM_BUFFER,
#define ROAR_SERVICE_NUM_BUFFER ROAR_SERVICE_NUM_BUFFER
};

// clients:
#define ROAR_SERVICE_CLIENT_NAME "client"
#define ROAR_SERVICE_CLIENT_ABI  "1.0beta9-pr1"
struct roar_client;
struct roar_service_client {
 // get list of client IDs.
 // buffer is passed as ids, buffer size (in elements) is passed as len.
 // returns the number of elements stored in ids or -1 on error.
 ssize_t (*list)(int * ids, size_t len);
 // get the number of clients. See also comments above on what.
 ssize_t (*num)(enum roar_service_num what);
 // get a client by ID. The object returned is a copy and must not be motified.
 int (*get)(int id, struct roar_client * client);
 // kick a client by ID. The reason for the kick is stored in error and msg.
 // if msg is NULL it defaults to roar_error2str(error).
 int (*kick)(int id, int error, const char * msg);
 // return status of client as returned by CPI's status() callback.
 int (*status)(int id);

 // optional functions follow:

 // set PID, UID and/or GID for client.
 // if any ID is -1 the old value is not touched if clear is false.
 // if clear is false IDs passed as -1 are reset to 'not set'.
 // if altering IDs changes the permissions of a given client is up to the
 // provider.
 int (*set_ids)(int id, int clear, int pid, int uid, int gid);
 // set the name of the client.
 // the name is copied within this call so the bufer holding it can be freed.
 int (*set_name)(int id, const char * name);
 // this will change the protocol of the client.
 int (*set_proto)(int id, int proto);
 // this execes the stream.
 // the stream must be owned by the client.
 // if stream is -1 the client is execed.
 // This will result in the client be completly reset to a state
 // as directly after accept(). This must be followed by a call to set_proto().
 int (*exec)(int id, int stream);
};

// streams:
struct roar_stream_info;
struct roar_stream_rpg;
struct roar_service_stream {
 // get list of stream IDs.
 // buffer is passed as ids, buffer size (in elements) is passed as len.
 // returns the number of elements stored in ids or -1 on error.
 ssize_t (*list)(int * ids, size_t len);
 // get the number of streams. See also comments above on what.
 ssize_t (*num)(enum roar_service_num what);
 // get a stream by ID. The object returned is a copy and must not be motified.
 int (*get)(int id, struct roar_stream * s, struct roar_stream_info * info);
 // kick a stream by ID. The reason for the kick is stored in error and msg.
 // if msg is NULL it defaults to roar_error2str(error).
 int (*kick)(int id, int error, const char * msg);

 // optional functions follow:

 // create a new stream.
 // if parent is set to -1 a normal stream is created.
 // if it is set to the ID of an existing stream it is created as child/virtual stream.
 // if mixer is set to -1 the default mixer is used.
 int (*new)(const struct roar_audio_info * info, int dir, int parent, int mixer);
 // get the ID of the client owning the stream.
 int (*get_client)(int id);
 // set the owner of the stream.
 // if the stream is already owned by a client it is moved if possible.
 int (*set_client)(int id, int client);
 // set role of stream.
 // if role is passed as -1 the role is cleared.
 int (*set_role)(int id, int role);
 // alter stream flags.
 int (*set_flag)(int id, uint32_t flags, int action);
 // get name of stream.
 // the buffer returned in *name must be freed using roar_mm_free().
 int (*get_name)(int id, char ** name);
 // set name of stream.
 // stream name will be copied so the buffer can be freed after this call.
 // passing NULL will unset the stream name.
 int (*set_name)(int id, const char * name);
 // set volume and rpg settings.
 // If mixer or rpg is NULL the corresponding setting is not touched.
 // if both are NULL this does nothing.
 int (*set_volume)(int id, const struct roar_mixer_settings * mixer, const struct roar_stream_rpg * rpg);
};

// about:
#define ROAR_SERVICE_ABOUT_NAME "about"
#define ROAR_SERVICE_ABOUT_ABI  "1.0beta9"
struct roar_service_about {
 int (*show)(const struct roar_dl_libraryname * libname);
};

// help:
#define ROAR_SERVICE_HELP_NAME "help"
#define ROAR_SERVICE_HELP_ABI  "1.0beta9"
struct roar_service_help {
 int (*show)(const struct roar_dl_libraryname * libname, const char * topic);
};

// prefs:
// procctl:
#define ROAR_SERVICE_PROCCTL_ERROR     ((uint_least32_t)0xFFFFFFFFUL)
#define ROAR_SERVICE_PROCCTL_NONE      ((uint_least32_t)0x00000000UL)
#define ROAR_SERVICE_PROCCTL_ALL       ((uint_least32_t)0x7FFFFFFFUL)
#define ROAR_SERVICE_PROCCTL_CONFIG    ((uint_least32_t)0x00000001UL)
#define ROAR_SERVICE_PROCCTL_LOGFILE   ((uint_least32_t)0x00000002UL)
#define ROAR_SERVICE_PROCCTL_PIDFILE   ((uint_least32_t)0x00000004UL)

struct roar_service_procctl {
 // terminate the process.
 // rv is the return POSIX return code.
 // a value of zero means no error.
 // a value of -1 means the provider should decide the value
 // based on the other parameters.
 // a value smaller than -1 is not allowed.
 // all other values indicate some kind of error.
 // error and msg give a closer information why the process is terminated.
 // those can be be used in case rv is set to -1. they can also be printed
 // or logged by the the provider for later inspection.
 int (*exit)(int rv, int error, const char * msg);

 // optional functions follow:

 // restart the process.
 int (*restart)(void);
 // daemonize the process.
 // the process is moved into background, detaching from the console.
 int (*daemonize)(void);
 // reload config or other parts. See above.
 int (*reload)(uint_least32_t what);
 // reopen logfiles or other parts. See above.
 int (*reopen)(uint_least32_t what);
};

// queue:
struct roar_service_queue {
 ssize_t (*list)(int * ids, size_t len);
 ssize_t (*num)(enum roar_service_num what);
 int (*get_name)(int id, char ** name);
 // status?
 int (*play)(int id);
 int (*stop)(int id);
 int (*pause)(int id, int how);
 int (*next)(int id);
 int (*prev)(int id);
};

// GPIO/Sensors:
#define ROAR_SERVICE_GPIO_NAME "gpio"
#define ROAR_SERVICE_GPIO_ABI  "1.0beta10-pr0"

#define ROAR_SERVICE_GPIO_FINPUT    ((uint_least32_t)0x00000001UL)
#define ROAR_SERVICE_GPIO_FOUTPUT   ((uint_least32_t)0x00000002UL)
#define ROAR_SERVICE_GPIO_FPULLDOWN ((uint_least32_t)0x00000004UL)
#define ROAR_SERVICE_GPIO_FPULLUP   ((uint_least32_t)0x00000008UL)
#define ROAR_SERVICE_GPIO_FCACHED   ((uint_least32_t)0x00000010UL)

enum roar_service_gpio_type {
 ROAR_SERVICE_GPIO_TERROR = -1,
 ROAR_SERVICE_GPIO_TUNKNOWN = 0,
 ROAR_SERVICE_GPIO_TINT,
 ROAR_SERVICE_GPIO_TENUM,
 ROAR_SERVICE_GPIO_TBOOL,
 ROAR_SERVICE_GPIO_TTRISTATE,
 ROAR_SERVICE_GPIO_TFLOAT
};

enum roar_service_gpio_state {
 ROAR_SERVICE_GPIO_SERROR = -1,
 ROAR_SERVICE_GPIO_SUNKNOWN = 0,
 ROAR_SERVICE_GPIO_SFREE,
 ROAR_SERVICE_GPIO_SUNINITED,
 ROAR_SERVICE_GPIO_SREADY,
 ROAR_SERVICE_GPIO_SBUSY,
 ROAR_SERVICE_GPIO_SDISCONNECTED,
 ROAR_SERVICE_GPIO_SDISABLED,
 ROAR_SERVICE_GPIO_SINERROR
};

struct roar_service_gpio_port {
 int id;
 const char * name;
 uint_least32_t mode;
 const char * unit;
 enum roar_service_gpio_type type;
 enum roar_service_gpio_state state;
 int irange_min;
 int irange_max;
 double frange_min;
 double frange_max;
};

struct roar_service_gpio {
 // get list of gpio IDs.
 // buffer is passed as ids, buffer size (in elements) is passed as len.
 // returns the number of elements stored in ids or -1 on error.
 ssize_t (*list)(int * ids, size_t len);
 // get the number of gpios. See also comments above on what.
 ssize_t (*num)(enum roar_service_num what);
 // get a gpio by ID. The object returned is a copy and must not be motified or freed.
 int (*get)(int id, struct roar_service_gpio_port * port);

 // Sets up ports.
 // the controler should set mode and state of port to given target mode and state.
 // If id is given as -1 this is about the controler. mode MUST NOT contain any
 // flags beside ROAR_SERVICE_GPIO_FCACHED. If ROAR_SERVICE_GPIO_FCACHED
 // is set it is applied all ports.
 int (*setup)(int id, uint_least32_t mode, enum roar_service_gpio_state state);

 // get value of port (input or output) as int or float.
 int (*get_int)(int id);
 double (*get_float)(int id);

 // set value of output (as int or float).
 int (*set_int)(int id, int val);
 int (*set_float)(int id, double val);

 // convert the value val as returned by the port to the base unit of the port.
 // if rev is set converst from the base unit to the value as used by the port.
 int (*convert_int)(int id, int val, int rev);
 double (*convert_float)(int id, double val, int rev);
};

#endif

//ll