• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1syntax = "proto2";
2
3message Session {
4  repeated Command commands = 1;
5  optional bytes data_provider = 2;
6  optional SimulatePacketArrival setup_packet = 3;
7  optional DtaMode dta_mode = 4;
8}
9
10enum DtaMode {
11  FUZZER_NFA_DTA_DEFAULT_MODE = 0x1;
12  FUZZER_NFA_DTA_LLCP_MODE = 0x2;
13  FUZZER_NFA_DTA_HCEF_MODE = 0x4;
14  FUZZER_NFA_DTA_CR8 = 0x80;
15}
16
17message Command {
18  oneof command {
19    // HAL Simulation Messages
20    SimulatePacketArrival simulate_packet_arrival = 1;
21    SimulateHALEvent simulate_hal_event = 2;
22    SimulateStructuredPacket simulate_structured_packet = 3;
23    bytes send_raw_frame = 4;
24
25    // Asynchronous task handling
26    EmptyMessage do_nci_messages = 5;
27    EmptyMessage do_nfa_tasks = 6;
28    EmptyMessage simulate_timer_event = 7;
29    EmptyMessage simulate_quick_timer_event = 8;
30
31    // Configuration APIs
32    Select select = 9;
33    ConfigureUiccListenTech configure_uicc_listen_tech = 10;
34    EmptyMessage register_t3t = 11;
35    EmptyMessage start_rf_discovery = 12;
36    EmptyMessage stop_rf_discovery = 13;
37    EmptyMessage set_iso_listen_tech = 14;
38
39    // RW APIs
40    EmptyMessage rw_format_tag = 15;
41    RwPresenceCheck rw_presence_check = 16;
42    bool rw_set_tag_read_only = 17;
43
44    // EE APIs
45    EmptyMessage ee_update_now = 18;
46    EeAddAidRouting ee_add_aid_routing = 19;
47
48    // NDEF APIs
49    EmptyMessage read_ndef = 20;
50    EmptyMessage detect_ndef = 21;
51    WriteNdef write_ndef = 22;
52
53    // P2P APIs
54    P2pRegisterServer p2p_register_server = 23;
55    P2pAcceptConn p2p_accept_conn = 24;
56    EmptyMessage p2p_register_client = 25;
57    int32 p2p_deregister = 26;
58    P2pConnectBySap p2p_connect_by_sap = 27;
59    P2pConnectByName p2p_connect_by_name = 28;
60    P2pSendUi p2p_send_ui = 29;
61    P2pDisconnect p2p_disconnect = 30;
62    EmptyMessage pause_p2p = 31;
63    EmptyMessage resume_p2p = 32;
64    P2pReadData p2p_read_data = 33;
65    P2pSendData p2p_send_data = 34;
66  }
67}
68
69message ConfigureUiccListenTech {
70  optional int32 ee_handle = 1;
71  optional int32 tech_mask = 2;
72}
73
74message P2pDisconnect {
75  optional int32 handle = 1;
76  optional bool flush = 2;
77}
78
79message P2pSendUi {
80  optional int32 handle = 1;
81  optional int32 dsap = 2;
82  optional bytes data = 3;
83}
84
85message P2pConnectByName {
86  optional int32 client_handle = 1;
87  optional bytes service_name = 2;
88  optional int32 miu = 3;
89  optional int32 rw = 4;
90}
91
92message Select {
93  optional int32 rf_select_id = 1;
94  optional Protocol protocol = 2;
95  optional int32 rf_interface = 3;
96}
97
98message RwPresenceCheck {
99  enum PresChkOption {
100    FUZZING_NFA_RW_PRES_CHK_DEFAULT = 0;
101    FUZZING_NFA_RW_PRES_CHK_I_BLOCK = 1;
102    FUZZING_NFA_RW_PRES_CHK_ISO_DEP_NAK = 5;
103  }
104  optional PresChkOption option = 1;
105}
106
107message P2pConnectBySap {
108  optional int32 handle = 1;
109  optional int32 dsap = 2;
110  optional int32 miu = 3;
111  optional int32 rw = 4;
112}
113
114message P2pReadData {
115  optional int32 handle = 1;
116  optional int32 length = 2;
117}
118
119message P2pSendData {
120  optional int32 handle = 1;
121  optional bytes data = 2;
122}
123
124message P2pAcceptConn {
125  optional int32 handle = 1;
126  optional int32 miu = 2;
127  optional int32 rw = 3;
128}
129
130message P2pRegisterServer {
131  optional bytes service_name = 1;
132  optional int32 server_sap = 2;
133}
134
135message EeAddAidRouting {
136  optional int32 ee_handle = 1;
137  optional bytes aid = 2;
138  optional bool power_state = 3;
139  optional int32 aid_info = 4;
140}
141
142message EmptyMessage {}
143
144message SimulateStructuredPacket {
145  // Additional packet types, gids, and opcodes
146  // can be added here and in the child messages.
147  oneof packet {
148    MtNtf ntf = 1;
149  }
150}
151
152message MtNtf {
153  oneof gid {
154    RfManagementNtf rf_manage = 1;
155  }
156}
157
158message RfManagementNtf {
159  oneof opcode {
160    RfManageIntfActivated intf_activated = 1;
161  }
162}
163
164// RF_INTF_ACTIVATED_NTF message
165message RfManageIntfActivated {
166  optional int32 rf_discovery_id = 1;
167  optional Protocol rf_protocol = 2;
168  optional DiscoveryType data_mode = 3;
169  optional NfcBitRate tx_bitrate = 4;
170  optional NfcBitRate rx_bitrate = 5;
171  optional int32 buff_size = 6;
172  optional int32 num_buff = 7;
173  optional bytes rf_tech_param_buffer = 8;
174  optional bytes intf_param_buffer = 9;
175}
176
177enum NfcBitRate {
178  FUZZER_NCI_BIT_RATE_106 = 0x00;
179  FUZZER_NCI_BIT_RATE_212 = 0x01;
180  FUZZER_NCI_BIT_RATE_424 = 0x02;
181  FUZZER_NCI_BIT_RATE_848 = 0x03;
182  FUZZER_NCI_BIT_RATE_1696 = 0x04;
183  FUZZER_NCI_BIT_RATE_3392 = 0x05;
184  FUZZER_NCI_BIT_RATE_6784 = 0x06;
185}
186
187message NfcIntfFrame {
188  optional bytes param = 1;
189}
190
191message NfcIntfLaIsoDep {
192  optional int32 rats = 1;
193}
194
195message NfcIntfPaIsoDep {
196  optional bytes ats_res = 1;
197  optional bool nad_used = 2;
198  optional int32 fwi = 3;
199  optional int32 sfgi = 4;
200  optional bytes his_byte = 5;
201}
202
203message NfcIntfLbIsoDep {
204  optional bytes attrib_req = 1;
205  optional bytes hi_info = 2;
206  optional bytes nfcid0 = 3;
207}
208
209message NfcIntfPbIsoDep {
210  optional bytes attrib_res = 1;
211  optional bytes hi_info = 2;
212  optional int32 mbli = 3;
213}
214
215message NfcIntfLaNfcDep {
216  optional bytes atr_req = 1;
217  optional int32 max_payload_size = 2;
218  optional bytes gen_bytes = 3;
219}
220
221message NfcIntfPaNfcDep {
222  optional bytes atr_res = 1;
223  optional int32 max_payload_size = 2;
224  optional bytes gen_bytes = 3;
225  optional int32 waiting_time = 4;
226}
227
228message Protocol {
229  enum ProtocolValue {
230    FUZZER_PROTOCOL_UNKNOWN = 0;
231    FUZZER_PROTOCOL_T1T = 1;
232    FUZZER_PROTOCOL_T2T = 2;
233    FUZZER_PROTOCOL_T3T = 3;
234    FUZZER_PROTOCOL_T5T = 6;
235    FUZZER_PROTOCOL_ISO_DEP = 4;
236    FUZZER_PROTOCOL_NFC_DEP = 5;
237    // These are proprietary and must be converted at runtime
238    // based on the config.
239    // See src/include/vendor_cfg.h
240    FUZZER_PROTOCOL_MIFARE = 7;
241    FUZZER_PROTOCOL_ISO15693 = 8;
242    FUZZER_PROTOCOL_B_PRIME = 9;
243    FUZZER_PROTOCOL_KOVIO = 10;
244  }
245  // Only access this from within a helper function that
246  // does the runtime config-based conversion.
247  optional ProtocolValue value = 1;
248}
249
250message DiscoveryType {
251  enum DiscoveryTypeValue {
252    FUZZER_DISCOVERY_TYPE_POLL_A = 0x00;
253    FUZZER_DISCOVERY_TYPE_POLL_B = 0x01;
254    FUZZER_DISCOVERY_TYPE_POLL_F = 0x02;
255    FUZZER_DISCOVERY_TYPE_POLL_V = 0x06;
256    FUZZER_DISCOVERY_TYPE_POLL_A_ACTIVE = 0x03;
257    FUZZER_DISCOVERY_TYPE_POLL_F_ACTIVE = 0x05;
258    FUZZER_DISCOVERY_TYPE_LISTEN_A = 0x80;
259    FUZZER_DISCOVERY_TYPE_LISTEN_B = 0x81;
260    FUZZER_DISCOVERY_TYPE_LISTEN_F = 0x82;
261    FUZZER_DISCOVERY_TYPE_LISTEN_A_ACTIVE = 0x83;
262    FUZZER_DISCOVERY_TYPE_LISTEN_F_ACTIVE = 0x85;
263    FUZZER_DISCOVERY_TYPE_LISTEN_ISO15693 = 0x86;
264    // These are proprietary and must be converted at runtime
265    // based on the config.
266    FUZZER_DISCOVERY_TYPE_POLL_B_PRIME = 10;
267    FUZZER_DISCOVERY_TYPE_POLL_KOVIO = 11;
268    FUZZER_DISCOVERY_TYPE_LISTEN_B_PRIME = 12;
269  }
270  optional DiscoveryTypeValue value = 1;
271}
272
273message NfcRfPiso15693 {
274  optional int32 flag = 1;
275  optional bytes uid = 2;
276}
277
278message NfcRfPbParams {
279  optional bytes sensb_res = 1;
280  optional bytes nfcid0 = 2;
281}
282
283message NfcRfPfParams {
284  optional int32 bit_rate = 1;
285  optional bytes sensf_res = 2;
286  optional bytes nfcid2 = 3;
287  optional int32 mrti_check = 4;
288  optional int32 mrti_update = 5;
289}
290
291message NfcRfLfParams {
292  optional bytes nfcid2 = 1;
293}
294
295message NfcRfPiso15693Params {
296  optional int32 flag = 1;
297  optional int32 dsfid = 2;
298  optional bytes uid = 3;
299}
300
301message NfcRfPkovioParams {
302  optional bytes uid = 1;
303}
304
305message NfcRfAcmPParams {
306  optional bytes atr_res = 1;
307  optional int32 max_payload_size = 2;
308  optional bytes gen_bytes = 3;
309  optional int32 waiting_time = 4;
310}
311
312enum Mt {
313  FUZZER_NCI_MT_DATA = 0;
314  FUZZER_NCI_MT_CMD = 1;
315  FUZZER_NCI_MT_RSP = 2;
316  FUZZER_NCI_MT_NTF = 3;
317}
318
319enum Gid {
320  FUZZER_NCI_GID_CORE = 0x00;
321  FUZZER_NCI_GID_RF_MANAGE = 0x01;
322  FUZZER_NCI_GID_EE_MANAGE = 0x02;
323  FUZZER_NCI_GID_PROP = 0x0F;
324}
325
326enum Opcode {
327  option allow_alias = true;
328  FUZZER_NCI_MSG_CORE_RESET = 0;
329  FUZZER_NCI_MSG_CORE_INIT = 1;
330  FUZZER_NCI_MSG_CORE_SET_CONFIG = 2;
331  FUZZER_NCI_MSG_CORE_GET_CONFIG = 3;
332  FUZZER_NCI_MSG_CORE_CONN_CREATE = 4;
333  FUZZER_NCI_MSG_CORE_CONN_CLOSE = 5;
334  FUZZER_NCI_MSG_CORE_CONN_CREDITS = 6;
335  FUZZER_NCI_MSG_CORE_GEN_ERR_STATUS = 7;
336  FUZZER_NCI_MSG_CORE_INTF_ERR_STATUS = 8;
337  FUZZER_NCI_MSG_CORE_SET_POWER_SUB_STATE = 9;
338  FUZZER_NCI_MSG_RF_DISCOVER_MAP = 0;
339  FUZZER_NCI_MSG_RF_SET_ROUTING = 1;
340  FUZZER_NCI_MSG_RF_GET_ROUTING = 2;
341  FUZZER_NCI_MSG_RF_DISCOVER = 3;
342  FUZZER_NCI_MSG_RF_DISCOVER_SELECT = 4;
343  FUZZER_NCI_MSG_RF_INTF_ACTIVATED = 5;
344  FUZZER_NCI_MSG_RF_DEACTIVATE = 6;
345  FUZZER_NCI_MSG_RF_FIELD = 7;
346  FUZZER_NCI_MSG_RF_T3T_POLLING = 8;
347  FUZZER_NCI_MSG_RF_EE_ACTION = 9;
348  FUZZER_NCI_MSG_RF_EE_DISCOVERY_REQ = 10;
349  FUZZER_NCI_MSG_RF_PARAMETER_UPDATE = 11;
350  FUZZER_NCI_MSG_RF_ISO_DEP_NAK_PRESENCE = 16;
351  FUZZER_NCI_MSG_NFCEE_DISCOVER = 0;
352  FUZZER_NCI_MSG_NFCEE_MODE_SET = 1;
353  FUZZER_NCI_MSG_NFCEE_STATUS = 2;
354  FUZZER_NCI_MSG_NFCEE_POWER_LINK_CTRL = 3;
355}
356
357message SimulatePacketArrival {
358  optional bytes packet = 1;
359  optional Mt mt = 2;
360  optional Gid gid = 3;
361  optional Opcode opcode = 4;
362  optional bool pbf = 5;
363}
364
365enum HalEvent {
366  FUZZER_HAL_NFC_OPEN_CPLT_EVT = 0;
367  FUZZER_HAL_NFC_CLOSE_CPLT_EVT = 1;
368  FUZZER_HAL_NFC_POST_INIT_CPLT_EVT = 2;
369  FUZZER_HAL_NFC_PRE_DISCOVER_CPLT_EVT = 3;
370  FUZZER_HAL_NFC_REQUEST_CONTROL_EVT = 4;
371  FUZZER_HAL_NFC_RELEASE_CONTROL_EVT = 5;
372  FUZZER_HAL_NFC_ERROR_EVT = 6;
373}
374
375enum HalStatus {
376  FUZZER_HAL_NFC_STATUS_OK = 0;
377  FUZZER_HAL_NFC_STATUS_FAILED = 1;
378  FUZZER_HAL_NFC_STATUS_ERR_TRANSPORT = 2;
379  FUZZER_HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 3;
380  FUZZER_HAL_NFC_STATUS_REFUSED = 4;
381}
382
383message SimulateHALEvent {
384  optional HalEvent hal_event = 1;
385  optional HalStatus hal_status = 2;
386}
387
388message WriteNdef {
389  optional uint32 size = 1;
390}
391