pre_reservation_id now starts at 1 for compatability with jer_encode

This commit is contained in:
gilteixeira 2023-04-21 16:48:21 +01:00
parent 12db9fe685
commit 40d8bf7b05
1 changed files with 10 additions and 3 deletions

View File

@ -115,7 +115,7 @@ cleanup:
return rv; return rv;
} }
static int pre_reservation_id = 0; static int pre_reservation_id = 1;
int evrsrm_recv(EV_RSR_t *evrsr_request) { int evrsrm_recv(EV_RSR_t *evrsr_request) {
int rv = 0; int rv = 0;
@ -180,7 +180,7 @@ int evrsrm_recv(EV_RSR_t *evrsr_request) {
bpr->id = id; bpr->id = id;
fmi->id = id; fmi->id = id;
asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_TransportRequest, NULL, tr, tr_oer + 1, 1023); asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_TransportRequest, NULL, tr, tr_oer + 1, 1023);
if (enc.encoded == -1) { if (enc.encoded == -1) {
log_error("[ev] failed encoding transport request (%s)", enc.failed_type->name); log_error("[ev] failed encoding transport request (%s)", enc.failed_type->name);
rv = 1; rv = 1;
@ -215,7 +215,14 @@ static int evrsrm_pre_reservation_response(uint8_t *evrsrm_oer, uint32_t *evrsrm
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;
*(int64_t*) response->preReservation_ID.buf = pre_reservation_id; response->preReservation_ID.buf[0] = '0' + (pre_reservation_id >> 56) & 0xff;
response->preReservation_ID.buf[1] = '0' + (pre_reservation_id >> 48) & 0xff;
response->preReservation_ID.buf[2] = '0' + (pre_reservation_id >> 40) & 0xff;
response->preReservation_ID.buf[3] = '0' + (pre_reservation_id >> 32) & 0xff;
response->preReservation_ID.buf[4] = '0' + (pre_reservation_id >> 24) & 0xff;
response->preReservation_ID.buf[5] = '0' + (pre_reservation_id >> 16) & 0xff;
response->preReservation_ID.buf[6] = '0' + (pre_reservation_id >> 8) & 0xff;
response->preReservation_ID.buf[7] = '0' + pre_reservation_id & 0xff;
response->availabilityStatus = 0; response->availabilityStatus = 0;