source: trunk/src/ifd/internal.h @ 1156

Revision 1156, 6.8 KB checked in by alonbl, 3 years ago (diff)

Fix implicit declarations in OpenCT

by Arfrever Frehtes Taifersar Arahesis.

I'm attaching the patch which fixes the following compiler warnings in OpenCT:

ifdhandler.c: In function ‘ifdhandler_error’:
ifdhandler.c:299: warning: implicit declaration of function ‘ifd_error’
ifdhandler.c: In function ‘ifdhandler_event’:
ifdhandler.c:313: warning: implicit declaration of function ‘ifd_event’

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/*
2 * Core functions of the IFD handler library
3 *
4 * Copyright (C) 2003, Olaf Kirch <okir@suse.de>
5 */
6
7#ifndef IFD_INTERNAL_H
8#define IFD_INTERNAL_H
9
10#ifdef HAVE_CONFIG_H
11#include <config.h>
12#endif
13#ifdef HAVE_SYS_TIME_H
14#include <sys/time.h>
15#endif
16#include <openct/types.h>
17#include <openct/ifd.h>
18#include <openct/device.h>
19#include <openct/driver.h>
20#include <openct/conf.h>
21#include <openct/logging.h>
22#include <openct/error.h>
23#include <openct/buffer.h>
24
25struct ifd_device {
26        char *name;
27        int type;
28        long timeout;
29
30        unsigned int hotplug:1;
31
32        int fd;
33        void *dev;              /* use instead of fd, if no fd available for implementation */
34
35        ifd_device_params_t settings;
36        struct ifd_device_ops *ops;
37
38        void *user_data;
39
40        /* per-device data may follow */
41
42        unsigned int etu;       /* XXX: unnecessary? */
43};
44
45struct ifd_device_ops {
46        /* Reset device */
47        int (*reset) (ifd_device_t *);
48
49        int (*set_params) (ifd_device_t *, const ifd_device_params_t *);
50        int (*get_params) (ifd_device_t *, ifd_device_params_t *);
51
52        /* Flush any pending input */
53        void (*flush) (ifd_device_t *);
54        void (*send_break) (ifd_device_t *, unsigned int);
55
56        /*
57         * Send/receive data. Some devices such as USB will support
58         * the transceive command, others such as serial devices will
59         * need to use send/recv
60         */
61        int (*transceive) (ifd_device_t *,
62                           const void *, size_t, void *, size_t, long);
63        int (*send) (ifd_device_t *, const unsigned char *, size_t);
64        int (*recv) (ifd_device_t *, unsigned char *, size_t, long);
65        int (*control) (ifd_device_t *, void *, size_t);
66
67        void (*close) (ifd_device_t *);
68
69        int (*get_eventfd) (ifd_device_t *, short *events);
70
71        /* Poll for device presence. This function is called
72         * prior to the poll call (with revents == 0), in this
73         * case poll_presence is supposed to set up the poll
74         * structure.
75         * Then, it is called after poll() returns - in this case
76         * it should check the contents of pollfd to find out
77         * whether the device got removed.
78         *
79         * This is pretty much tailored for USB support, so
80         * the addition of PCMCIA devices may cause this
81         * to change.
82         */
83        int (*poll_presence) (ifd_device_t *, struct pollfd *);
84};
85
86struct ifd_protocol_ops {
87        int id;
88        const char *name;
89        size_t size;
90        int (*init) (ifd_protocol_t *);
91        void (*release) (ifd_protocol_t *);
92        int (*set_param) (ifd_protocol_t *, int, long);
93        int (*get_param) (ifd_protocol_t *, int, long *);
94        int (*resynchronize) (ifd_protocol_t *, int dad);
95        int (*transceive) (ifd_protocol_t *, int dad,
96                           const void *, size_t, void *, size_t);
97        int (*sync_read) (ifd_protocol_t *, int,
98                          unsigned short, unsigned char *, size_t);
99        int (*sync_write) (ifd_protocol_t *, int,
100                           unsigned short, const unsigned char *, size_t);
101};
102
103struct ifd_protocol {
104        ifd_reader_t *reader;
105        unsigned int dad;
106        struct ifd_protocol_ops *ops;
107};
108
109extern struct ifd_protocol_ops ifd_protocol_t1;
110extern struct ifd_protocol_ops ifd_protocol_t0;
111extern struct ifd_protocol_ops ifd_protocol_gbp;
112extern struct ifd_protocol_ops ifd_protocol_trans;
113extern struct ifd_protocol_ops ifd_protocol_i2c_short;
114extern struct ifd_protocol_ops ifd_protocol_i2c_long;
115extern struct ifd_protocol_ops ifd_protocol_2wire;
116extern struct ifd_protocol_ops ifd_protocol_3wire;
117extern struct ifd_protocol_ops ifd_protocol_eurochip;
118extern struct ifd_protocol_ops ifd_protocol_esc;
119
120extern void ifd_acr30u_register(void);
121extern void ifd_cardman_register(void);
122extern void ifd_ccid_register(void);
123extern void ifd_cm4000_register(void);
124extern void ifd_egate_register(void);
125extern void ifd_epass3k_register(void);
126extern void ifd_etoken_register(void);
127extern void ifd_etoken64_register(void);
128extern void ifd_eutron_register(void);
129extern void ifd_gempc_register(void);
130extern void ifd_ikey2k_register(void);
131extern void ifd_ikey3k_register(void);
132extern void ifd_kaan_register(void);
133extern void ifd_pertosmart_ac1030_register(void);
134extern void ifd_pertosmart_ac1038_register(void);
135extern void ifd_smartboard_register(void);
136extern void ifd_smph_register(void);
137extern void ifd_starkey_register(void);
138extern void ifd_towitoko_register(void);
139/* extern void ifd_wbeiuu_register(void); driver not working yet */
140extern void ifd_cyberjack_register(void);
141extern void ifd_rutoken_register(void);
142
143/* reader.c */
144extern int ifd_error(ifd_reader_t *);
145extern int ifd_event(ifd_reader_t *);
146extern int ifd_send_command(ifd_protocol_t *, const void *, size_t);
147extern int ifd_recv_response(ifd_protocol_t *, void *, size_t, long);
148
149/* driver.c */
150extern unsigned int ifd_drivers_list(const char **, size_t);
151
152/* device.c */
153extern ifd_device_t *ifd_open_pcmcia_block(const char *);
154extern ifd_device_t *ifd_open_pcmcia(const char *);
155extern ifd_device_t *ifd_open_psaux(const char *);
156extern ifd_device_t *ifd_open_remote(const char *);
157extern ifd_device_t *ifd_open_serial(const char *);
158extern ifd_device_t *ifd_open_usb(const char *);
159extern ifd_device_t *ifd_device_new(const char *,
160                                    struct ifd_device_ops *, size_t);
161extern void ifd_device_free(ifd_device_t *);
162
163/* checksum.c */
164extern unsigned int csum_lrc_compute(const uint8_t *, size_t, unsigned char *);
165extern unsigned int csum_crc_compute(const uint8_t *, size_t, unsigned char *);
166
167/* Internal system dependent device functions */
168extern int ifd_sysdep_usb_poll_presence(ifd_device_t *, struct pollfd *);
169extern int ifd_sysdep_usb_get_eventfd(ifd_device_t *, short *events);
170extern int ifd_sysdep_usb_control(ifd_device_t *,
171                                  unsigned int,
172                                  unsigned int,
173                                  unsigned int,
174                                  unsigned int, void *, size_t, long);
175extern int ifd_sysdep_usb_bulk(ifd_device_t *, int, void *, size_t, long);
176extern int ifd_sysdep_usb_set_configuration(ifd_device_t *, int);
177extern int ifd_sysdep_usb_set_interface(ifd_device_t *, int, int);
178extern int ifd_sysdep_usb_claim_interface(ifd_device_t *, int);
179extern int ifd_sysdep_usb_release_interface(ifd_device_t *, int);
180extern int ifd_sysdep_usb_begin_capture(ifd_device_t *, int, int, size_t,
181                                        ifd_usb_capture_t **);
182extern int ifd_sysdep_usb_capture_event(ifd_device_t *, ifd_usb_capture_t *,
183                           void *, size_t);
184extern int ifd_sysdep_usb_capture(ifd_device_t *, ifd_usb_capture_t *, void *,
185                                  size_t, long);
186extern int ifd_sysdep_usb_end_capture(ifd_device_t *, ifd_usb_capture_t * cap);
187extern int ifd_sysdep_usb_open(const char *device);
188extern int ifd_sysdep_usb_reset(ifd_device_t *);
189
190/* module.c */
191extern int ifd_load_module(const char *, const char *);
192
193/* utils.c */
194extern void ifd_revert_bits(unsigned char *, size_t);
195extern unsigned int ifd_count_bits(unsigned int);
196extern long ifd_time_elapsed(struct timeval *);
197#ifndef HAVE_DAEMON
198extern int daemon(int, int);
199#endif
200
201/* protocol.c */
202extern int ifd_protocol_register(struct ifd_protocol_ops *);
203extern int ifd_sync_detect_icc(ifd_reader_t *, int, void *, size_t);
204extern unsigned int ifd_protocols_list(const char **, unsigned int);
205
206/* proto-t1.c */
207extern int t1_negotiate_ifsd(ifd_protocol_t *, unsigned int, int);
208
209#endif                          /* IFD_INTERNAL_H */
Note: See TracBrowser for help on using the repository browser.