indication max size definition and description

This commit is contained in:
dmtar 2024-10-07 14:03:43 +01:00
parent c7274928b1
commit 301cdab3da
10 changed files with 58 additions and 75 deletions

View File

@ -1,32 +1,9 @@
image: registry.es.av.it.pt/cicd/archmaker image: registry.es.av.it.pt/cicd/archmaker
stages: stages:
# - build
# - test
- deploy release - deploy release
- deploy debug - 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: deploy release:
stage: deploy release stage: deploy release
resource_group: packaging 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/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/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/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: deploy debug:
stage: 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/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/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/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

View File

@ -773,7 +773,7 @@ void* ca_service() {
*(uint16_t*)npr->transport.choice.btp.destinationPortInfo->buf = 0xed; *(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); npr->data.buf = malloc(buf_len);
// Fill header for FacilitiesIndication and FacilitiesMessageIndication structs // Fill header for FacilitiesIndication and FacilitiesMessageIndication structs
@ -812,13 +812,13 @@ void* ca_service() {
npr->id = id; npr->id = id;
fmi->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) { if (enc.encoded == -1) {
log_error("encoding TR for cam failed"); log_error("encoding TR for cam failed");
continue; 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){ if(enc_fdi.encoded == -1){
log_error("encoding FI for cam failed"); log_error("encoding FI for cam failed");
continue; continue;
@ -839,7 +839,7 @@ void* ca_service() {
} }
if (facilities.logging.recorder) { 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]; uint8_t buffer[buffer_len];
int e = itss_management_record_packet_sdu( int e = itss_management_record_packet_sdu(
buffer, buffer,

View File

@ -408,7 +408,7 @@ int facilities_config() {
DIR *d = opendir(etsi_its_cfg->facilities.protected_zones.path); DIR *d = opendir(etsi_its_cfg->facilities.protected_zones.path);
struct dirent *dir; struct dirent *dir;
char file[256]; char file[256];
char pz_xml[ITSS_QUEUE_MAX_PACKET_SIZE]; char pz_xml[2048];
if (d) { if (d) {
while ((dir = readdir(d)) != NULL && i < 16) { while ((dir = readdir(d)) != NULL && i < 16) {
if (dir->d_name[0] == '.') continue; if (dir->d_name[0] == '.') continue;
@ -454,7 +454,7 @@ int facilities_config() {
DIR *d = opendir(etsi_its_cfg->facilities.tpm.tis_path); DIR *d = opendir(etsi_its_cfg->facilities.tpm.tis_path);
struct dirent *dir; struct dirent *dir;
char file[256]; char file[256];
char ti_xml[ITSS_QUEUE_MAX_PACKET_SIZE]; char ti_xml[2048];
if (d) { if (d) {
while ((dir = readdir(d)) != NULL && i < TOLLING_INFOS_MAX_LENGTH) { while ((dir = readdir(d)) != NULL && i < TOLLING_INFOS_MAX_LENGTH) {
if (dir->d_name[0] == '.') continue; if (dir->d_name[0] == '.') continue;

View File

@ -703,8 +703,8 @@ void *cp_service(){
memset(valid_array, 0, sizeof(valid_array)); memset(valid_array, 0, sizeof(valid_array));
memset(history_timestamp, 0, sizeof(history_timestamp)); memset(history_timestamp, 0, sizeof(history_timestamp));
uint8_t tr_oer[ITSS_QUEUE_MAX_PACKET_SIZE]; uint8_t tr_oer[INDICATION_BUFFER_SIZE];
uint8_t fi_oer[ITSS_QUEUE_MAX_PACKET_SIZE]; uint8_t fi_oer[INDICATION_BUFFER_SIZE];
tr_oer[0] = ITSS_FACILITIES; //Facilities tr_oer[0] = ITSS_FACILITIES; //Facilities
fi_oer[0] = ITSS_FACILITIES; fi_oer[0] = ITSS_FACILITIES;
@ -768,14 +768,14 @@ void *cp_service(){
fmi->id = id; fmi->id = id;
/* Encode NetworkingRequest */ /* 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){ if(enc_tdr.encoded == -1){
log_error("encoding TR for cpm failed"); log_error("encoding TR for cpm failed");
continue; continue;
} }
/* Encode FacilitiesIndication */ /* 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){ if(enc_fdi.encoded == -1){
log_error("encoding FI for cpm failed"); log_error("encoding FI for cpm failed");
continue; 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); itss_db_add(facilities.logging.dbms, station_id, npr->id, true, 14, NULL, npr->data.buf, npr->data.size);
} }
if (facilities.logging.recorder) { 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]; uint8_t buffer[buffer_len];
int e = itss_management_record_packet_sdu( int e = itss_management_record_packet_sdu(
buffer, buffer,

View File

@ -149,8 +149,8 @@ int evrsrm_recv(EI1_EV_RSR_t *evrsr_request) {
fmi->itsMessageType = EIS_ItsMessageType_evrsr; fmi->itsMessageType = EIS_ItsMessageType_evrsr;
fmi->data.buf = malloc(512); fmi->data.buf = malloc(512);
uint8_t tr_oer[1024]; uint8_t tr_oer[INDICATION_BUFFER_SIZE];
uint8_t fi_oer[1024]; uint8_t fi_oer[INDICATION_BUFFER_SIZE];
tr_oer[0] = ITSS_FACILITIES; // Facilities tr_oer[0] = ITSS_FACILITIES; // Facilities
fi_oer[0] = ITSS_FACILITIES; fi_oer[0] = ITSS_FACILITIES;
if (!(evrsr_request->messageBody.present == EI1_EV_RSR_MessageBody_PR_preReservationRequestMessage || 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; npr->id = id;
fmi->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) { 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;
goto cleanup; 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) { if (enc_fdi.encoded == -1) {
log_error("[ev] encoding FI for evrsrm failed"); log_error("[ev] encoding FI for evrsrm failed");
rv = 1; rv = 1;
@ -405,8 +405,8 @@ void *evcsn_service() {
fmi->itsMessageType = EIS_ItsMessageType_poi; fmi->itsMessageType = EIS_ItsMessageType_poi;
fmi->data.buf = malloc(512); fmi->data.buf = malloc(512);
uint8_t tr_oer[1024]; uint8_t tr_oer[INDICATION_BUFFER_SIZE];
uint8_t fi_oer[1024]; uint8_t fi_oer[INDICATION_BUFFER_SIZE];
tr_oer[0] = ITSS_FACILITIES; // Facilities tr_oer[0] = ITSS_FACILITIES; // Facilities
fi_oer[0] = ITSS_FACILITIES; fi_oer[0] = ITSS_FACILITIES;
while (!facilities.exit) { while (!facilities.exit) {
@ -423,13 +423,13 @@ void *evcsn_service() {
npr->id = id; npr->id = id;
fmi->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) { if (enc.encoded == -1) {
log_error("encoding TR for evcsnm failed"); log_error("encoding TR for evcsnm failed");
continue; 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) { if (enc_fdi.encoded == -1) {
log_error("encoding FI for evcsnm failed"); log_error("encoding FI for evcsnm failed");
continue; continue;
@ -448,7 +448,7 @@ void *evcsn_service() {
} }
if (facilities.logging.recorder) { 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]; uint8_t buffer[buffer_len];
int e = itss_management_record_packet_sdu( int e = itss_management_record_packet_sdu(
buffer, buffer,

View File

@ -21,6 +21,12 @@
#include <it2s-tender/constants.h> #include <it2s-tender/constants.h>
#include <it2s-tender/queue.h> #include <it2s-tender/queue.h>
/*
* 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 { enum ID_CHANGE_STAGE {
ID_CHANGE_INACTIVE, ID_CHANGE_INACTIVE,
ID_CHANGE_BLOCKED, ID_CHANGE_BLOCKED,

View File

@ -337,11 +337,11 @@ int facilities_request_single_message(void *responder, EIS_FacilitiesMessageRequ
npr->transport.choice.btp.btpType = EIS_BTPType_btpB; npr->transport.choice.btp.btpType = EIS_BTPType_btpB;
npr->id = id; npr->id = id;
npr->data.buf = malloc(ITSS_QUEUE_MAX_PACKET_SIZE); npr->data.buf = malloc(INDICATION_BUFFER_SIZE);
asn_enc_rval_t enc; asn_enc_rval_t enc;
if (process_msg) { 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) { if (enc.encoded == -1) {
log_error("failed encoding ITS message into UPER (%s)", enc.failed_type->name); log_error("failed encoding ITS message into UPER (%s)", enc.failed_type->name);
rv = 1; rv = 1;
@ -380,9 +380,9 @@ int facilities_request_single_message(void *responder, EIS_FacilitiesMessageRequ
npr->network.choice.gn.securityProfile.sign = true; 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 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) { if (enc.encoded == -1) {
log_error("failed encoding TR (%s)", enc.failed_type->name); log_error("failed encoding TR (%s)", enc.failed_type->name);
rv = 1; rv = 1;
@ -394,7 +394,7 @@ int facilities_request_single_message(void *responder, EIS_FacilitiesMessageRequ
// Logging // Logging
if (facilities.logging.recorder) { 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]; uint8_t buffer[buffer_len];
int e = itss_management_record_packet_sdu( int e = itss_management_record_packet_sdu(
buffer, 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) { 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] = 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]->itsMessageType = EIS_ItsMessageType_denm;
frep->choice.data.choice.episodes.list.array[j]->data.buf = malloc(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, 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, 2048);
if (enc.encoded == -1) { /* encoding shouldn't fail as all saved DENMs are structurally valid */ 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); log_error("failed encoding DENM for FDResult (%s)", enc.failed_type->name);
frep->choice.data.choice.episodes.list.array[j]->data.size = 0; 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) { 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] = 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]->itsMessageType = EIS_ItsMessageType_ivim;
frep->choice.data.choice.episodes.list.array[j]->data.buf = malloc(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, 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, 2048);
if (enc.encoded == -1) { /* encoding shouldn't fail as all saved DENMs are structurally valid */ 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); log_error("failed encoding IVIM for FDResult (%s)", enc.failed_type->name);
frep->choice.data.choice.episodes.list.array[j]->data.size = 0; 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 stored = false;
bool process_msg = true; 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]; uint8_t buf[buf_len];
uint64_t id = 0; 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; 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]; uint8_t buf[buf_len];
EIS_SecurityRequest_t* sreq = NULL; 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); pthread_mutex_unlock(&facilities.tolling.lock);
sreq->choice.tlsSend.connId = id; 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; 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); log_debug("->[security] SecurityRequest.tlsRecv (%ldB)", enc.encoded + 1);
itss_0send(*security_socket, b_tx, 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); log_debug("<-[security] SecurityReply.tlsRecv (%dB)", rl);
if (oer_decode(NULL, &asn_DEF_EIS_SecurityReply, (void **)&srep, b_rx, rl).code) { 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->present = EIS_SecurityRequest_PR_tlsShutdown;
sREQ->choice.tlsShutdown.connId = id; sREQ->choice.tlsShutdown.connId = id;
b_tx[0] = ITSS_FACILITIES; 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); log_debug("->[security] SecurityRequest.tlsShutdown (%ldB)", enc.encoded + 1);
itss_0send(*security_socket, b_tx, 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); log_debug("<-[security] SecurityReply.tlsShutdown (%dB)", rl);
rv = 1; rv = 1;

View File

@ -326,7 +326,7 @@ void *sa_service() {
int linger_ms = 0; int linger_ms = 0;
void* security_socket = itss_0connect(facilities.zmq.security_address, ZMQ_REQ); 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 tr_oer[0] = ITSS_FACILITIES; // Facilities
int rv = 0; int rv = 0;
@ -342,7 +342,7 @@ void *sa_service() {
npr->id = itss_id(npr->data.buf, npr->data.size); 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) { if (enc.encoded == -1) {
log_error("encoding TR for SAEM failed"); log_error("encoding TR for SAEM failed");
continue; 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); 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) { 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]; uint8_t buffer[buffer_len];
int e = itss_management_record_packet_sdu( int e = itss_management_record_packet_sdu(
buffer, buffer,

View File

@ -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; 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 tpm_uper[buf_len];
uint8_t buf1[buf_len], buf2[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); memcpy(sreq->choice.sign.data.buf, buf1, enc.encoded);
buf2[0] = ITSS_FACILITIES; 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); log_debug("->[security] SecurityRequest.sign (%ldB)", enc.encoded+1);
itss_0send(*security_socket, buf2, 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); 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)")); 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) { 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]; uint8_t buffer[buffer_len];
int e = itss_management_record_packet_sdu( int e = itss_management_record_packet_sdu(
buffer, 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)")); 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) { 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]; uint8_t buffer[buffer_len];
int e = itss_management_record_packet_sdu( int e = itss_management_record_packet_sdu(
buffer, 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_SecurityReply_t* srep = NULL;
EIS_NetworkingRequest_t* tr = 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]; uint8_t buf1[buf_len], buf2[buf_len];
switch (type_rx->present) { 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; info_id = type_rx->choice.entry.choice.reply.infoId;
confirmation_code = type_rx->choice.entry.choice.reply.confirmationCode; confirmation_code = type_rx->choice.entry.choice.reply.confirmationCode;
uint8_t 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, ITSS_QUEUE_MAX_PACKET_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) { if (e_tep.encoded == -1) {
log_error("[tolling] error encoding received TPM as entry proof"); log_error("[tolling] error encoding received TPM as entry proof");
return 1; 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; sreq->choice.verify.type = tpm_rx->tpmSignature->type;
buf1[0] = ITSS_FACILITIES; 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); log_debug("->[security] SecurityRequest.verify (%ldB)", enc.encoded+1);
itss_0send(*security_socket, buf1, 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); int32_t rl = itss_0recv_rt(security_socket, buf2, buf_len, buf1, enc.encoded+1, 1000);

View File

@ -77,7 +77,7 @@ static mc_neighbour_s* get_neighbour(uint32_t station_id) {
static void tx_vcm(EI1_VCM_t* vcm) { 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]; uint8_t buf[buf_len];
EIS_NetworkingRequest_t* nr = NULL; EIS_NetworkingRequest_t* nr = NULL;
EIS_FacilitiesIndication_t* fi = 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(); facilities.coordination.t_last_send_vcm = itss_time_get();
if (facilities.logging.recorder) { 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]; uint8_t buffer[buffer_len];
int e = itss_management_record_packet_sdu( int e = itss_management_record_packet_sdu(
buffer, 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)); EI1_VCM_t* vcm_rep = calloc(1, sizeof(EI1_VCM_t));
int rv = 0; 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]; uint8_t buf1[buf_len];
vcm_rep->header.messageID = 43; vcm_rep->header.messageID = 43;