Remove [sdu]

This commit is contained in:
emanuel 2022-10-21 16:44:46 +01:00
parent 42cee38184
commit 4904c8d3b2
2 changed files with 35 additions and 35 deletions

View File

@ -60,7 +60,7 @@ static int transport_indication(void* responder, void** security_socket, uint8_t
asn_dec_rval_t dec = oer_decode(NULL, &asn_DEF_TransportIndication, (void**) &ti, msg, msg_len);
if (dec.code) {
log_error("[sdu]<- invalid TI received");
log_error("<- invalid TI received");
rv = 1;
code = 1;
itss_0send(responder, &code, 1);
@ -76,7 +76,7 @@ static int transport_indication(void* responder, void** security_socket, uint8_t
transport_data_indication(&ti->choice.data, security_socket);
goto cleanup;
default:
log_debug("[sdu]<- unrecognized TI.choice received");
log_debug("<- unrecognized TI.choice received");
rv = 1;
goto cleanup;
}
@ -97,7 +97,7 @@ static int transport_indication(void* responder, void** security_socket, uint8_t
switch (tpi->present) {
case TransportPacketIndication_PR_btp:
id = tpi->choice.btp.id;
log_debug("[sdu]<- TI.packet.btp | id:%08x size:%dB", (uint32_t) id, msg_len);
log_debug("<- TI.packet.btp | id:%08x size:%dB", (uint32_t) id, msg_len);
// Parse message
switch (tpi->choice.btp.destinationPort) {
case Port_cam:
@ -159,7 +159,7 @@ static int transport_indication(void* responder, void** security_socket, uint8_t
dec = uper_decode_complete(NULL, its_msg_descriptor, (void**) &its_msg, tpi->choice.btp.data.buf, tpi->choice.btp.data.size);
if (dec.code) {
log_debug("[sdu]<- invalid %s received", its_msg_descriptor->name);
log_debug("<- invalid %s received", its_msg_descriptor->name);
rv = 1;
goto cleanup;
}
@ -264,7 +264,7 @@ static int transport_indication(void* responder, void** security_socket, uint8_t
id = tpi->choice.tcp.id;
packet = tpi->choice.tcp.data.buf;
packet_len = tpi->choice.tcp.data.size;
log_debug("[sdu]<- TI.packet.tcp | id:%ld size:%dB", id, msg_len);
log_debug("<- TI.packet.tcp | id:%ld size:%dB", id, msg_len);
sreq = calloc(1, sizeof(SecurityRequest_t));
sreq->present = SecurityRequest_PR_tlsRecv;
@ -288,10 +288,10 @@ static int transport_indication(void* responder, void** security_socket, uint8_t
b_tx[0] = 4;
asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_SecurityRequest, NULL, sreq, b_tx+1, 2047);
log_debug("[sdu]->[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);
int32_t rl = itss_0recv_rt(security_socket, b_rx, 2048, b_tx, enc.encoded+1, 1000);
log_debug("[sdu]<-[security] SecurityReply.tlsRecv (%dB)", rl);
log_debug("<-[security] SecurityReply.tlsRecv (%dB)", rl);
if (oer_decode(NULL, &asn_DEF_SecurityReply, (void**) &srep, b_rx, rl).code) {
log_error("SecurityReply.tlsRecv decode failure");
@ -307,10 +307,10 @@ static int transport_indication(void* responder, void** security_socket, uint8_t
sREQ->choice.tlsShutdown.connId = id;
b_tx[0] = 4;
asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_SecurityRequest, NULL, sREQ, b_tx+1, 2047);
log_debug("[sdu]->[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);
int32_t rl = itss_0recv_rt(security_socket, b_rx, 2048, b_tx, enc.encoded+1, 1000);
log_debug("[sdu]<-[security] SecurityReply.tlsShutdown (%dB)", rl);
log_debug("<-[security] SecurityReply.tlsShutdown (%dB)", rl);
rv = 1;
goto cleanup;
@ -362,7 +362,7 @@ static int transport_indication(void* responder, void** security_socket, uint8_t
if (facilities.tolling.enabled && srep->data->choice.tlsRecv.data.size) {
dec = uper_decode_complete(NULL, &asn_DEF_TPM, (void**) &its_msg, srep->data->choice.tlsRecv.data.buf, srep->data->choice.tlsRecv.data.size);
if (dec.code) {
log_debug("[sdu]<- invalid TPM received");
log_debug("<- invalid TPM received");
rv = 1;
goto cleanup;
}
@ -393,7 +393,7 @@ static int transport_indication(void* responder, void** security_socket, uint8_t
break;
case TransportPacketIndication_PR_udp:
id = tpi->choice.udp.id;
log_debug("[sdu]<- TI.packet.udp | id:%ld size:%dB", id, msg_len);
log_debug("<- TI.packet.udp | id:%ld size:%dB", id, msg_len);
break;
default:
@ -463,7 +463,7 @@ static int facilities_request(void* responder, uint8_t *msg, uint32_t msg_len) {
asn_dec_rval_t dec = oer_decode(NULL, &asn_DEF_FacilitiesRequest, (void**) &fr, msg, msg_len);
if (dec.code) {
log_error("[sdu]<- invalid FR received");
log_error("<- invalid FR received");
facilities_request_result_rejected(responder);
rv = 1;
goto cleanup;
@ -493,7 +493,7 @@ static int facilities_request(void* responder, uint8_t *msg, uint32_t msg_len) {
break;
default:
log_error("[sdu]<- unrecognized FDR type received (%d)", fr->choice.data.present);
log_error("<- unrecognized FDR type received (%d)", fr->choice.data.present);
facilities_request_result_rejected(responder);
rv = 1;
goto cleanup;
@ -501,7 +501,7 @@ static int facilities_request(void* responder, uint8_t *msg, uint32_t msg_len) {
break;
default:
log_error("[sdu]<- unrecognized FR type received (%d)", fr->present);
log_error("<- unrecognized FR type received (%d)", fr->present);
facilities_request_result_rejected(responder);
rv = 1;
goto cleanup;
@ -526,7 +526,7 @@ static int security_indication(void* responder_secured, uint8_t *msg, uint32_t m
asn_dec_rval_t dec = oer_decode(NULL, &asn_DEF_SecurityIndication, (void**) &si, msg, msg_len);
if (dec.code) {
log_error("[sdu]<- invalid SIndication received");
log_error("<- invalid SIndication received");
rv = 1;
goto cleanup;
}
@ -757,22 +757,22 @@ void* tx() {
for (int i = 0; i < stream->len; ++i) {
switch (stream->destination[i]) {
case ITSS_TRANSPORT:
log_debug("[sdu]-> %s ->[transport] | id:%08x size:%dB",
log_debug("-> %s ->[transport] | id:%08x size:%dB",
stream->info_msg[i], (uint32_t) stream->id[i], stream->packet_len[i]);
itss_0send(transport_socket, stream->packet[i], stream->packet_len[i]);
rv = itss_0recv_rt(&transport_socket, &code, 1, stream->packet[i], stream->packet_len[i], 1000);
if (rv == -1) {
log_error("[sdu]-> %s ->[transport] | id:%08x size:%dB <TIMEOUT>",
log_error("-> %s ->[transport] | id:%08x size:%dB <TIMEOUT>",
stream->info_msg[i], (uint32_t) stream->id[i], stream->packet_len[i]);
}
break;
case ITSS_APPLICATIONS:
log_debug("[sdu]-> %s ->[applications] | id:%08x size:%dB",
log_debug("-> %s ->[applications] | id:%08x size:%dB",
stream->info_msg[i], (uint32_t) stream->id[i], stream->packet_len[i]);
itss_0send(applications_socket, stream->packet[i], stream->packet_len[i]);
rv = itss_0recv_rt(&applications_socket, &code, 1, stream->packet[i], stream->packet_len[i], 1000);
if (rv == -1) {
log_error("[sdu]-> %s ->[applications] | id:%08x size:%dB <TIMEOUT>",
log_error("-> %s ->[applications] | id:%08x size:%dB <TIMEOUT>",
stream->info_msg[i], (uint32_t) stream->id[i], stream->packet_len[i]);
}
break;
@ -780,7 +780,7 @@ void* tx() {
itss_0send(management_socket, stream->packet[i], stream->packet_len[i]);
rv = itss_0recv_rt(&management_socket, &code, 1, stream->packet[i], stream->packet_len[i], 1000);
if (rv == -1) {
log_error("[sdu]-> %s ->[management] | id:%08x size:%dB <TIMEOUT>",
log_error("-> %s ->[management] | id:%08x size:%dB <TIMEOUT>",
stream->info_msg[i], (uint32_t) stream->id[i], stream->packet_len[i]);
}
break;
@ -929,7 +929,7 @@ int main() {
break;
default:
log_debug("[sdu]<- unrecognized service");
log_debug("<- unrecognized service");
code = 1;
itss_0send(facilities.zmq.responders[i].socket, &code, 1);
continue;

View File

@ -211,10 +211,10 @@ int tpm_pay(tolling_info_t* info, void** security_socket, uint8_t* neighbour, ui
buf2[0] = 4;
enc = oer_encode_to_buffer(&asn_DEF_SecurityRequest, NULL, sreq, buf2+1, 2047);
log_debug("[sdu]->[security] SecurityRequest.sign (%ldB)", enc.encoded+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);
log_debug("[sdu]<-[security] SecurityReply.sign (%dB)", rl);
log_debug("<-[security] SecurityReply.sign (%dB)", rl);
if (oer_decode(NULL, &asn_DEF_SecurityReply, (void**) &srep, buf1, rl).code) {
log_error("SecurityReply.sign decode failure");
@ -516,10 +516,10 @@ static void rsu_handle_recv(TPM_t* tpm_rx, void** security_socket, uint8_t* neig
buf1[0] = 4;
enc = oer_encode_to_buffer(&asn_DEF_SecurityRequest, NULL, sreq, buf1+1, buf_len-1);
log_debug("[sdu]->[security] SecurityRequest.verify (%ldB)", enc.encoded+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);
log_debug("[sdu]<-[security] SecurityReply.verify (%dB)", rl);
log_debug("<-[security] SecurityReply.verify (%dB)", rl);
if (oer_decode(NULL, &asn_DEF_SecurityReply, (void**) &srep, buf2, rl).code) {
log_error("SecurityReply.verify decode failure");
@ -626,10 +626,10 @@ static void rsu_handle_recv(TPM_t* tpm_rx, void** security_socket, uint8_t* neig
buf1[0] = 4;
enc = oer_encode_to_buffer(&asn_DEF_SecurityRequest, NULL, sreq, buf1+1, buf_len-1);
log_debug("[sdu]->[security] SecurityRequest.verify (%ldB)", enc.encoded+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);
log_debug("[sdu]<-[security] SecurityReply.verify (%dB)", rl);
log_debug("<-[security] SecurityReply.verify (%dB)", rl);
if (oer_decode(NULL, &asn_DEF_SecurityReply, (void**) &srep, buf2, rl).code) {
log_error("SecurityReply.verify decode failure");
@ -787,10 +787,10 @@ static void rsu_handle_recv(TPM_t* tpm_rx, void** security_socket, uint8_t* neig
log_error("[tolling] error encoding SecurityRequest (%s)", enc.failed_type->name);
goto cleanup;
}
log_debug("[sdu]->[security] SecurityRequest.sign (%ldB)", enc.encoded+1);
log_debug("->[security] SecurityRequest.sign (%ldB)", enc.encoded+1);
itss_0send(*security_socket, buf1, enc.encoded+1);
int rc = itss_0recv_rt(security_socket, buf2, buf_len, buf1, enc.encoded+1, 1000);
log_debug("[sdu]<-[security] SecurityReply.sign (%dB)", rc);
log_debug("<-[security] SecurityReply.sign (%dB)", rc);
if (oer_decode(NULL, &asn_DEF_SecurityReply, (void**) &srep, buf2, rc).code) {
log_error("SecurityReply.sign decode failure");
@ -1120,10 +1120,10 @@ static void veh_handle_recv(tolling_t* tolling, TPM_t* tpm_rx, void** security_s
buf1[0] = 4;
enc = oer_encode_to_buffer(&asn_DEF_SecurityRequest, NULL, sreq, buf1+1, 2047);
log_debug("[sdu]->[security] SecurityRequest.verify (%ldB)", enc.encoded+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);
log_debug("[sdu]<-[security] SecurityReply.verify (%dB)", rl);
log_debug("<-[security] SecurityReply.verify (%dB)", rl);
if (oer_decode(NULL, &asn_DEF_SecurityReply, (void**) &srep, buf2, rl).code) {
log_error("SecurityReply.verify decode failure");
@ -1178,10 +1178,10 @@ static void veh_handle_recv(tolling_t* tolling, TPM_t* tpm_rx, void** security_s
buf1[0] = 4;
enc = oer_encode_to_buffer(&asn_DEF_SecurityRequest, NULL, sreq, buf1+1, buf_len-1);
log_debug("[sdu]->[security] SecurityRequest.tlsClose (%ldB)", enc.encoded+1);
log_debug("->[security] SecurityRequest.tlsClose (%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);
log_debug("[sdu]<-[security] SecurityReply.tlsClose (%dB)", rl);
log_debug("<-[security] SecurityReply.tlsClose (%dB)", rl);
uint32_t id = rand();
tr = calloc(1, sizeof(TransportRequest_t));
@ -1426,10 +1426,10 @@ void tolling_tlsc_mgmt(itss_queue_t* tx_queue, void** security_socket) {
buf1[0] = 4;
asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_SecurityRequest, NULL, sreq, buf1+1, buf_len-1);
log_debug("[sdu]->[security] SecurityRequest.tlsClose (%ldB)", enc.encoded+1);
log_debug("->[security] SecurityRequest.tlsClose (%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);
log_debug("[sdu]<-[security] SecurityReply.tlsClose (%dB)", rl);
log_debug("<-[security] SecurityReply.tlsClose (%dB)", rl);
uint64_t id = rand() + 1;
tr = calloc(1, sizeof(TransportRequest_t));