From 98624a64286482a3970fb022257ba3c29c9f19fd Mon Sep 17 00:00:00 2001 From: emanuel Date: Tue, 14 May 2024 10:40:40 +0100 Subject: [PATCH] Use tender var for SDU source service ID --- src/cam.c | 4 ++-- src/cpm.c | 4 ++-- src/evm.c | 8 ++++---- src/indications.c | 2 +- src/requests.c | 12 ++++++------ src/saem.c | 2 +- src/tpm.c | 26 +++++++++++++------------- src/vcm.c | 4 ++-- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/cam.c b/src/cam.c index 40d8be9..707b064 100644 --- a/src/cam.c +++ b/src/cam.c @@ -786,8 +786,8 @@ void* ca_service() { uint8_t nr_oer[buf_len]; uint8_t fi_oer[buf_len]; - nr_oer[0] = 4; // Facilities - fi_oer[0] = 4; + nr_oer[0] = ITSS_FACILITIES; // Facilities + fi_oer[0] = ITSS_FACILITIES; while (!facilities.exit) { itss_usleep(50*1000); diff --git a/src/cpm.c b/src/cpm.c index 901ffdd..b4093f1 100644 --- a/src/cpm.c +++ b/src/cpm.c @@ -705,8 +705,8 @@ void *cp_service(){ uint8_t tr_oer[2048]; uint8_t fi_oer[2048]; - tr_oer[0] = 4; //Facilities - fi_oer[0] = 4; + tr_oer[0] = ITSS_FACILITIES; //Facilities + fi_oer[0] = ITSS_FACILITIES; EIS_NetworkingRequest_t* nr = calloc(1, sizeof(EIS_NetworkingRequest_t)); nr->present = EIS_NetworkingRequest_PR_packet; diff --git a/src/evm.c b/src/evm.c index fc825c1..18cdf7c 100644 --- a/src/evm.c +++ b/src/evm.c @@ -151,8 +151,8 @@ int evrsrm_recv(EI1_EV_RSR_t *evrsr_request) { uint8_t tr_oer[1024]; uint8_t fi_oer[1024]; - tr_oer[0] = 4; // Facilities - fi_oer[0] = 4; + tr_oer[0] = ITSS_FACILITIES; // Facilities + fi_oer[0] = ITSS_FACILITIES; if (!(evrsr_request->messageBody.present == EI1_EV_RSR_MessageBody_PR_preReservationRequestMessage || evrsr_request->messageBody.present == EI1_EV_RSR_MessageBody_PR_reservationRequestMessage || evrsr_request->messageBody.present == EI1_EV_RSR_MessageBody_PR_cancellationRequestMessage || @@ -407,8 +407,8 @@ void *evcsn_service() { uint8_t tr_oer[1024]; uint8_t fi_oer[1024]; - tr_oer[0] = 4; // Facilities - fi_oer[0] = 4; + tr_oer[0] = ITSS_FACILITIES; // Facilities + fi_oer[0] = ITSS_FACILITIES; while (!facilities.exit) { itss_usleep(1000 * 1000); if (facilities.evm_args.activate) { diff --git a/src/indications.c b/src/indications.c index 9887240..4978e97 100644 --- a/src/indications.c +++ b/src/indications.c @@ -25,7 +25,7 @@ static void tcp_conn_reset(EIS_TCPConnRSTInfo_t* cri, void** security_socket) { sreq->choice.tlsReset.connId = tolling->station.obu.tls_conn_id; uint8_t b_s[64], b_r[64]; - b_s[0] = 4; + b_s[0] = ITSS_FACILITIES; asn_enc_rval_t enc = asn_encode_to_buffer(NULL, ATS_CANONICAL_OER, &asn_DEF_EIS_SecurityRequest, sreq, b_s+1, 63); if (enc.encoded == -1) { log_error("[facilities] SecurityRequest.tlsReset encoding failed"); diff --git a/src/requests.c b/src/requests.c index 7046e5a..0198185 100644 --- a/src/requests.c +++ b/src/requests.c @@ -36,7 +36,7 @@ static void fwd_to_apps(uint8_t* msg, uint16_t msg_len, int its_msg_type, uint32 memcpy(fmi->data.buf, msg, msg_len); uint8_t buffer[ITSS_SDU_MAX_LEN]; - buffer[0] = 4; // Facilities + buffer[0] = ITSS_FACILITIES; // Facilities asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_FacilitiesIndication, NULL, fi, buffer + 1, ITSS_SDU_MAX_LEN - 1); log_debug("-> FI.message ->[applications] | id:%08x size:%dB", @@ -381,7 +381,7 @@ int facilities_request_single_message(void *responder, EIS_FacilitiesMessageRequ npr->network.choice.gn.securityProfile.sign = true; uint8_t tr_oer[2048]; - tr_oer[0] = 4; // [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, 2047); if (enc.encoded == -1) { log_error("failed encoding TR (%s)", enc.failed_type->name); @@ -968,7 +968,7 @@ static int networking_packet_indication_tcp(EIS_NetworkingPacketIndication_t* np sreq->choice.tlsSend.connId = id; uint8_t b_tx[2048], b_rx[2048]; - b_tx[0] = 4; + b_tx[0] = ITSS_FACILITIES; asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, b_tx + 1, 2047); log_debug("->[security] SecurityRequest.tlsRecv (%ldB)", enc.encoded + 1); @@ -988,7 +988,7 @@ static int networking_packet_indication_tcp(EIS_NetworkingPacketIndication_t* np EIS_SecurityRequest_t *sREQ = calloc(1, sizeof(EIS_SecurityRequest_t)); sREQ->present = EIS_SecurityRequest_PR_tlsShutdown; sREQ->choice.tlsShutdown.connId = id; - b_tx[0] = 4; + b_tx[0] = ITSS_FACILITIES; asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sREQ, b_tx + 1, 2047); log_debug("->[security] SecurityRequest.tlsShutdown (%ldB)", enc.encoded + 1); itss_0send(*security_socket, b_tx, enc.encoded + 1); @@ -1045,7 +1045,7 @@ static int networking_packet_indication_tcp(EIS_NetworkingPacketIndication_t* np npr->id = itss_id(npr->data.buf, npr->data.size); - buf[0] = 4; + buf[0] = ITSS_FACILITIES; enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, buf + 1, buf_len - 1); if (enc.encoded == -1) { log_error("NR encoding error (%s)", enc.failed_type->name); @@ -1079,7 +1079,7 @@ static int networking_packet_indication_tcp(EIS_NetworkingPacketIndication_t* np memcpy(fmi->data.buf, srep->data->choice.tlsRecv.data.buf, srep->data->choice.tlsRecv.data.size); uint8_t buffer[ITSS_SDU_MAX_LEN]; - buffer[0] = 4; // Facilities + buffer[0] = ITSS_FACILITIES; // Facilities asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_FacilitiesIndication, NULL, fi, buffer + 1, ITSS_SDU_MAX_LEN - 1); itss_queue_send(facilities.tx_queue, itss_queue_packet_new(buffer, enc.encoded + 1, ITSS_APPLICATIONS, id, "FI.message")); diff --git a/src/saem.c b/src/saem.c index 05c70a9..34fb593 100644 --- a/src/saem.c +++ b/src/saem.c @@ -327,7 +327,7 @@ void *sa_service() { void* security_socket = itss_0connect(facilities.zmq.security_address, ZMQ_REQ); uint8_t tr_oer[1024]; - tr_oer[0] = 4; // Facilities + tr_oer[0] = ITSS_FACILITIES; // Facilities int rv = 0; diff --git a/src/tpm.c b/src/tpm.c index a4694c8..82b0665 100644 --- a/src/tpm.c +++ b/src/tpm.c @@ -210,7 +210,7 @@ int tpm_pay(tolling_info_t* info, void** security_socket, uint8_t* neighbour, ui sreq->choice.sign.data.buf = malloc(enc.encoded); memcpy(sreq->choice.sign.data.buf, buf1, enc.encoded); - buf2[0] = 4; + buf2[0] = ITSS_FACILITIES; enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, buf2+1, 2047); log_debug("->[security] SecurityRequest.sign (%ldB)", enc.encoded+1); itss_0send(*security_socket, buf2, enc.encoded+1); @@ -313,7 +313,7 @@ int tpm_pay(tolling_info_t* info, void** security_socket, uint8_t* neighbour, ui ++tlsc->nmsg; sreq->choice.tlsSend.connId = id; - buf1[0] = 4; + buf1[0] = ITSS_FACILITIES; asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, buf1+1, buf_len-1); log_debug("[tolling]-> SecurityRequest.tlsSend ->[security] | size:%ldB", enc.encoded); @@ -376,7 +376,7 @@ int tpm_pay(tolling_info_t* info, void** security_socket, uint8_t* neighbour, ui } // encode TR - buf1[0] = 4; + buf1[0] = ITSS_FACILITIES; enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, buf1+1, buf_len-1); if (enc.encoded == -1) { log_error("[tolling] error encoding TR TPM.request (%s)", enc.failed_type->name); @@ -539,7 +539,7 @@ static int rsu_handle_recv(EI1_TPM_t* tpm_rx, void** security_socket, uint8_t* n // signature type sreq->choice.verify.type = ep->tpmSignature->type; - buf1[0] = 4; + buf1[0] = ITSS_FACILITIES; enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, buf1+1, buf_len-1); log_debug("->[security] SecurityRequest.verify (%ldB)", enc.encoded+1); itss_0send(*security_socket, buf1, enc.encoded+1); @@ -655,7 +655,7 @@ static int rsu_handle_recv(EI1_TPM_t* tpm_rx, void** security_socket, uint8_t* n // signature type sreq->choice.verify.type = tpm_rx->tpmSignature->type; - buf1[0] = 4; + buf1[0] = ITSS_FACILITIES; enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, buf1+1, buf_len-1); log_debug("->[security] SecurityRequest.verify (%ldB)", enc.encoded+1); itss_0send(*security_socket, buf1, enc.encoded+1); @@ -818,7 +818,7 @@ static int rsu_handle_recv(EI1_TPM_t* tpm_rx, void** security_socket, uint8_t* n sreq->choice.sign.data.buf = malloc(enc.encoded); memcpy(sreq->choice.sign.data.buf, buf1, enc.encoded); - buf1[0] = 4; + buf1[0] = ITSS_FACILITIES; enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, buf1+1, buf_len-1); if (enc.encoded == -1) { log_error("[tolling] error encoding SecurityRequest (%s)", enc.failed_type->name); @@ -939,7 +939,7 @@ static int rsu_handle_recv(EI1_TPM_t* tpm_rx, void** security_socket, uint8_t* n ++tlsc->nmsg; sreq->choice.tlsSend.connId = id; - buf1[0] = 4; + buf1[0] = ITSS_FACILITIES; asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, buf1+1, buf_len-1); log_debug("[tolling]-> SecurityRequest.tlsSend ->[security] | size:%ldB", enc.encoded); @@ -1001,7 +1001,7 @@ static int rsu_handle_recv(EI1_TPM_t* tpm_rx, void** security_socket, uint8_t* n } // encode TR - buf1[0] = 4; + buf1[0] = ITSS_FACILITIES; enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, nr, buf1+1, buf_len-1); if (enc.encoded == -1) { log_error("[tolling] error encoding TR TPM.reply (%s)", enc.failed_type->name); @@ -1188,7 +1188,7 @@ static int veh_handle_recv(tolling_t* tolling, EI1_TPM_t* tpm_rx, void** securit // signature type sreq->choice.verify.type = tpm_rx->tpmSignature->type; - buf1[0] = 4; + buf1[0] = ITSS_FACILITIES; enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, buf1+1, 2047); log_debug("->[security] SecurityRequest.verify (%ldB)", enc.encoded+1); itss_0send(*security_socket, buf1, enc.encoded+1); @@ -1249,7 +1249,7 @@ static int veh_handle_recv(tolling_t* tolling, EI1_TPM_t* tpm_rx, void** securit sreq->present = EIS_SecurityRequest_PR_tlsClose; sreq->choice.tlsClose.connId = tlsc->id; - buf1[0] = 4; + buf1[0] = ITSS_FACILITIES; enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, buf1+1, buf_len-1); log_debug("->[security] SecurityRequest.tlsClose (%ldB)", enc.encoded+1); itss_0send(*security_socket, buf1, enc.encoded+1); @@ -1268,7 +1268,7 @@ static int veh_handle_recv(tolling_t* tolling, EI1_TPM_t* tpm_rx, void** securit memcpy(tr->choice.data.choice.tcp.choice.connCloseReq.destinationAddress.buf, src_addr, 16); tr->choice.data.choice.tcp.choice.connCloseReq.id = id; - buf1[0] = 4; + buf1[0] = ITSS_FACILITIES; enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, tr, buf1+1, buf_len-1); itss_queue_send(tx_queue, itss_queue_packet_new(buf1, enc.encoded+1, ITSS_NETWORKING, id, "NR.data.tcp.connClose")); @@ -1502,7 +1502,7 @@ void tolling_tlsc_mgmt(itss_queue_t* tx_queue, void** security_socket) { sreq->present = EIS_SecurityRequest_PR_tlsClose; sreq->choice.tlsClose.connId = tlsc->id; - buf1[0] = 4; + buf1[0] = ITSS_FACILITIES; asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_SecurityRequest, NULL, sreq, buf1+1, buf_len-1); log_debug("->[security] SecurityRequest.tlsClose (%ldB)", enc.encoded+1); itss_0send(*security_socket, buf1, enc.encoded+1); @@ -1521,7 +1521,7 @@ void tolling_tlsc_mgmt(itss_queue_t* tx_queue, void** security_socket) { memcpy(tr->choice.data.choice.tcp.choice.connCloseReq.destinationAddress.buf, tlsc->ipv6, 16); tr->choice.data.choice.tcp.choice.connCloseReq.id = id; - buf1[0] = 4; + buf1[0] = ITSS_FACILITIES; enc = oer_encode_to_buffer(&asn_DEF_EIS_NetworkingRequest, NULL, tr, buf1+1, buf_len-1); itss_queue_send(tx_queue, itss_queue_packet_new(buf1, enc.encoded+1, ITSS_NETWORKING, id, "NR.data.tcp.connClose")); diff --git a/src/vcm.c b/src/vcm.c index a413e34..3e58de2 100644 --- a/src/vcm.c +++ b/src/vcm.c @@ -121,7 +121,7 @@ static void tx_vcm(EI1_VCM_t* vcm) { npr->data.buf = malloc(vcm_len); memcpy(npr->data.buf, buf, vcm_len); npr->data.size = vcm_len; - buf[0] = 4; + buf[0] = ITSS_FACILITIES; enc = asn_encode_to_buffer(NULL, ATS_CANONICAL_OER, &asn_DEF_EIS_NetworkingRequest, nr, buf+1, buf_len-1); if (enc.encoded == -1) { log_error("[vc] NR VCM.reply encode failure (%s)", enc.failed_type->name); @@ -137,7 +137,7 @@ static void tx_vcm(EI1_VCM_t* vcm) { fi->choice.message.data.size = npr->data.size; fi->choice.message.data.buf = malloc(npr->data.size); memcpy(fi->choice.message.data.buf, npr->data.buf, npr->data.size); - buf[0] = 4; + buf[0] = ITSS_FACILITIES; enc = asn_encode_to_buffer(NULL, ATS_CANONICAL_OER, &asn_DEF_EIS_FacilitiesIndication, fi, buf+1, buf_len-1); if (enc.encoded == -1) { log_error("[vc] TR VCM.reply encode failure (%s)", enc.failed_type->name);