response is now just a pointer

This commit is contained in:
gilteixeira 2023-04-21 14:47:12 +01:00
parent 2d793a334a
commit 6a7af33656
1 changed files with 12 additions and 10 deletions

View File

@ -212,19 +212,20 @@ static int evrsrm_pre_reservation_response(uint8_t *evrsrm_oer, uint32_t *evrsrm
pthread_mutex_unlock(&facilities.id.lock); pthread_mutex_unlock(&facilities.id.lock);
evrsr_response->messageBody.present = EV_RSR_MessageBody_PR_preReservationResponseMessage; evrsr_response->messageBody.present = EV_RSR_MessageBody_PR_preReservationResponseMessage;
PreReservationResponseMessage_t response = evrsr_response->messageBody.choice.preReservationResponseMessage; PreReservationResponseMessage_t* response = &evrsr_response->messageBody.choice.preReservationResponseMessage;
response.preReservation_ID.buf = calloc(8, sizeof(uint8_t)); response->preReservation_ID.buf = calloc(8, sizeof(uint8_t));
response.preReservation_ID.size = 8; response->preReservation_ID.size = 8;
*(uint64_t *)response.preReservation_ID.buf = pre_reservation_id; *(int64_t*) response->preReservation_ID.buf = pre_reservation_id;
response.availabilityStatus = 0;
response.supportedPaymentTypes.buf = calloc(1, sizeof(uint8_t)); response->availabilityStatus = 0;
response.supportedPaymentTypes.bits_unused = 0;
response.supportedPaymentTypes.size = 1;
response.supportedPaymentTypes.buf[0] = 0x00;
response.preReservationExpirationTime = 0; response->supportedPaymentTypes.buf = calloc(1, sizeof(uint8_t));
response->supportedPaymentTypes.bits_unused = 0;
response->supportedPaymentTypes.size = 1;
response->supportedPaymentTypes.buf[0] = 0x00;
response->preReservationExpirationTime = 0;
asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_EV_RSR, NULL, evrsr_response, evrsrm_oer, 512); asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_EV_RSR, NULL, evrsr_response, evrsrm_oer, 512);
if (enc.encoded == -1) { if (enc.encoded == -1) {
log_error("[ev] failed encoding evrsrm (%s)", enc.failed_type->name); log_error("[ev] failed encoding evrsrm (%s)", enc.failed_type->name);
@ -233,6 +234,7 @@ static int evrsrm_pre_reservation_response(uint8_t *evrsrm_oer, uint32_t *evrsrm
} }
*evrsrm_len = (enc.encoded + 7) / 8; *evrsrm_len = (enc.encoded + 7) / 8;
pre_reservation_id++; pre_reservation_id++;
cleanup: cleanup:
ASN_STRUCT_FREE(asn_DEF_EV_RSR, evrsr_response); ASN_STRUCT_FREE(asn_DEF_EV_RSR, evrsr_response);
return rv; return rv;