summaryrefslogtreecommitdiff
path: root/tools/nfctool/nfctool.h
blob: 53d8f355e88bfe150b9949f5542bdac110675352 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 *
 *  Near Field Communication nfctool
 *
 *  Copyright (C) 2012  Intel Corporation. All rights reserved.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#ifndef __NFCTOOL_H
#define __NFCTOOL_H

#include "display.h"

#ifdef DEBUG
#define DBG(fmt, ...) fprintf(stdout, "%s: " fmt "\n", __func__, ## __VA_ARGS__)
#else
#define DBG(fmt, ...)
#endif

#define LLCP_COLOR COLOR_CYAN
#define LLCP_HEADER_INDENT 0
#define LLCP_MSG_INDENT    4

#define SNEP_COLOR COLOR_YELLOW
#define SNEP_HEADER_INDENT 4
#define SNEP_MSG_INDENT    6

#define NDEF_COLOR COLOR_BLUE
#define NDEF_HEADER_INDENT 6
#define NDEF_MSG_INDENT    8
#define NDEF_HEX_INDENT    9

#define print_error(fmt, ...) fprintf(stderr, fmt"\n", ## __VA_ARGS__)

#define POLLING_MODE_INITIATOR	0x01
#define POLLING_MODE_TARGET	0x02
#define POLLING_MODE_BOTH	0x03

#define INVALID_ADAPTER_IDX 0xFFFFFFFF

#define TARGET_TYPE_TAG		0
#define TARGET_TYPE_DEVICE	1

#define SNIFFER_SHOW_TIMESTAMP_NONE	0
#define SNIFFER_SHOW_TIMESTAMP_DELTA	1
#define SNIFFER_SHOW_TIMESTAMP_ABS	2

struct nfctool_options {
	gboolean show_version;
	gboolean list;
	gboolean poll;
	guint8 poll_mode;
	gchar *device_name;
	guint32 adapter_idx;
	gboolean set_param;
	gint32 lto;
	gint32 rw;
	gint32 miux;
	gboolean need_netlink;
	gboolean snl;
	GSList *snl_list;
	gboolean sniff;
	gsize snap_len;
	gboolean dump_symm;
	guint8 show_timestamp;
	guint8 snep_sap;
	gchar *pcap_filename;
};

struct nfc_snl {
	gchar *uri;
	gsize uri_size;
	guint8 sap;
};

struct nfc_snl *nfctool_snl_alloc(gsize uri_size);

void nfctool_sdres_free(struct nfc_snl *snl);

extern struct nfctool_options opts;


#endif /* __NFCTOOL_H */