From 301cdab3dab9be801d235877ac1948ce105b6625 Mon Sep 17 00:00:00 2001 From: dmtar Date: Mon, 7 Oct 2024 14:03:43 +0100 Subject: [PATCH] indication max size definition and description --- .gitlab-ci.yml | 27 ++------------------------- src/cam.c | 8 ++++---- src/config.c | 4 ++-- src/cpm.c | 10 +++++----- src/evm.c | 18 +++++++++--------- src/facilities.h | 6 ++++++ src/requests.c | 32 ++++++++++++++++---------------- src/saem.c | 6 +++--- src/tpm.c | 16 ++++++++-------- src/vcm.c | 6 +++--- 10 files changed, 58 insertions(+), 75 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index edd762a..2459a9c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,32 +1,9 @@ image: registry.es.av.it.pt/cicd/archmaker stages: -# - build -# - test - deploy release - deploy debug -#.dependencies: -# before_script: -# - pacman -Sy zeromq it2s-config-git it2s-asn-git it2s-tender-git mariadb it2s-gnss-git it2s-obd-git --overwrite=* --noconfirm - -#build: -# stage: build -# extends: .dependencies -# script: mkdir build && cd build && cmake .. && make -# artifacts: -# paths: -# - ./build/src/it2s-itss-facilities -# - ./build/test/tester -# expire_in: 1 hour - -#test: -# stage: test -# extends: .dependencies -# script: -# - cd test -# - sh spawn.sh - deploy release: stage: deploy release resource_group: packaging @@ -34,7 +11,7 @@ deploy release: - curl --fail-with-body --silent http://es-lbs.av.it.pt:3000/archlinux/x86/it2s-itss-facilities-git - curl --fail-with-body --silent http://es-lbs.av.it.pt:3000/ubuntu/focal/arm64/it2s-itss-facilities-git - curl --fail-with-body --silent http://es-lbs.av.it.pt:3000/ubuntu/jammy/amd64/it2s-itss-facilities-git - - curl --fail-with-body --silent http://es-lbs.av.it.pt:3000/ubuntu/noble/arm64/it2s-itss-facilities-git + - curl --fail-with-body --silent http://es-lbs.av.it.pt:3000/ubuntu/noble/amd64/it2s-itss-facilities-git deploy debug: stage: deploy debug @@ -43,4 +20,4 @@ deploy debug: - curl --fail-with-body --silent http://es-lbs.av.it.pt:3000/archlinux/x86/it2s-itss-facilities-debug-git - curl --fail-with-body --silent http://es-lbs.av.it.pt:3000/ubuntu/focal/arm64/it2s-itss-facilities-debug-git - curl --fail-with-body --silent http://es-lbs.av.it.pt:3000/ubuntu/jammy/amd64/it2s-itss-facilities-debug-git - - curl --fail-with-body --silent http://es-lbs.av.it.pt:3000/ubuntu/noble/arm64/it2s-itss-facilities-debug-git + - curl --fail-with-body --silent http://es-lbs.av.it.pt:3000/ubuntu/noble/amd64/it2s-itss-facilities-debug-git diff --git a/src/cam.c b/src/cam.c index fd5389e..fed3f5f 100644 --- a/src/cam.c +++ b/src/cam.c @@ -773,7 +773,7 @@ void* ca_service() { *(uint16_t*)npr->transport.choice.btp.destinationPortInfo->buf = 0xed; } - const int buf_len = 1024; + const int buf_len = INDICATION_BUFFER_SIZE; npr->data.buf = malloc(buf_len); // Fill header for FacilitiesIndication and FacilitiesMessageIndication structs @@ -812,13 +812,13 @@ void* ca_service() { npr->id = id; fmi->id = id; - asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, nr_oer+1, 1023); + asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, nr_oer+1, INDICATION_BUFFER_SIZE-1); if (enc.encoded == -1) { log_error("encoding TR for cam failed"); continue; } - asn_enc_rval_t enc_fdi = oer_encode_to_buffer(&asn_DEF_EIS_FacilitiesIndication, NULL, fi, fi_oer+1, 1023); + asn_enc_rval_t enc_fdi = oer_encode_to_buffer(&asn_DEF_EIS_FacilitiesIndication, NULL, fi, fi_oer+1, INDICATION_BUFFER_SIZE-1); if(enc_fdi.encoded == -1){ log_error("encoding FI for cam failed"); continue; @@ -839,7 +839,7 @@ void* ca_service() { } if (facilities.logging.recorder) { - uint16_t buffer_len = ITSS_QUEUE_MAX_PACKET_SIZE; + uint16_t buffer_len = INDICATION_BUFFER_SIZE; uint8_t buffer[buffer_len]; int e = itss_management_record_packet_sdu( buffer, diff --git a/src/config.c b/src/config.c index 7d239c5..6587b9d 100644 --- a/src/config.c +++ b/src/config.c @@ -408,7 +408,7 @@ int facilities_config() { DIR *d = opendir(etsi_its_cfg->facilities.protected_zones.path); struct dirent *dir; char file[256]; - char pz_xml[ITSS_QUEUE_MAX_PACKET_SIZE]; + char pz_xml[2048]; if (d) { while ((dir = readdir(d)) != NULL && i < 16) { if (dir->d_name[0] == '.') continue; @@ -454,7 +454,7 @@ int facilities_config() { DIR *d = opendir(etsi_its_cfg->facilities.tpm.tis_path); struct dirent *dir; char file[256]; - char ti_xml[ITSS_QUEUE_MAX_PACKET_SIZE]; + char ti_xml[2048]; if (d) { while ((dir = readdir(d)) != NULL && i < TOLLING_INFOS_MAX_LENGTH) { if (dir->d_name[0] == '.') continue; diff --git a/src/cpm.c b/src/cpm.c index 9d5b205..f7d5cd5 100644 --- a/src/cpm.c +++ b/src/cpm.c @@ -703,8 +703,8 @@ void *cp_service(){ memset(valid_array, 0, sizeof(valid_array)); memset(history_timestamp, 0, sizeof(history_timestamp)); - uint8_t tr_oer[ITSS_QUEUE_MAX_PACKET_SIZE]; - uint8_t fi_oer[ITSS_QUEUE_MAX_PACKET_SIZE]; + uint8_t tr_oer[INDICATION_BUFFER_SIZE]; + uint8_t fi_oer[INDICATION_BUFFER_SIZE]; tr_oer[0] = ITSS_FACILITIES; //Facilities fi_oer[0] = ITSS_FACILITIES; @@ -768,14 +768,14 @@ void *cp_service(){ fmi->id = id; /* Encode NetworkingRequest */ - asn_enc_rval_t enc_tdr = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, tr_oer+1, ITSS_QUEUE_MAX_PACKET_SIZE-1); + asn_enc_rval_t enc_tdr = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, tr_oer+1, INDICATION_BUFFER_SIZE-1); if(enc_tdr.encoded == -1){ log_error("encoding TR for cpm failed"); continue; } /* Encode FacilitiesIndication */ - asn_enc_rval_t enc_fdi = oer_encode_to_buffer(&asn_DEF_EIS_FacilitiesIndication, NULL, fi, fi_oer+1, ITSS_QUEUE_MAX_PACKET_SIZE-1); + asn_enc_rval_t enc_fdi = oer_encode_to_buffer(&asn_DEF_EIS_FacilitiesIndication, NULL, fi, fi_oer+1, INDICATION_BUFFER_SIZE-1); if(enc_fdi.encoded == -1){ log_error("encoding FI for cpm failed"); continue; @@ -798,7 +798,7 @@ void *cp_service(){ itss_db_add(facilities.logging.dbms, station_id, npr->id, true, 14, NULL, npr->data.buf, npr->data.size); } if (facilities.logging.recorder) { - uint16_t buffer_len = ITSS_QUEUE_MAX_PACKET_SIZE; + uint16_t buffer_len = INDICATION_BUFFER_SIZE; uint8_t buffer[buffer_len]; int e = itss_management_record_packet_sdu( buffer, diff --git a/src/evm.c b/src/evm.c index 9410113..30a40bc 100644 --- a/src/evm.c +++ b/src/evm.c @@ -149,8 +149,8 @@ int evrsrm_recv(EI1_EV_RSR_t *evrsr_request) { fmi->itsMessageType = EIS_ItsMessageType_evrsr; fmi->data.buf = malloc(512); - uint8_t tr_oer[1024]; - uint8_t fi_oer[1024]; + uint8_t tr_oer[INDICATION_BUFFER_SIZE]; + uint8_t fi_oer[INDICATION_BUFFER_SIZE]; tr_oer[0] = ITSS_FACILITIES; // Facilities fi_oer[0] = ITSS_FACILITIES; if (!(evrsr_request->messageBody.present == EI1_EV_RSR_MessageBody_PR_preReservationRequestMessage || @@ -180,14 +180,14 @@ int evrsrm_recv(EI1_EV_RSR_t *evrsr_request) { npr->id = id; fmi->id = id; - asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, tr_oer + 1, 1023); + asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, tr_oer + 1, INDICATION_BUFFER_SIZE-1); if (enc.encoded == -1) { log_error("[ev] failed encoding transport request (%s)", enc.failed_type->name); rv = 1; goto cleanup; } - asn_enc_rval_t enc_fdi = oer_encode_to_buffer(&asn_DEF_EIS_FacilitiesIndication, NULL, fi, fi_oer + 1, 1023); + asn_enc_rval_t enc_fdi = oer_encode_to_buffer(&asn_DEF_EIS_FacilitiesIndication, NULL, fi, fi_oer + 1, INDICATION_BUFFER_SIZE-1); if (enc_fdi.encoded == -1) { log_error("[ev] encoding FI for evrsrm failed"); rv = 1; @@ -405,8 +405,8 @@ void *evcsn_service() { fmi->itsMessageType = EIS_ItsMessageType_poi; fmi->data.buf = malloc(512); - uint8_t tr_oer[1024]; - uint8_t fi_oer[1024]; + uint8_t tr_oer[INDICATION_BUFFER_SIZE]; + uint8_t fi_oer[INDICATION_BUFFER_SIZE]; tr_oer[0] = ITSS_FACILITIES; // Facilities fi_oer[0] = ITSS_FACILITIES; while (!facilities.exit) { @@ -423,13 +423,13 @@ void *evcsn_service() { npr->id = id; fmi->id = id; - asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, tr_oer + 1, 1023); + asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, tr_oer + 1, INDICATION_BUFFER_SIZE-1); if (enc.encoded == -1) { log_error("encoding TR for evcsnm failed"); continue; } - asn_enc_rval_t enc_fdi = oer_encode_to_buffer(&asn_DEF_EIS_FacilitiesIndication, NULL, fi, fi_oer + 1, 1023); + asn_enc_rval_t enc_fdi = oer_encode_to_buffer(&asn_DEF_EIS_FacilitiesIndication, NULL, fi, fi_oer + 1, INDICATION_BUFFER_SIZE-1); if (enc_fdi.encoded == -1) { log_error("encoding FI for evcsnm failed"); continue; @@ -448,7 +448,7 @@ void *evcsn_service() { } if (facilities.logging.recorder) { - uint16_t buffer_len = ITSS_QUEUE_MAX_PACKET_SIZE; + uint16_t buffer_len = INDICATION_BUFFER_SIZE; uint8_t buffer[buffer_len]; int e = itss_management_record_packet_sdu( buffer, diff --git a/src/facilities.h b/src/facilities.h index 4772e9f..ef04b79 100644 --- a/src/facilities.h +++ b/src/facilities.h @@ -21,6 +21,12 @@ #include #include +/* + * IT2S-GN defines a maximum packet size equal to 2360 bytes. + * For indications to the networking layer, a maximum of 2360 bytes for data + 512 bytes for other fields is set. + */ +#define INDICATION_BUFFER_SIZE 2560 + enum ID_CHANGE_STAGE { ID_CHANGE_INACTIVE, ID_CHANGE_BLOCKED, diff --git a/src/requests.c b/src/requests.c index 69e860e..edb2819 100644 --- a/src/requests.c +++ b/src/requests.c @@ -337,11 +337,11 @@ int facilities_request_single_message(void *responder, EIS_FacilitiesMessageRequ npr->transport.choice.btp.btpType = EIS_BTPType_btpB; npr->id = id; - npr->data.buf = malloc(ITSS_QUEUE_MAX_PACKET_SIZE); + npr->data.buf = malloc(INDICATION_BUFFER_SIZE); asn_enc_rval_t enc; if (process_msg) { - enc = uper_encode_to_buffer(its_msg_def, NULL, its_msg, npr->data.buf, ITSS_QUEUE_MAX_PACKET_SIZE); + enc = uper_encode_to_buffer(its_msg_def, NULL, its_msg, npr->data.buf, INDICATION_BUFFER_SIZE); if (enc.encoded == -1) { log_error("failed encoding ITS message into UPER (%s)", enc.failed_type->name); rv = 1; @@ -380,9 +380,9 @@ int facilities_request_single_message(void *responder, EIS_FacilitiesMessageRequ npr->network.choice.gn.securityProfile.sign = true; - uint8_t tr_oer[ITSS_QUEUE_MAX_PACKET_SIZE]; + uint8_t tr_oer[INDICATION_BUFFER_SIZE]; tr_oer[0] = ITSS_FACILITIES; // [facilities] service id - enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, tr_oer + 1, ITSS_QUEUE_MAX_PACKET_SIZE-1); + enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, tr_oer + 1, INDICATION_BUFFER_SIZE-1); if (enc.encoded == -1) { log_error("failed encoding TR (%s)", enc.failed_type->name); rv = 1; @@ -394,7 +394,7 @@ int facilities_request_single_message(void *responder, EIS_FacilitiesMessageRequ // Logging if (facilities.logging.recorder) { - uint16_t buffer_len = ITSS_QUEUE_MAX_PACKET_SIZE; + uint16_t buffer_len = INDICATION_BUFFER_SIZE; uint8_t buffer[buffer_len]; int e = itss_management_record_packet_sdu( buffer, @@ -457,8 +457,8 @@ int facilities_request_active_episodes(void *responder, EIS_FacilitiesRequest_t if (facilities.den.events[i]->enabled && facilities.den.events[i]->state == EVENT_ACTIVE) { frep->choice.data.choice.episodes.list.array[j] = calloc(1, sizeof(EIS_ItsMessage_t)); frep->choice.data.choice.episodes.list.array[j]->itsMessageType = EIS_ItsMessageType_denm; - frep->choice.data.choice.episodes.list.array[j]->data.buf = malloc(ITSS_QUEUE_MAX_PACKET_SIZE); - asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_EI1_DENM, NULL, facilities.den.events[i]->denm, frep->choice.data.choice.episodes.list.array[j]->data.buf, ITSS_QUEUE_MAX_PACKET_SIZE); + frep->choice.data.choice.episodes.list.array[j]->data.buf = malloc(2048); + asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_EI1_DENM, NULL, facilities.den.events[i]->denm, frep->choice.data.choice.episodes.list.array[j]->data.buf, 2048); if (enc.encoded == -1) { /* encoding shouldn't fail as all saved DENMs are structurally valid */ log_error("failed encoding DENM for FDResult (%s)", enc.failed_type->name); frep->choice.data.choice.episodes.list.array[j]->data.size = 0; @@ -475,8 +475,8 @@ int facilities_request_active_episodes(void *responder, EIS_FacilitiesRequest_t if (facilities.infrastructure.services[i]->enabled && facilities.infrastructure.services[i]->state == SERVICE_ACTIVE) { frep->choice.data.choice.episodes.list.array[j] = calloc(1, sizeof(EIS_ItsMessage_t)); frep->choice.data.choice.episodes.list.array[j]->itsMessageType = EIS_ItsMessageType_ivim; - frep->choice.data.choice.episodes.list.array[j]->data.buf = malloc(ITSS_QUEUE_MAX_PACKET_SIZE); - asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_EI1_IVIM, NULL, facilities.infrastructure.services[i]->ivim, frep->choice.data.choice.episodes.list.array[j]->data.buf, ITSS_QUEUE_MAX_PACKET_SIZE); + frep->choice.data.choice.episodes.list.array[j]->data.buf = malloc(2048); + asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_EI1_IVIM, NULL, facilities.infrastructure.services[i]->ivim, frep->choice.data.choice.episodes.list.array[j]->data.buf, 2048); if (enc.encoded == -1) { /* encoding shouldn't fail as all saved DENMs are structurally valid */ log_error("failed encoding IVIM for FDResult (%s)", enc.failed_type->name); frep->choice.data.choice.episodes.list.array[j]->data.size = 0; @@ -659,7 +659,7 @@ static int networking_packet_indication_btp(EIS_NetworkingPacketIndication_t* np bool stored = false; bool process_msg = true; - uint16_t buf_len = ITSS_QUEUE_MAX_PACKET_SIZE; + uint16_t buf_len = INDICATION_BUFFER_SIZE; uint8_t buf[buf_len]; uint64_t id = 0; @@ -944,7 +944,7 @@ static int networking_packet_indication_tcp(EIS_NetworkingPacketIndication_t* np EIS_TCPPacketIndication_t* tpi = &npi->transport.choice.tcp; - uint16_t buf_len = ITSS_QUEUE_MAX_PACKET_SIZE; + uint16_t buf_len = INDICATION_BUFFER_SIZE; uint8_t buf[buf_len]; EIS_SecurityRequest_t* sreq = NULL; @@ -973,13 +973,13 @@ static int networking_packet_indication_tcp(EIS_NetworkingPacketIndication_t* np pthread_mutex_unlock(&facilities.tolling.lock); sreq->choice.tlsSend.connId = id; - uint8_t b_tx[ITSS_QUEUE_MAX_PACKET_SIZE], b_rx[ITSS_QUEUE_MAX_PACKET_SIZE]; + uint8_t b_tx[INDICATION_BUFFER_SIZE], b_rx[INDICATION_BUFFER_SIZE]; b_tx[0] = ITSS_FACILITIES; - asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, b_tx + 1, ITSS_QUEUE_MAX_PACKET_SIZE-1); + asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, b_tx + 1, INDICATION_BUFFER_SIZE-1); log_debug("->[security] SecurityRequest.tlsRecv (%ldB)", enc.encoded + 1); itss_0send(*security_socket, b_tx, enc.encoded + 1); - int32_t rl = itss_0recv_rt(security_socket, b_rx, ITSS_QUEUE_MAX_PACKET_SIZE, b_tx, enc.encoded + 1, 1000); + int32_t rl = itss_0recv_rt(security_socket, b_rx, INDICATION_BUFFER_SIZE, b_tx, enc.encoded + 1, 1000); log_debug("<-[security] SecurityReply.tlsRecv (%dB)", rl); if (oer_decode(NULL, &asn_DEF_EIS_SecurityReply, (void **)&srep, b_rx, rl).code) { @@ -995,10 +995,10 @@ static int networking_packet_indication_tcp(EIS_NetworkingPacketIndication_t* np sREQ->present = EIS_SecurityRequest_PR_tlsShutdown; sREQ->choice.tlsShutdown.connId = id; b_tx[0] = ITSS_FACILITIES; - asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sREQ, b_tx + 1, ITSS_QUEUE_MAX_PACKET_SIZE-1); + asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sREQ, b_tx + 1, INDICATION_BUFFER_SIZE-1); log_debug("->[security] SecurityRequest.tlsShutdown (%ldB)", enc.encoded + 1); itss_0send(*security_socket, b_tx, enc.encoded + 1); - int32_t rl = itss_0recv_rt(security_socket, b_rx, ITSS_QUEUE_MAX_PACKET_SIZE, b_tx, enc.encoded + 1, 1000); + int32_t rl = itss_0recv_rt(security_socket, b_rx, INDICATION_BUFFER_SIZE, b_tx, enc.encoded + 1, 1000); log_debug("<-[security] SecurityReply.tlsShutdown (%dB)", rl); rv = 1; diff --git a/src/saem.c b/src/saem.c index 8751494..44be3b5 100644 --- a/src/saem.c +++ b/src/saem.c @@ -326,7 +326,7 @@ void *sa_service() { int linger_ms = 0; void* security_socket = itss_0connect(facilities.zmq.security_address, ZMQ_REQ); - uint8_t tr_oer[1024]; + uint8_t tr_oer[INDICATION_BUFFER_SIZE]; tr_oer[0] = ITSS_FACILITIES; // Facilities int rv = 0; @@ -342,7 +342,7 @@ void *sa_service() { npr->id = itss_id(npr->data.buf, npr->data.size); - asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, tr_oer+1, 1023); + asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, tr_oer+1, INDICATION_BUFFER_SIZE-1); if (enc.encoded == -1) { log_error("encoding TR for SAEM failed"); continue; @@ -356,7 +356,7 @@ void *sa_service() { itss_db_add(facilities.logging.dbms, station_id, npr->id, true, EI1_messageID_saem, NULL, npr->data.buf, npr->data.size); } if (facilities.logging.recorder) { - uint16_t buffer_len = ITSS_QUEUE_MAX_PACKET_SIZE; + uint16_t buffer_len = INDICATION_BUFFER_SIZE; uint8_t buffer[buffer_len]; int e = itss_management_record_packet_sdu( buffer, diff --git a/src/tpm.c b/src/tpm.c index 8ca1c42..d3b898d 100644 --- a/src/tpm.c +++ b/src/tpm.c @@ -67,7 +67,7 @@ int tpm_pay(tolling_info_t* info, void** security_socket, uint8_t* neighbour, ui tolling_t* tolling = (tolling_t*) &facilities.tolling; - const size_t buf_len = ITSS_QUEUE_MAX_PACKET_SIZE; + const size_t buf_len = INDICATION_BUFFER_SIZE; uint8_t tpm_uper[buf_len]; uint8_t buf1[buf_len], buf2[buf_len]; @@ -211,7 +211,7 @@ int tpm_pay(tolling_info_t* info, void** security_socket, uint8_t* neighbour, ui memcpy(sreq->choice.sign.data.buf, buf1, enc.encoded); buf2[0] = ITSS_FACILITIES; - enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, buf2+1, ITSS_QUEUE_MAX_PACKET_SIZE-1); + enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, buf2+1, INDICATION_BUFFER_SIZE-1); log_debug("->[security] SecurityRequest.sign (%ldB)", enc.encoded+1); itss_0send(*security_socket, buf2, enc.encoded+1); int32_t rl = itss_0recv_rt(security_socket, buf1, buf_len, buf2, enc.encoded+1, 1000); @@ -421,7 +421,7 @@ int tpm_pay(tolling_info_t* info, void** security_socket, uint8_t* neighbour, ui itss_queue_send(facilities.tx_queue, itss_queue_packet_new(buf1, enc.encoded+1, ITSS_APPLICATIONS, id, "FI.message (TPM.request)")); if (facilities.logging.recorder) { - uint16_t buffer_len = ITSS_QUEUE_MAX_PACKET_SIZE; + uint16_t buffer_len = INDICATION_BUFFER_SIZE; uint8_t buffer[buffer_len]; int e = itss_management_record_packet_sdu( buffer, @@ -1037,7 +1037,7 @@ static int rsu_handle_recv(EI1_TPM_t* tpm_rx, void** security_socket, uint8_t* n itss_queue_send(facilities.tx_queue, itss_queue_packet_new(buf1, enc.encoded+1, ITSS_APPLICATIONS, id, "FI.message (TPM.reply)")); if (facilities.logging.recorder) { - uint16_t buffer_len = ITSS_QUEUE_MAX_PACKET_SIZE; + uint16_t buffer_len = INDICATION_BUFFER_SIZE; uint8_t buffer[buffer_len]; int e = itss_management_record_packet_sdu( buffer, @@ -1080,7 +1080,7 @@ static int veh_handle_recv(tolling_t* tolling, EI1_TPM_t* tpm_rx, void** securit EIS_SecurityReply_t* srep = NULL; EIS_NetworkingRequest_t* tr = NULL; - const uint16_t buf_len = ITSS_QUEUE_MAX_PACKET_SIZE; + const uint16_t buf_len = INDICATION_BUFFER_SIZE; uint8_t buf1[buf_len], buf2[buf_len]; switch (type_rx->present) { @@ -1098,8 +1098,8 @@ static int veh_handle_recv(tolling_t* tolling, EI1_TPM_t* tpm_rx, void** securit info_id = type_rx->choice.entry.choice.reply.infoId; confirmation_code = type_rx->choice.entry.choice.reply.confirmationCode; - uint8_t b_tep[ITSS_QUEUE_MAX_PACKET_SIZE]; - asn_enc_rval_t e_tep = uper_encode_to_buffer(&asn_DEF_EI1_TPM, NULL, tpm_rx, b_tep, ITSS_QUEUE_MAX_PACKET_SIZE); + uint8_t b_tep[INDICATION_BUFFER_SIZE]; + asn_enc_rval_t e_tep = uper_encode_to_buffer(&asn_DEF_EI1_TPM, NULL, tpm_rx, b_tep, INDICATION_BUFFER_SIZE); if (e_tep.encoded == -1) { log_error("[tolling] error encoding received TPM as entry proof"); return 1; @@ -1189,7 +1189,7 @@ static int veh_handle_recv(tolling_t* tolling, EI1_TPM_t* tpm_rx, void** securit sreq->choice.verify.type = tpm_rx->tpmSignature->type; buf1[0] = ITSS_FACILITIES; - enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, buf1+1, ITSS_QUEUE_MAX_PACKET_SIZE-1); + enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, buf1+1, INDICATION_BUFFER_SIZE-1); log_debug("->[security] SecurityRequest.verify (%ldB)", enc.encoded+1); itss_0send(*security_socket, buf1, enc.encoded+1); int32_t rl = itss_0recv_rt(security_socket, buf2, buf_len, buf1, enc.encoded+1, 1000); diff --git a/src/vcm.c b/src/vcm.c index 46284e7..4017235 100644 --- a/src/vcm.c +++ b/src/vcm.c @@ -77,7 +77,7 @@ static mc_neighbour_s* get_neighbour(uint32_t station_id) { static void tx_vcm(EI1_VCM_t* vcm) { - const uint16_t buf_len = ITSS_QUEUE_MAX_PACKET_SIZE; + const uint16_t buf_len = INDICATION_BUFFER_SIZE; uint8_t buf[buf_len]; EIS_NetworkingRequest_t* nr = NULL; EIS_FacilitiesIndication_t* fi = NULL; @@ -149,7 +149,7 @@ static void tx_vcm(EI1_VCM_t* vcm) { facilities.coordination.t_last_send_vcm = itss_time_get(); if (facilities.logging.recorder) { - uint16_t buffer_len = ITSS_QUEUE_MAX_PACKET_SIZE; + uint16_t buffer_len = INDICATION_BUFFER_SIZE; uint8_t buffer[buffer_len]; int e = itss_management_record_packet_sdu( buffer, @@ -200,7 +200,7 @@ static void vcm_reject(EI1_VCM_t* vcm, mc_neighbour_s* neighbour) { EI1_VCM_t* vcm_rep = calloc(1, sizeof(EI1_VCM_t)); int rv = 0; - const uint16_t buf_len = ITSS_QUEUE_MAX_PACKET_SIZE; + const uint16_t buf_len = INDICATION_BUFFER_SIZE; uint8_t buf1[buf_len]; vcm_rep->header.messageID = 43;