[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-mdb] 19/93: GNUnet logs added, -h option added
From: |
gnunet |
Subject: |
[taler-taler-mdb] 19/93: GNUnet logs added, -h option added |
Date: |
Mon, 18 Nov 2019 21:12:42 +0100 |
This is an automated email from the git hooks/post-receive script.
marco-boss pushed a commit to branch master
in repository taler-mdb.
commit 34422344cd17bb4aa5bd0e1b187b26f076b677eb
Author: BOSS_Marco <address@hidden>
AuthorDate: Mon Nov 4 21:08:46 2019 +0100
GNUnet logs added, -h option added
---
src/communication.c | 50 +++++++++++++++++++++++++++++++++----------------
src/communication.h | 5 +++--
src/main.c | 31 +++++++++++++++++-------------
src/nfc.c | 31 +++++++++++++++++++-----------
src/nfc.h | 3 +--
src/product.c | 25 ++++++++++++++++---------
src/wallet.c | 54 ++++++++++++++++++++++++++++++++---------------------
src/wallet.h | 7 ++++---
8 files changed, 129 insertions(+), 77 deletions(-)
diff --git a/src/communication.c b/src/communication.c
index a9f2eb3..e685fa0 100644
--- a/src/communication.c
+++ b/src/communication.c
@@ -42,7 +42,8 @@ int SNACK_taler_init (CURL **curl)
*curl = curl_easy_init ();
if ( ! (*curl) ||(result != CURLE_OK))
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_init: could not
inizialize curl handle\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_taler_init: could not inizialize curl handle\n");
return EXIT_FAILURE;
}
@@ -60,14 +61,16 @@ int SNACK_taler_alloc_string (char **string, size_t size)
*string = malloc (size);
if ( ! (*string) )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_alloc: unable to allocate
string\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_taler_alloc: unable to allocate string\n");
exit (EXIT_FAILURE);
}
return EXIT_SUCCESS;
}
-static size_t _SNACK_taler_write_response (void *contents, size_t size, size_t
nmemb,
- void *userp)
+static size_t _SNACK_taler_write_response (void *contents, size_t size, size_t
+ nmemb,
+ void *userp)
{
char *tempString;
size_t realSize = size * nmemb;
@@ -76,7 +79,8 @@ static size_t _SNACK_taler_write_response (void *contents,
size_t size, size_t n
tempString = realloc (response->string, response->size + realSize + 1);
if ( ! tempString )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_write_response:
allocation failure\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_taler_write_response: allocation failure\n");
return EXIT_FAILURE;
}
@@ -110,7 +114,8 @@ int SNACK_taler_create_order_req (ProductOrder *product)
amountStr, JSON_REQ_FULFILLMENT, fulfillmentUrl);
if ( ! orderReq )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_create_order_req: error
creating json object\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_taler_create_order_req: error creating json object\n");
return EXIT_FAILURE;
}
@@ -118,7 +123,8 @@ int SNACK_taler_create_order_req (ProductOrder *product)
char *buffer = json_dumps (orderReq, JSON_COMPACT);
if ( ! buffer )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_create_order_req: error
converting json to string\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_taler_create_order_req: error converting json to
string\n");
return EXIT_FAILURE;
}
@@ -126,7 +132,8 @@ int SNACK_taler_create_order_req (ProductOrder *product)
temp = realloc (product->orderRequest, strlen (buffer) + 1);
if ( ! temp )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_create_order_req: could
not allocate order\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_taler_create_order_req: could not allocate order\n");
return EXIT_FAILURE;
}
product->orderRequest = temp;
@@ -173,7 +180,9 @@ int SNACK_taler_create_order (CURL *curl, ProductOrder
*product)
result = curl_easy_perform (curl);
if ( result != CURLE_OK )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_create_order: could not
communicate with \"%s\"\n", url);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_taler_create_order: could not communicate with
\"%s\"\n",
+ url);
return EXIT_FAILURE;
}
@@ -215,7 +224,9 @@ int SNACK_taler_check_payment_status (CURL *curl,
ProductOrder *product)
result = curl_easy_perform (curl);
if ( result != CURLE_OK )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_check_payment_status:
could not communicate with \"%s\"\n", product->checkUrl);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_taler_check_payment_status: could not communicate with
\"%s\"\n",
+ product->checkUrl);
return EXIT_FAILURE;
}
@@ -228,8 +239,9 @@ int SNACK_taler_check_payment_status (CURL *curl,
ProductOrder *product)
return EXIT_SUCCESS;
}
-int SNACK_taler_parse_json (const TalerResponse *response, const char
*memberName,
- char **returnStr)
+int SNACK_taler_parse_json (const TalerResponse *response, const
+ char *memberName,
+ char **returnStr)
{
/* json variables */
json_error_t error;
@@ -246,19 +258,24 @@ int SNACK_taler_parse_json (const TalerResponse
*response, const char *memberNam
root = json_loads (response->string, JSON_DISABLE_EOF_CHECK, &error);
if ( ! root )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_parse_json: %s\n",
error.text);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_parse_json: %s\n",
+ error.text);
return EXIT_FAILURE;
}
char *result = NULL;
if ( json_unpack (root, "{s:s}", memberName, &result) < 0 )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_parse_json: no member
named \"%s\" found!\n", memberName);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_taler_parse_json: no member named \"%s\" found!\n",
+ memberName);
json_decref (root);
return EXIT_FAILURE;
}
if ( ! result )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_parse_json: no member
named \"%s\" found!\n", memberName);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_taler_parse_json: no member named \"%s\" found!\n",
+ memberName);
json_decref (root);
return EXIT_FAILURE;
}
@@ -266,7 +283,8 @@ int SNACK_taler_parse_json (const TalerResponse *response,
const char *memberNam
temp = realloc (*returnStr, strlen (result) + 1);
if ( ! temp )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_parse_json: could not
allocate memory for member\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_taler_parse_json: could not allocate memory for
member\n");
json_decref (root);
return EXIT_FAILURE;
}
diff --git a/src/communication.h b/src/communication.h
index e33bb82..4f5f2bd 100644
--- a/src/communication.h
+++ b/src/communication.h
@@ -46,7 +46,8 @@ int SNACK_taler_create_order (CURL *curl, ProductOrder
*product);
int SNACK_taler_check_payment_status (CURL *curl, ProductOrder *product);
-int SNACK_taler_parse_json (const TalerResponse *response, const char
*memberName,
- char **returnStr);
+int SNACK_taler_parse_json (const TalerResponse *response, const
+ char *memberName,
+ char **returnStr);
#endif // COMM_H
diff --git a/src/main.c b/src/main.c
index 942dc09..185dc6c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -70,40 +70,42 @@ void *_SNACK_start_nfc_transmission (void *ignored)
return EXIT_SUCCESS;
}
-int main( int argc, char* const* argv )
+int main (int argc, char*const*argv)
{
CURL *curl;
struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_option_help( "This is an application for snack machines with
nfc. Running with GNU taler.\n" ),
- GNUNET_GETOPT_OPTION_END
+ GNUNET_GETOPT_option_help (
+ "This is an application for snack machines with nfc. Running with GNU
taler.\n"),
+ GNUNET_GETOPT_OPTION_END
};
- if( GNUNET_GETOPT_run("taler-mdb\n", options, argc, argv) <= 0 )
+ if ( GNUNET_GETOPT_run ("taler-mdb\n", options, argc, argv) <= 0 )
return EXIT_SUCCESS;
GNUNET_assert
- (GNUNET_OK == GNUNET_log_setup("taler-mdb", "DEBUG", NULL));
//"taler-mdb.log"));
+ (GNUNET_OK == GNUNET_log_setup ("taler-mdb", "DEBUG", NULL)); //
"taler-mdb.log"));
/* initialize nfc */
nfc_init (&context);
if ( ! context )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Unable to init nfc\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unable to init nfc\n");
return EXIT_FAILURE;
}
/* inizialize taler */
if ( SNACK_taler_init (&curl) )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Unable to init taler
communication\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unable to init taler communication\n");
return EXIT_FAILURE;
}
/* inizialize product */
if ( SNACK_product_init (&product, CURRENCY) )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Unable to init product structure\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unable to init product structure\n");
return EXIT_FAILURE;
}
@@ -142,24 +144,27 @@ int main( int argc, char* const* argv )
/* start a thread to send payment request to taler wallet */
pthread_t nfcThread;
- if ( pthread_create (&nfcThread, NULL, _SNACK_start_nfc_transmission,
NULL) )
+ if ( pthread_create (&nfcThread, NULL, _SNACK_start_nfc_transmission,
+ NULL) )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Thread creation failed\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Thread creation failed\n");
return EXIT_FAILURE;
}
/* check the payment status, if paid exit while loop and end thread
transmitting nfc messages */
while ( ! product.paid )
{
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Order payment processing\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Order payment processing\n");
sleep (5);
while ( SNACK_taler_check_payment_status (curl, &product) )
;
/* set the boolean paid member of ProductOrder struct */
SNACK_product_set_paid_status (&product);
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Payment status paid: %s\n",
(product.paid ? "true":"false") );
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Payment status paid: %s\n",
+ (product.paid ? "true" : "false") );
}
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Order no.: %s paid!\n",
product.orderID);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Order no.: %s paid!\n",
+ product.orderID);
/* -----------------
diff --git a/src/nfc.c b/src/nfc.c
index b2175f7..b816fd1 100644
--- a/src/nfc.c
+++ b/src/nfc.c
@@ -37,7 +37,8 @@ along with
#define UID_LEN_LOWER 4
-int SNACK_nfc_transmit (nfc_context *context, const char *talerPayUrl, size_t
urlSize)
+int SNACK_nfc_transmit (nfc_context *context, const char *talerPayUrl, size_t
+ urlSize)
{
nfc_device *pnd;
nfc_target nt;
@@ -45,20 +46,25 @@ int SNACK_nfc_transmit (nfc_context *context, const char
*talerPayUrl, size_t ur
pnd = nfc_open (context, NULL);
if ( ! pnd )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_nfc_transmit: Unable to open
nfc device\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_nfc_transmit: Unable to open nfc device\n");
return EXIT_FAILURE;
}
/* initialize device as reader */
if ( nfc_initiator_init (pnd) < 0 )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Snack_nfc_transmit: nfc_initator_init
error: %s", nfc_strerror(pnd) );
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Snack_nfc_transmit: nfc_initator_init error: %s",
+ nfc_strerror (pnd) );
nfc_close (pnd);
return EXIT_FAILURE;
}
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "SNACK_nfc_transmit: device: %s\n",
nfc_device_get_name (pnd));
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "SNACK_nfc_transmit: connstring: %s\n",
nfc_device_get_connstring (pnd));
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "SNACK_nfc_transmit: device: %s\n",
+ nfc_device_get_name (pnd));
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "SNACK_nfc_transmit: connstring: %s\n",
+ nfc_device_get_connstring (pnd));
/* connect to a target device */
if ( SNACK_nfc_connect_target (pnd, &nt) )
@@ -92,7 +98,8 @@ int SNACK_nfc_connect_target (nfc_device *pnd, nfc_target *nt)
.nbr = NBR_106,
} };
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "SNACK_nfc_connect_target: trying to
connect to target\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "SNACK_nfc_connect_target: trying to connect to target\n");
while ( ctr > 0 )
{
@@ -101,16 +108,19 @@ int SNACK_nfc_connect_target (nfc_device *pnd, nfc_target
*nt)
if ( nfc_initiator_select_passive_target (pnd, nmMifare[0], NULL, 0, nt) <=
0 )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_nfc_connect_target: failed to
connect\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_nfc_connect_target: failed to connect\n");
}
else if ((nt->nti.nai.szUidLen > UID_LEN_UPPER) ||(nt->nti.nai.szUidLen <
UID_LEN_LOWER) )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_nfc_connect_target: failed to
connect\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_nfc_connect_target: failed to connect\n");
}
else {
- GNUNET_log(GNUNET_ERROR_TYPE_MESSAGE, "SNACK_nfc_connect_target: Target
selected!\n");
- SNACK_print_hex_info( "UID", nt->nti.nai.abtUid, nt->nti.nai.szUidLen );
+ GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+ "SNACK_nfc_connect_target: Target selected!\n");
+ SNACK_print_hex_info ("UID", nt->nti.nai.abtUid, nt->nti.nai.szUidLen);
return EXIT_SUCCESS;
}
sleep (1);
@@ -119,4 +129,3 @@ int SNACK_nfc_connect_target (nfc_device *pnd, nfc_target
*nt)
return EXIT_FAILURE;
}
-
diff --git a/src/nfc.h b/src/nfc.h
index bdca9a9..62268ff 100644
--- a/src/nfc.h
+++ b/src/nfc.h
@@ -28,7 +28,6 @@ along with
#include <nfc/nfc.h>
int SNACK_nfc_transmit (nfc_context *context, const char *talerPayUrl, size_t
- urlSize);
+ urlSize);
int SNACK_nfc_connect_target (nfc_device *pnd, nfc_target *nt);
-
diff --git a/src/product.c b/src/product.c
index 46ccc1b..0f509fc 100644
--- a/src/product.c
+++ b/src/product.c
@@ -45,7 +45,8 @@ int SNACK_product_init (ProductOrder *product, const char
*currency)
{
if ( ! product )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_product_init: product order
struct must be provided\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_product_init: product order struct must be provided\n");
return EXIT_FAILURE;
}
@@ -54,7 +55,8 @@ int SNACK_product_init (ProductOrder *product, const char
*currency)
product->response = malloc (sizeof(TalerResponse) );
if ( ! product->response )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_product_init: unable to
allocate memory for response struct\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_product_init: unable to allocate memory for response
struct\n");
return EXIT_FAILURE;
}
if ( SNACK_taler_alloc_string (&(product->response->string), 1) )
@@ -98,14 +100,15 @@ int SNACK_product_set_check_url (ProductOrder *product)
product->orderID) + 1);
if ( ! url )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,"SNACK_prduct_set_check_url: could not
allocate memory for order url\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_prduct_set_check_url: could not allocate memory for
order url\n");
return EXIT_FAILURE;
}
product->checkUrl = url;
sprintf (product->checkUrl, "%s%s%s%s", BACKEND_BASE_URL, CHECK, ORDER_CHECK,
product->orderID);
- printf("Url to check payment: %s\n\n", product->checkUrl);
+ printf ("Url to check payment: %s\n\n", product->checkUrl);
return EXIT_SUCCESS;
}
@@ -113,12 +116,13 @@ int SNACK_product_set_check_url (ProductOrder *product)
int SNACK_product_set_order_id (ProductOrder *product)
{
return SNACK_taler_parse_json (product->response, JSON_ORDER_ID,
- &(product->orderID));
+ &(product->orderID));
}
int SNACK_product_set_pay_url (ProductOrder *product)
{
- return SNACK_taler_parse_json (product->response, JSON_PAY_URI,
&(product->payUrl));
+ return SNACK_taler_parse_json (product->response, JSON_PAY_URI,
+ &(product->payUrl));
}
int SNACK_product_set_paid_status (ProductOrder *product)
@@ -132,14 +136,16 @@ int SNACK_product_set_paid_status (ProductOrder *product)
root = json_loads (product->response->string, JSON_DISABLE_EOF_CHECK,
&error);
if ( ! root )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_parse_json: %s\n",
error.text);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_parse_json: %s\n",
+ error.text);
return EXIT_FAILURE;
}
/* extract the boolean value of paid out of the json object */
if ( json_unpack (root, "{s:b}", JSON_PAID, &b) < 0 )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_taler_parse_json: no value
\"%s\" found!\n", JSON_PAID);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_taler_parse_json: no value \"%s\" found!\n", JSON_PAID);
json_decref (root);
return EXIT_FAILURE;
}
@@ -153,7 +159,8 @@ int SNACK_product_set_paid_status (ProductOrder *product)
}
else
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_product_set_paid_status: json
parsing failed\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_product_set_paid_status: json parsing failed\n");
return EXIT_FAILURE;
}
diff --git a/src/wallet.c b/src/wallet.c
index 6942f41..3b0aedb 100644
--- a/src/wallet.c
+++ b/src/wallet.c
@@ -40,16 +40,20 @@ int SNACK_wallet_select_aid (nfc_device *pnd)
int size = sizeof(select_file) + sizeof(taler_aid);
uint8_t message[size];
- if ( SNACK_concat_message (select_file, sizeof(select_file), taler_aid,
message,
+ if ( SNACK_concat_message (select_file, sizeof(select_file), taler_aid,
+ message,
size) )
return EXIT_FAILURE;
- SNACK_print_hex_info("SNACK_wallet_select_aid: Selecting Taler apk using
AID", taler_aid, sizeof(taler_aid));
+ SNACK_print_hex_info (
+ "SNACK_wallet_select_aid: Selecting Taler apk using AID", taler_aid,
+ sizeof(taler_aid));
if ( nfc_initiator_transceive_bytes (pnd, message, size, response,
sizeof(response), TRANSMIT_TIMEOUT) < 0
)
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_wallet_select_aid: Failed to
select apk\n\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_wallet_select_aid: Failed to select apk\n\n");
return EXIT_FAILURE;
}
@@ -66,25 +70,28 @@ int SNACK_put_message (nfc_device *pnd, const char *msg,
size_t msgSize)
message, size) )
return EXIT_FAILURE;
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "SNACK_wallet_put_messsage: Sending 'PUT
DATA' command to wallet\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "SNACK_wallet_put_messsage: Sending 'PUT DATA' command to
wallet\n");
if ( nfc_initiator_transceive_bytes (pnd, message, size, response,
sizeof(response), TRANSMIT_TIMEOUT) < 0
)
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_wallet_put_message: Failed to
put message\n\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_wallet_put_message: Failed to put message\n\n");
return EXIT_FAILURE;
}
return SNACK_check_response (response, sizeof(response) );
}
-int SNACK_wallet_tunneling(nfc_device *pnd, const char *msg, size_t msgSize)
+int SNACK_wallet_tunneling (nfc_device *pnd, const char *msg, size_t msgSize)
{
uint8_t response[255] = {0x00};
- printf( "checking for tunneling request\n");
+ printf ("checking for tunneling request\n");
- if ( nfc_initiator_transceive_bytes (pnd, get_data, sizeof(get_data),
response,
+ if ( nfc_initiator_transceive_bytes (pnd, get_data, sizeof(get_data),
+ response,
sizeof(response), TRANSMIT_TIMEOUT) < 0
)
{
@@ -105,7 +112,8 @@ int SNACK_wallet_transmit (nfc_device *pnd, const char
*msg, size_t msgLen)
{
if ( ! msg )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_wallet_transmit: No message to
send\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_wallet_transmit: No message to send\n");
return EXIT_FAILURE;
}
@@ -114,14 +122,15 @@ int SNACK_wallet_transmit (nfc_device *pnd, const char
*msg, size_t msgLen)
if ( SNACK_put_message (pnd, msg, msgLen) )
return EXIT_FAILURE;
-
//-------------------------------------------------------------------------------------------
- //sleep(3);
- //while ( SNACK_wallet_tunneling(pnd, msg, msgLen) == EXIT_SUCCESS )
+ //
-------------------------------------------------------------------------------------------
+ // sleep(3);
+ // while ( SNACK_wallet_tunneling(pnd, msg, msgLen) == EXIT_SUCCESS )
// sleep(3);
// ;
-
//--------------------------------------------------------------------------------------------
+ //
--------------------------------------------------------------------------------------------
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "SNACK_wallet_transmit: Transmitted
message to taler wallet\n\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "SNACK_wallet_transmit: Transmitted message to taler
wallet\n\n");
return EXIT_SUCCESS;
}
@@ -130,10 +139,10 @@ int SNACK_check_response (uint8_t *response, uint8_t
responseLen)
{
if ( strcmp ((char *) response, APDU_SUCCESS) == 0 )
{
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Transmission success\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Transmission success\n");
}
else {
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Transmission failure, return code: ");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Transmission failure, return code:
");
for ( uint8_t i = 0; i < responseLen; ++i ) {
printf ("%.2x ", response[i]);
}
@@ -149,7 +158,8 @@ int SNACK_concat_message (const uint8_t*command, size_t
commandSize, const
{
if ( ! command || ! message )
{
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "SNACK_concat_message: command and
message can't be null");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SNACK_concat_message: command and message can't be null");
return EXIT_FAILURE;
}
@@ -164,15 +174,17 @@ int SNACK_concat_message (const uint8_t*command, size_t
commandSize, const
return EXIT_SUCCESS;
}
-void SNACK_print_hex_info( const char* message, const uint8_t *hexArray,
size_t sizeHex ){
+void SNACK_print_hex_info (const char*message, const uint8_t *hexArray, size_t
+ sizeHex)
+{
char hex[5] = {""};
char str[64] = {""};
- for ( unsigned int i = 0; i < sizeHex; ++i ){
+ for ( unsigned int i = 0; i < sizeHex; ++i ) {
sprintf (hex, "%.2x ", hexArray[i]);
- strcat(str, hex);
+ strcat (str, hex);
}
- GNUNET_log(GNUNET_ERROR_TYPE_MESSAGE, "%s: %s\n", message, str);
+ GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "%s: %s\n", message, str);
}
diff --git a/src/wallet.h b/src/wallet.h
index c5cd0fd..e6438ea 100644
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -36,15 +36,16 @@ int SNACK_wallet_select_aid (nfc_device *pnd);
int SNACK_wallet_put_message (nfc_device *pnd, const char *msg, size_t
msgSize);
-int SNACK_wallet_tunneling(nfc_device *pnd, const char *msg, size_t msgSize);
+int SNACK_wallet_tunneling (nfc_device *pnd, const char *msg, size_t msgSize);
int SNACK_wallet_transmit (nfc_device*pnd, const char *msg, size_t msgLen);
int SNACK_concat_message (const uint8_t*command, size_t commandSize, const
- uint8_t *message, uint8_t *retMsg, size_t returnSize);
+ uint8_t *message, uint8_t *retMsg, size_t
returnSize);
int SNACK_check_response (uint8_t *response, uint8_t responseLen);
-void SNACK_print_hex_info( const char* message, const uint8_t *hexArray,
size_t sizeHex );
+void SNACK_print_hex_info (const char*message, const uint8_t *hexArray, size_t
+ sizeHex);
#endif // WALLET_H
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [taler-taler-mdb] 25/93: no curl here, (continued)
- [taler-taler-mdb] 25/93: no curl here, gnunet, 2019/11/18
- [taler-taler-mdb] 21/93: product.h uncrustified, gnunet, 2019/11/18
- [taler-taler-mdb] 22/93: pseudo nonce, gnunet, 2019/11/18
- [taler-taler-mdb] 26/93: use check payment instead of poll payment, gnunet, 2019/11/18
- [taler-taler-mdb] 10/93: add bootstrap and uncrustify logic, gnunet, 2019/11/18
- [taler-taler-mdb] 17/93: merged jsonIntegrity, gnunet, 2019/11/18
- [taler-taler-mdb] 23/93: chaos monkey, gnunet, 2019/11/18
- [taler-taler-mdb] 15/93: fixes, gnunet, 2019/11/18
- [taler-taler-mdb] 14/93: updated .gitignore, gnunet, 2019/11/18
- [taler-taler-mdb] 20/93: more implementations using GNUNETUtils, gnunet, 2019/11/18
- [taler-taler-mdb] 19/93: GNUnet logs added, -h option added,
gnunet <=
- [taler-taler-mdb] 12/93: initial indenting, gnunet, 2019/11/18
- [taler-taler-mdb] 31/93: cleanup, gnunet, 2019/11/18
- [taler-taler-mdb] 33/93: typo, gnunet, 2019/11/18
- [taler-taler-mdb] 30/93: cleanup, gnunet, 2019/11/18
- [taler-taler-mdb] 24/93: use event loop, gnunet, 2019/11/18
- [taler-taler-mdb] 32/93: retry NFC failures more nicely, gnunet, 2019/11/18
- [taler-taler-mdb] 36/93: fixed delay when cancelling, new bugs detected marked with FIXME, gnunet, 2019/11/18
- [taler-taler-mdb] 46/93: first steps in configurable products, gnunet, 2019/11/18
- [taler-taler-mdb] 28/93: misc cleanup, gnunet, 2019/11/18
- [taler-taler-mdb] 45/93: first steps in configurable products, gnunet, 2019/11/18