SAP: Make sap_error_rsp function static

This error message is used to reply to SAP protocol errors and it
should not be used by drivers as they don't have access to server
internal state machine. Messages passed to drivers are valid and
properly formatted so drivers shall use result code in response
messages to indicate error (section 4.11 of SAP specification).
This commit is contained in:
Szymon Janc 2012-06-06 15:19:20 +02:00 committed by Johan Hedberg
parent b939e8fab1
commit 98ddb6aac2
2 changed files with 13 additions and 15 deletions

View File

@ -173,7 +173,6 @@ int sap_power_sim_on_rsp(void *sap_device, uint8_t result);
int sap_reset_sim_rsp(void *sap_device, uint8_t result);
int sap_transfer_card_reader_status_rsp(void *sap_device, uint8_t result,
uint8_t status);
int sap_error_rsp(void *sap_device);
int sap_transport_protocol_rsp(void *sap_device, uint8_t result);
/* Event indication. Implemented by server.c*/

View File

@ -286,6 +286,19 @@ static int disconnect_ind(struct sap_connection *conn, uint8_t disc_type)
return send_message(conn, buf, size);
}
static int sap_error_rsp(struct sap_connection *conn)
{
struct sap_message msg;
memset(&msg, 0, sizeof(msg));
msg.id = SAP_ERROR_RESP;
error("SAP error (state %d pr 0x%02x).", conn->state,
conn->processing_req);
return send_message(conn, &msg, sizeof(msg));
}
static void connect_req(struct sap_connection *conn,
struct sap_parameter *param)
{
@ -928,20 +941,6 @@ int sap_transport_protocol_rsp(void *sap_device, uint8_t result)
return send_message(sap_device, buf, size);
}
int sap_error_rsp(void *sap_device)
{
struct sap_message msg;
struct sap_connection *conn = sap_device;
memset(&msg, 0, sizeof(msg));
msg.id = SAP_ERROR_RESP;
error("SAP error (state %d pr 0x%02x).", conn->state,
conn->processing_req);
return send_message(conn, &msg, sizeof(msg));
}
int sap_status_ind(void *sap_device, uint8_t status_change)
{
struct sap_connection *conn = sap_device;