From 7600eb5ebbb8ac0f7532e7e7ae6cb5d4dc29d30b Mon Sep 17 00:00:00 2001 From: laforge Date: Tue, 8 Nov 2005 10:34:18 +0000 Subject: - better layering abstraciton - differentiate between library internal definitions and public ones - implement getopt/setopt like get/setsockopt - offer speed changing controls git-svn-id: https://svn.gnumonks.org/trunk/librfid@1662 e0336214-984f-0b4b-a45f-81c69e1f0ede --- include/rfid/rfid_layer2.h | 51 +++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 19 deletions(-) (limited to 'include/rfid/rfid_layer2.h') diff --git a/include/rfid/rfid_layer2.h b/include/rfid/rfid_layer2.h index f6d9117..54c3c46 100644 --- a/include/rfid/rfid_layer2.h +++ b/include/rfid/rfid_layer2.h @@ -1,16 +1,40 @@ #ifndef _RFID_LAYER2_H #define _RFID_LAYER2_H +#include +#include + struct rfid_layer2_handle; struct rfid_reader_handle; -#include +enum rfid_layer2_id { + RFID_LAYER2_NONE, + RFID_LAYER2_ISO14443A, + RFID_LAYER2_ISO14443B, + RFID_LAYER2_ISO15693, +}; + +struct rfid_layer2_handle *rfid_layer2_init(struct rfid_reader_handle *rh, + unsigned int id); +int rfid_layer2_open(struct rfid_layer2_handle *l2h); +int rfid_layer2_transcieve(struct rfid_layer2_handle *l2h, + enum rfid_frametype frametype, + const unsigned char *tx_buf, unsigned int tx_len, + unsigned char *rx_buf, unsigned int *rx_len, + u_int64_t timeout, unsigned int flags); +int rfid_layer2_close(struct rfid_layer2_handle *l2h); +int rfid_layer2_fini(struct rfid_layer2_handle *l2h); +int rfid_layer2_getopt(struct rfid_layer2_handle *ph, int optname, + void *optval, unsigned int *optlen); +int rfid_layer2_setopt(struct rfid_layer2_handle *ph, int optname, + const void *optval, unsigned int optlen); + +#ifdef __LIBRFID__ #include #include #include - struct rfid_layer2 { unsigned int id; char *name; @@ -26,6 +50,11 @@ struct rfid_layer2 { unsigned int flags); int (*close)(struct rfid_layer2_handle *h); int (*fini)(struct rfid_layer2_handle *h); + int (*getopt)(struct rfid_layer2_handle *h, + int optname, void *optval, unsigned int *optlen); + int (*setopt)(struct rfid_layer2_handle *h, + int optname, const void *optval, + unsigned int optlen); } fn; struct rfid_layer2 *next; }; @@ -42,22 +71,6 @@ struct rfid_layer2_handle { struct rfid_layer2 *l2; }; -enum rfid_layer2_id { - RFID_LAYER2_NONE, - RFID_LAYER2_ISO14443A, - RFID_LAYER2_ISO14443B, - RFID_LAYER2_ISO15693, -}; - -struct rfid_layer2_handle *rfid_layer2_init(struct rfid_reader_handle *rh, - unsigned int id); -int rfid_layer2_open(struct rfid_layer2_handle *l2h); -int rfid_layer2_transcieve(struct rfid_layer2_handle *l2h, - enum rfid_frametype frametype, - const unsigned char *tx_buf, unsigned int tx_len, - unsigned char *rx_buf, unsigned int *rx_len, - u_int64_t timeout, unsigned int flags); -int rfid_layer2_close(struct rfid_layer2_handle *l2h); -int rfid_layer2_fini(struct rfid_layer2_handle *l2h); +#endif /* __LIBRFID__ */ #endif -- cgit v1.2.3