Home | History | Annotate | Download | only in include
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 2017 Google Inc.
      4  *
      5  *  Licensed under the Apache License, Version 2.0 (the "License");
      6  *  you may not use this file except in compliance with the License.
      7  *  You may obtain a copy of the License at:
      8  *
      9  *  http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  *
     17  ******************************************************************************/
     18 #ifndef _DEBUG_NFCSNOOP_
     19 #define _DEBUG_NFCSNOOP_
     20 
     21 #include <stdint.h>
     22 #include "nfc_target.h"
     23 #include "nfc_types.h"
     24 
     25 #define NFCSNOOZ_CURRENT_VERSION 0x01
     26 
     27 // The preamble is stored un-encrypted as the first part
     28 // of the file.
     29 typedef struct nfcsnooz_preamble_t {
     30   uint8_t version;
     31   uint64_t last_timestamp_ms;
     32 } __attribute__((__packed__)) nfcsnooz_preamble_t;
     33 
     34 // One header for each NCI packet
     35 typedef struct nfcsnooz_header_t {
     36   uint16_t length;
     37   uint32_t delta_time_ms;
     38   uint8_t is_received;
     39 } __attribute__((__packed__)) nfcsnooz_header_t;
     40 
     41 // Initializes nfcsnoop memory logging and registers
     42 void debug_nfcsnoop_init(void);
     43 
     44 // Writes nfcsnoop data base64 encoded to fd
     45 void debug_nfcsnoop_dump(int fd);
     46 
     47 // capture the packet
     48 void nfcsnoop_capture(const NFC_HDR* packet, bool is_received);
     49 
     50 #endif /* _DEBUG_NFCSNOOP_ */
     51