Merge remote-tracking branch 'refs/remotes/origin/master'

This commit is contained in:
emanuel 2022-04-14 17:59:19 +01:00
commit 9e72678205
3 changed files with 9 additions and 5 deletions

View File

@ -380,13 +380,16 @@ void *sa_service(void *fc) {
now > bulletin->to_consume[a]->t_trigger + TOLLING_PAYMENT_MIN_PERIOD_MS &&
facilities->station_type != 15) {
if (!tpm_is_inside_zone(facilities, (tolling_info_s*) bulletin->to_consume[a]->info.internal_p)) {
tolling_info_s* info = (tolling_info_s*) bulletin->to_consume[a]->info.internal_p;
if (!tpm_is_inside_zone(facilities, info)) {
continue;
}
switch (facilities->tolling.protocol) {
case TOLLING_PROTOCOL_SIMPLE:
tpm_pay(facilities, bulletin->to_consume[a]->certificate_id);
tpm_pay(facilities, info, bulletin->to_consume[a]->certificate_id);
++bulletin->to_consume[a]->n_trigger;
bulletin->to_consume[a]->t_trigger = now;
break;

View File

@ -29,7 +29,7 @@ int tpm_is_inside_zone(void* fc, tolling_info_s* ti) {
return 0;
}
int tpm_pay(void* fc, uint8_t* neighbour) {
int tpm_pay(void* fc, tolling_info_s* info, uint8_t* neighbour) {
int rv = 0;
facilities_t* facilities = (facilities_t*) fc;
@ -70,6 +70,7 @@ int tpm_pay(void* fc, uint8_t* neighbour) {
tpm->tpm.tollingFlow.present = TollingFlow_PR_request;
tpm->tpm.tollingFlow.choice.request.clientId = tolling->client_id;
tpm->tpm.tollingFlow.choice.request.infoId = info->asn->id;
tpm->tpm.tollingFlow.choice.request.paymentMethod.present = TollPaymentMethod_PR_fiat;
tpm->tpm.tollingFlow.choice.request.paymentMethod.choice.fiat.fiatId = FiatId_eur;
tpm->tpm.tollingFlow.choice.request.transactionNonce = tolling->nonce;
@ -291,6 +292,7 @@ static void rsu_handle_recv(facilities_t* facilities, TPM_t* tpm_rx, uint8_t* ne
tpm->tpm.tollingFlow.present = TollingFlow_PR_reply;
tpm->tpm.tollingFlow.choice.reply.clientId = req->clientId;
tpm->tpm.tollingFlow.choice.reply.infoId = req->infoId;
tpm->tpm.tollingFlow.choice.reply.transactionNonce = req->transactionNonce;
// TODO check clientId

View File

@ -53,10 +53,9 @@ typedef struct tolling {
*/
int tolling_init(tolling_s* tolling, void* zmq_ctx, char* security_address);
int tpm_pay(void* fc, uint8_t* neighbour);
int tpm_pay(void* fc, tolling_info_s* info, uint8_t* neighbour);
int tpm_recv(void* fc, TPM_t* tpm_rx, uint8_t* neighbour);
int tpm_is_inside_zone(void* fc, tolling_info_s* ti);
tolling_info_s* tolling_info_new(it2s_tender_epv_t* epv, TollingPaymentInfo_t* tpi);
void tolling_info_free(tolling_info_s* ti);