Skip to content

Commit

Permalink
Rename result.h to packet.h
Browse files Browse the repository at this point in the history
Include packet struct in it.
  • Loading branch information
yarrick committed Mar 26, 2021
1 parent cbaccfc commit 4e0f704
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

all: scsniff

DEPS = result.h atr.h session.h pps.h data.h
DEPS = packet.h atr.h session.h pps.h data.h
CFLAGS = -std=c99 -Wall -pedantic -Wtype-limits
MODULES = atr.o data.o pps.o session.o serial.o

Expand Down
2 changes: 1 addition & 1 deletion atr.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SCSNIFF_ATR_H
#define SCSNIFF_ATR_H

#include "result.h"
#include "packet.h"

#define ATR_TS_DIRECT (0x3B)
#define ATR_TS_INVERSE (0x3F)
Expand Down
2 changes: 1 addition & 1 deletion data.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SCSNIFF_DATA_H
#define SCSNIFF_DATA_H

#include "result.h"
#include "packet.h"

enum data_t0_state {
COMMAND = 0,
Expand Down
15 changes: 12 additions & 3 deletions result.h → packet.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#ifndef SCSNIFF_RESULT_H
#define SCSNIFF_RESULT_H
#ifndef SCSNIFF_PACKET_H
#define SCSNIFF_PACKET_H

#include <sys/time.h>

enum result {
CONTINUE = 0, // Need more bytes
Expand All @@ -10,4 +12,11 @@ enum result {
NOISE = 100, // Suspected noise, ignored
};

#endif // SCSNIFF_RESULT_H
struct packet {
unsigned char *data;
unsigned data_length;
enum result result;
struct timeval time;
};

#endif // SCSNIFF_PACKET_H
2 changes: 1 addition & 1 deletion pps.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SCSNIFF_PPS_H
#define SCSNIFF_PPS_H

#include "result.h"
#include "packet.h"

struct pps_msg {
unsigned bytes_seen;
Expand Down
2 changes: 1 addition & 1 deletion scsniff.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <unistd.h>
#include <sys/time.h>

#include "result.h"
#include "packet.h"
#include "serial.h"
#include "session.h"

Expand Down
9 changes: 1 addition & 8 deletions session.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <sys/time.h>

#include "result.h"
#include "packet.h"
#include "atr.h"
#include "data.h"
#include "pps.h"
Expand All @@ -19,13 +19,6 @@ enum session_state {

#define SESSION_BUFLEN (512)

struct packet {
unsigned char *data;
unsigned data_length;
enum result result;
struct timeval time;
};

typedef void (*set_baudrate_fn)(int fd, unsigned baudrate);

typedef void (*completed_packet_fn)(struct packet *packet);
Expand Down

0 comments on commit 4e0f704

Please sign in to comment.