X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/5bcb3496fa0409fb7a1dd22e9357a812c3f3f4fe..refs/heads/master:/client/emv/apduinfo.h?ds=inline

diff --git a/client/emv/apduinfo.h b/client/emv/apduinfo.h
index a3fa2049..d407a125 100644
--- a/client/emv/apduinfo.h
+++ b/client/emv/apduinfo.h
@@ -11,24 +11,56 @@
 #ifndef APDUINFO_H__
 #define APDUINFO_H__
 
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <inttypes.h>
+#include "util.h"
 
-#define APDUCODE_TYPE_NONE		0
-#define APDUCODE_TYPE_INFO		1
-#define APDUCODE_TYPE_WARNING	2
-#define APDUCODE_TYPE_ERROR		3
-#define APDUCODE_TYPE_SECURITY	4
+
+#define APDUCODE_TYPE_NONE     0
+#define APDUCODE_TYPE_INFO     1
+#define APDUCODE_TYPE_WARNING  2
+#define APDUCODE_TYPE_ERROR    3
+#define APDUCODE_TYPE_SECURITY 4
 
 typedef struct {
 	const char *ID;
 	const uint8_t Type;
 	const char *Description;
 } APDUCode;
-	
-extern const APDUCode* const GetAPDUCode(uint8_t sw1, uint8_t sw2);
-extern const char* GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2);
+
+typedef struct {
+	uint8_t CLA;
+	uint8_t INS;
+	uint8_t P1;
+	uint8_t P2;
+	uint8_t Lc;
+	uint8_t *data;
+} PACKED sAPDU;
+
+typedef struct {
+	uint8_t cla;
+	uint8_t ins;
+	uint8_t p1;
+	uint8_t p2;
+	uint8_t lc[3];
+} PACKED ExtAPDUHeader;
+
+typedef struct {
+	uint8_t cla;
+	uint8_t ins;
+	uint8_t p1;
+	uint8_t p2;
+	uint16_t lc;
+	uint8_t *data;
+	uint32_t le;
+	bool extended_apdu;
+	uint8_t case_type;
+} PACKED APDUStruct;
+
+extern const APDUCode *GetAPDUCode(uint8_t sw1, uint8_t sw2);
+extern const char *GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2);
+extern int APDUDecode(uint8_t *data, int len, APDUStruct *apdu);
+extern int APDUEncode(APDUStruct *apdu, uint8_t *data, int *len);
+extern int APDUEncodeS(sAPDU *apdu, bool extended, uint16_t le, uint8_t *data, int *len);
+extern void APDUPrint(APDUStruct apdu);
+extern void APDUPrintEx(APDUStruct apdu, size_t maxdatalen);
 
 #endif