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_protocol.h | 71 ++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 32 deletions(-) (limited to 'include/rfid/rfid_protocol.h') diff --git a/include/rfid/rfid_protocol.h b/include/rfid/rfid_protocol.h index 1403e83..bd9570f 100644 --- a/include/rfid/rfid_protocol.h +++ b/include/rfid/rfid_protocol.h @@ -5,8 +5,37 @@ struct rfid_protocol_handle; -#include -#include +struct rfid_protocol_handle * +rfid_protocol_init(struct rfid_layer2_handle *l2h, unsigned int id); +int rfid_protocol_open(struct rfid_protocol_handle *ph); +int rfid_protocol_transcieve(struct rfid_protocol_handle *ph, + const unsigned char *tx_buf, unsigned int tx_len, + unsigned char *rx_buf, unsigned int *rx_len, + unsigned int timeout, unsigned int flags); +int +rfid_protocol_read(struct rfid_protocol_handle *ph, + unsigned int page, + unsigned char *rx_data, + unsigned int *rx_len); + +int +rfid_protocol_write(struct rfid_protocol_handle *ph, + unsigned int page, + unsigned char *tx_data, + unsigned int tx_len); + +int rfid_protocol_fini(struct rfid_protocol_handle *ph); +int rfid_protocol_close(struct rfid_protocol_handle *ph); + +enum rfid_protocol_id { + RFID_PROTOCOL_UNKNOWN, + RFID_PROTOCOL_TCL, + RFID_PROTOCOL_MIFARE_UL, + RFID_PROTOCOL_MIFARE_CLASSIC, +}; + + +#ifdef __LIBRFID__ struct rfid_protocol { struct rfid_protocol *next; @@ -37,6 +66,12 @@ struct rfid_protocol { } fn; }; +int rfid_protocol_register(struct rfid_protocol *p); + +#include +#include +#include + struct rfid_protocol_handle { struct rfid_layer2_handle *l2h; struct rfid_protocol *proto; @@ -48,34 +83,6 @@ struct rfid_protocol_handle { * sizeof(priv). */ }; -struct rfid_protocol_handle * -rfid_protocol_init(struct rfid_layer2_handle *l2h, unsigned int id); -int rfid_protocol_open(struct rfid_protocol_handle *ph); -int rfid_protocol_transcieve(struct rfid_protocol_handle *ph, - const unsigned char *tx_buf, unsigned int tx_len, - unsigned char *rx_buf, unsigned int *rx_len, - unsigned int timeout, unsigned int flags); -int -rfid_protocol_read(struct rfid_protocol_handle *ph, - unsigned int page, - unsigned char *rx_data, - unsigned int *rx_len); +#endif /* __LIBRFID__ */ -int -rfid_protocol_write(struct rfid_protocol_handle *ph, - unsigned int page, - unsigned char *tx_data, - unsigned int tx_len); - -int rfid_protocol_fini(struct rfid_protocol_handle *ph); -int rfid_protocol_close(struct rfid_protocol_handle *ph); - -int rfid_protocol_register(struct rfid_protocol *p); - -enum rfid_protocol_id { - RFID_PROTOCOL_UNKNOWN, - RFID_PROTOCOL_TCL, - RFID_PROTOCOL_MIFARE_UL, - RFID_PROTOCOL_MIFARE_CLASSIC, -}; -#endif +#endif /* _RFID_PROTOCOL_H */ -- cgit v1.2.3