summaryrefslogtreecommitdiff
path: root/include/rfid/rfid_layer2.h
blob: 40b9bffc1a6f1e675293a06fe28b16a9850d0b42 (plain)
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
#ifndef _RFID_LAYER2_H
#define _RFID_LAYER2_H

struct rfid_layer2_handle;
struct rfid_reader_handle;

#include <rfid/rfid_layer2_iso14443a.h>
#include <rfid/rfid_layer2_iso14443b.h>


struct rfid_layer2 {
	unsigned int id;
	char *name;

	struct {
		struct rfid_layer2_handle *(*init)(struct rfid_reader_handle *h);
		int (*open)(struct rfid_layer2_handle *h);
		int (*transcieve)(struct rfid_layer2_handle *h,
				  const unsigned char *tx_buf, 
				  unsigned int tx_len, unsigned char *rx_buf, 
				  unsigned int *rx_len, unsigned int timeout, 
				  unsigned int flags);
		int (*close)(struct rfid_layer2_handle *h);
		int (*fini)(struct rfid_layer2_handle *h);
	} fn;
	struct rfid_layer2 *next;
};

struct rfid_layer2_handle {
	struct rfid_reader_handle *rh;
	union {
		struct iso14443a_handle iso14443a;
		struct iso14443b_handle iso14443b;
		//struct iso15693_handle iso15693;
	} priv;
	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,
			   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_layer2_close(struct rfid_layer2_handle *l2h);
int rfid_layer2_fini(struct rfid_layer2_handle *l2h);

#endif
personal git repositories of Harald Welte. Your mileage may vary