1 /*
2   LibRCC - module comunicating with rcc-external helper application
3 
4   Copyright (C) 2005-2008 Suren A. Chilingaryan <csa@dside.dyndns.org>
5 
6   This library is free software; you can redistribute it and/or modify it
7   under the terms of the GNU Lesser General Public License version 2.1 or later
8   as published by the Free Software Foundation.
9 
10   This library is distributed in the hope that it will be useful, but WITHOUT
11   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
13   for more details.
14 
15   You should have received a copy of the GNU Lesser General Public License
16   along with this program; if not, write to the Free Software Foundation, Inc.,
17   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 #ifndef _RCC_EXTERNAL_H
21 #define _RCC_EXTERNAL_H
22 
23 #include "../config.h"
24 #ifdef HAVE_SYS_TYPES_H
25 # include <sys/types.h>
26 #endif /* HAVE_SYS_TYPES_H */
27 
28 typedef enum rcc_external_module_t {
29     RCC_EXTERNAL_MODULE_CONTROL = 0,
30     RCC_EXTERNAL_MODULE_OPTIONS,
31     RCC_EXTERNAL_MODULE_LIBRTRANSLATE,
32     RCC_EXTERNAL_MODULE_MAX
33 } rcc_external_module;
34 
35 struct rcc_external_info_t {
36     int s;
37 };
38 typedef struct rcc_external_info_t rcc_external_info_s;
39 typedef struct rcc_external_info_t *rcc_external_info;
40 
41 typedef enum rcc_external_option_t {
42     RCC_EXTERNAL_OPTION_OFFLINE = 0,
43     RCC_EXTERNAL_OPTION_MAX
44 } rcc_external_option;
45 
46 struct rcc_external_command_t {
47     unsigned long size;
48     unsigned char cmd;
49 };
50 typedef struct rcc_external_command_t rcc_external_command_s;
51 typedef struct rcc_external_command_t *rcc_external_command;
52 
53 #define RCC_EXTERNAL_COMMAND_CLOSE 0
54 
55 int rccExternalInit();
56 void rccExternalFree();
57 
58 int rccExternalAllowOfflineMode();
59 
60 size_t rccExternalWrite(int s, const char *buffer, ssize_t size, unsigned long timeout);
61 size_t rccExternalRead(int s, char *buffer, ssize_t size, unsigned long timeout);
62 int rccExternalConnect(unsigned char module);
63 void rccExternalClose(int s);
64 
65 #endif /* _RCC_EXTERNAL_H */
66