store all APDU's received from the MS in the database
This helps us to analyze data such as RRLP location information for later analysis.
This commit is contained in:
parent
6eef564e2d
commit
026531ec92
|
@ -48,4 +48,9 @@ int db_sms_store(struct gsm_sms *sms);
|
|||
struct gsm_sms *db_sms_get_unsent(struct gsm_network *net, int min_id);
|
||||
struct gsm_sms *db_sms_get_unsent_for_subscr(struct gsm_subscriber *subscr);
|
||||
int db_sms_mark_sent(struct gsm_sms *sms);
|
||||
|
||||
/* APDU blob storage */
|
||||
int db_apdu_blob_store(struct gsm_subscriber *subscr,
|
||||
u_int8_t apdu_id_flags, u_int8_t len,
|
||||
u_int8_t *apdu);
|
||||
#endif /* _DB_H */
|
||||
|
|
|
@ -109,6 +109,13 @@ static char *create_stmts[] = {
|
|||
"subscriber_id NUMERIC UNIQUE NOT NULL, "
|
||||
"last_bts NUMERIC NOT NULL "
|
||||
")",
|
||||
"CREATE TABLE IF NOT EXISTS ApduBlobs ("
|
||||
"id INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||
"created TIMESTAMP NOT NULL, "
|
||||
"apdu_id_flags INTEGER NOT NULL, "
|
||||
"subscriber_id INTEGER NOT NULL, "
|
||||
"apdu BLOB "
|
||||
")",
|
||||
};
|
||||
|
||||
void db_error_func(dbi_conn conn, void* data) {
|
||||
|
@ -771,3 +778,27 @@ int db_sms_inc_deliver_attempts(struct gsm_sms *sms)
|
|||
dbi_result_free(result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int db_apdu_blob_store(struct gsm_subscriber *subscr,
|
||||
u_int8_t apdu_id_flags, u_int8_t len,
|
||||
u_int8_t *apdu)
|
||||
{
|
||||
dbi_result result;
|
||||
char *q_apdu;
|
||||
|
||||
dbi_conn_quote_binary_copy(conn, apdu, len, &q_apdu);
|
||||
|
||||
result = dbi_conn_queryf(conn,
|
||||
"INSERT INTO ApduBlobs "
|
||||
"(created,subscriber_id,apdu_id_flags,apdu) VALUES "
|
||||
"(datetime('now'),%llu,%u,%s)",
|
||||
subscr->id, apdu_id_flags, q_apdu);
|
||||
|
||||
free(q_apdu);
|
||||
|
||||
if (!result)
|
||||
return -EIO;
|
||||
|
||||
dbi_result_free(result);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1839,7 +1839,7 @@ static int gsm48_rx_rr_app_info(struct msgb *msg)
|
|||
DEBUGP(DNM, "RX APPLICATION INFO id/flags=0x%02x apdu_len=%u apdu=%s",
|
||||
apdu_id_flags, apdu_len, hexdump(apdu_data, apdu_len));
|
||||
|
||||
return 0;
|
||||
return db_apdu_blob_store(msg->lchan->subscr, apdu_id_flags, apdu_len, apdu_data);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue