The Smart Card Detective (SCD)
Functions
scd_logger.c File Reference

scd_logger.c source file More...

#include <string.h>
#include "scd_logger.h"
#include "scd_values.h"

Go to the source code of this file.

Functions

void ResetLogger (log_struct_t *logger)
 Reset the log buffer and position.
uint8_t LogByte1 (log_struct_t *logger, SCD_LOG_BYTE type, uint8_t byte_a)
 Log one byte of data.
uint8_t LogByte2 (log_struct_t *logger, SCD_LOG_BYTE type, uint8_t byte_a, uint8_t byte_b)
 Log two bytes of data.
uint8_t LogByte3 (log_struct_t *logger, SCD_LOG_BYTE type, uint8_t byte_a, uint8_t byte_b, uint8_t byte_c)
 Log three bytes of data.
uint8_t LogByte4 (log_struct_t *logger, SCD_LOG_BYTE type, uint8_t byte_a, uint8_t byte_b, uint8_t byte_c, uint8_t byte_d)
 Log four bytes of data.

Detailed Description

scd_logger.c source file

This file implements functions to update the SCD log structure

Copyright (C) 2012 Omar Choudary (omar.choudary@cl.cam.ac.uk)

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file scd_logger.c.


Function Documentation

uint8_t LogByte1 ( log_struct_t logger,
SCD_LOG_BYTE  type,
uint8_t  byte_a 
)

Log one byte of data.

Function used to log one byte of data.

Parameters:
loggerthe log structure
typethe kind of data to be logged
byte_athe byte to be logged
Returns:
zero if the logging was done or non-zero if some error (e.g. out of memory or wrong tag) ocurred

Definition at line 61 of file scd_logger.c.

uint8_t LogByte2 ( log_struct_t logger,
SCD_LOG_BYTE  type,
uint8_t  byte_a,
uint8_t  byte_b 
)

Log two bytes of data.

Function used to log two bytes of data.

Parameters:
loggerthe log structure
typethe kind of data to be logged
byte_athe first byte to be logged
byte_bthe second byte to be logged
Returns:
zero if the logging was done or non-zero if error
See also:
LogByte1

Definition at line 86 of file scd_logger.c.

uint8_t LogByte3 ( log_struct_t logger,
SCD_LOG_BYTE  type,
uint8_t  byte_a,
uint8_t  byte_b,
uint8_t  byte_c 
)

Log three bytes of data.

Function used to log three bytes of data.

Parameters:
loggerthe log structure
typethe kind of data to be logged
byte_athe first byte to be logged
byte_bthe second byte to be logged
byte_cthe third byte to be logged
Returns:
zero if the logging was done or non-zero if error
See also:
LogByte1

Definition at line 115 of file scd_logger.c.

uint8_t LogByte4 ( log_struct_t logger,
SCD_LOG_BYTE  type,
uint8_t  byte_a,
uint8_t  byte_b,
uint8_t  byte_c,
uint8_t  byte_d 
)

Log four bytes of data.

Function used to log four bytes of data.

Parameters:
loggerthe log structure
typethe kind of data to be logged
byte_athe first byte to be logged
byte_bthe second byte to be logged
byte_cthe third byte to be logged
byte_dthe fourth byte to be logged
Returns:
zero if the logging was done or non-zero if error
See also:
LogByte1

Definition at line 145 of file scd_logger.c.

void ResetLogger ( log_struct_t logger)

Reset the log buffer and position.

Function to reset the log structure

Parameters:
loggerthe log structure

Definition at line 43 of file scd_logger.c.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines