Enable unknown packet forwarding
This commit is contained in:
parent
8d7b2ac638
commit
3e53b9b08a
|
|
@ -386,6 +386,9 @@ int facilities_config() {
|
|||
// Replay
|
||||
facilities.replay = etsi_its_cfg->networking.replay.activate;
|
||||
|
||||
// Forward unknown packets (in-stack)
|
||||
facilities.upf = etsi_its_cfg->general.unknown_packet_forwarding;
|
||||
|
||||
// PZ
|
||||
if (facilities.station_type == 15) {
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ typedef struct facilities {
|
|||
int station_type;
|
||||
bool use_security;
|
||||
bool replay;
|
||||
bool upf;
|
||||
|
||||
struct {
|
||||
uint16_t width;
|
||||
|
|
|
|||
587
src/requests.c
587
src/requests.c
|
|
@ -93,6 +93,7 @@ int facilities_request_single_message(void *responder, FacilitiesMessageRequest_
|
|||
asn_TYPE_descriptor_t *its_msg_def = NULL;
|
||||
|
||||
bool fwd = true;
|
||||
bool process_msg = true;
|
||||
|
||||
uint64_t transmission_duration = 0;
|
||||
uint32_t transmission_interval = 0;
|
||||
|
|
@ -121,7 +122,6 @@ int facilities_request_single_message(void *responder, FacilitiesMessageRequest_
|
|||
npr->transport.choice.btp.destinationPort = Port_ivim;
|
||||
npr->network.choice.gn.packetTransportType = PacketTransportType_shb;
|
||||
npr->network.choice.gn.trafficClass = 1;
|
||||
|
||||
break;
|
||||
|
||||
case ItsMessageType_cpm:
|
||||
|
|
@ -141,18 +141,17 @@ int facilities_request_single_message(void *responder, FacilitiesMessageRequest_
|
|||
break;
|
||||
|
||||
default:
|
||||
log_error("unrecognized FR message type (%lld)", frm->itsMessageType);
|
||||
facilities_request_result_rejected(responder);
|
||||
rv = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
asn_dec_rval_t dec = uper_decode_complete(NULL, its_msg_def, (void **)&its_msg, frm->data.buf, frm->data.size);
|
||||
if (dec.code) {
|
||||
log_warn("invalid FR %s received", its_msg_def->name);
|
||||
facilities_request_result_rejected(responder);
|
||||
rv = 1;
|
||||
goto cleanup;
|
||||
if (!facilities.upf) {
|
||||
log_error("unrecognized FR message type (%lld)", frm->itsMessageType);
|
||||
facilities_request_result_rejected(responder);
|
||||
rv = 1;
|
||||
goto cleanup;
|
||||
} else {
|
||||
process_msg = false;
|
||||
npr->transport.choice.btp.destinationPort = 7120;
|
||||
npr->network.choice.gn.packetTransportType = PacketTransportType_shb;
|
||||
npr->network.choice.gn.trafficClass = 1;
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t id = 0;
|
||||
|
|
@ -163,160 +162,171 @@ int facilities_request_single_message(void *responder, FacilitiesMessageRequest_
|
|||
}
|
||||
|
||||
bool is_update = false;
|
||||
|
||||
int managed_msg = false;
|
||||
if (frm->itsMessageType == ItsMessageType_denm) {
|
||||
managed_msg = true;
|
||||
|
||||
uint8_t event_type = event_manage(its_msg, &id, NULL, 0);
|
||||
// Do not free its_msg! event_manage takes care of the msg
|
||||
// id will get set to another val if EVENT NEW or UPDATE or CANCELLATION or NEGATION
|
||||
if (event_type != EVENT_NEW &&
|
||||
event_type != EVENT_UPDATE &&
|
||||
event_type != EVENT_CANCELLATION &&
|
||||
event_type != EVENT_NEGATION) {
|
||||
fwd = false;
|
||||
if (process_msg) {
|
||||
asn_dec_rval_t dec = uper_decode_complete(NULL, its_msg_def, (void **)&its_msg, frm->data.buf, frm->data.size);
|
||||
if (dec.code) {
|
||||
log_warn("invalid FR %s received", its_msg_def->name);
|
||||
facilities_request_result_rejected(responder);
|
||||
rv = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (event_type == EVENT_UPDATE ||
|
||||
event_type == EVENT_CANCELLATION ||
|
||||
event_type == EVENT_NEGATION) {
|
||||
is_update = true;
|
||||
}
|
||||
|
||||
if (fwd) {
|
||||
// set stationID
|
||||
pthread_mutex_lock(&facilities.id.lock);
|
||||
((DENM_t *)its_msg)->header.stationID = facilities.id.station_id;
|
||||
pthread_mutex_unlock(&facilities.id.lock);
|
||||
|
||||
// Set only one trace
|
||||
if (facilities.station_type != 15) {
|
||||
pthread_mutex_lock(&facilities.lightship.lock);
|
||||
if (facilities.lightship.path_history_len > 0) {
|
||||
if (!((DENM_t *)its_msg)->denm.location) {
|
||||
((DENM_t *)its_msg)->denm.location = calloc(1, sizeof(LocationContainer_t));
|
||||
}
|
||||
((DENM_t *)its_msg)->denm.location->traces.list.count = 1;
|
||||
((DENM_t *)its_msg)->denm.location->traces.list.size = 1 * sizeof(void *);
|
||||
((DENM_t *)its_msg)->denm.location->traces.list.array = malloc(1 * sizeof(void *));
|
||||
((DENM_t *)its_msg)->denm.location->traces.list.array[0] = calloc(1, sizeof(PathHistory_t));
|
||||
PathHistory_t *ph = ((DENM_t *)its_msg)->denm.location->traces.list.array[0];
|
||||
|
||||
pos_point_t **path_history = facilities.lightship.path_history;
|
||||
uint16_t path_history_len = facilities.lightship.path_history_len;
|
||||
|
||||
ph->list.array = malloc((path_history_len) * sizeof(void *));
|
||||
ph->list.count = path_history_len;
|
||||
ph->list.size = (path_history_len) * sizeof(void *);
|
||||
|
||||
ph->list.array[0] = calloc(1, sizeof(PathPoint_t));
|
||||
|
||||
itss_space_lock();
|
||||
if (path_history[0]->alt != AltitudeValue_unavailable && epv.space.altitude != AltitudeValue_unavailable) {
|
||||
ph->list.array[0]->pathPosition.deltaAltitude = path_history[0]->alt - epv.space.altitude;
|
||||
} else {
|
||||
ph->list.array[0]->pathPosition.deltaAltitude = DeltaAltitude_unavailable;
|
||||
}
|
||||
|
||||
if (path_history[0]->lat != Latitude_unavailable && epv.space.latitude != Latitude_unavailable) {
|
||||
ph->list.array[0]->pathPosition.deltaLatitude = path_history[0]->lat - epv.space.latitude;
|
||||
} else {
|
||||
ph->list.array[0]->pathPosition.deltaLatitude = DeltaLatitude_unavailable;
|
||||
}
|
||||
|
||||
if (path_history[0]->lon != Longitude_unavailable && epv.space.longitude != Longitude_unavailable) {
|
||||
ph->list.array[0]->pathPosition.deltaLongitude = path_history[0]->lon - epv.space.longitude;
|
||||
} else {
|
||||
ph->list.array[0]->pathPosition.deltaLongitude = DeltaLongitude_unavailable;
|
||||
}
|
||||
itss_space_unlock();
|
||||
|
||||
ph->list.array[0]->pathDeltaTime = calloc(1, sizeof(PathDeltaTime_t));
|
||||
*ph->list.array[0]->pathDeltaTime = (itss_time_get() - path_history[0]->ts) / 10;
|
||||
|
||||
for (int i = 1; i < path_history_len; ++i) {
|
||||
ph->list.array[i] = calloc(1, sizeof(PathPoint_t));
|
||||
|
||||
if (path_history[i]->alt != AltitudeValue_unavailable && path_history[i - 1]->alt != AltitudeValue_unavailable) {
|
||||
ph->list.array[i]->pathPosition.deltaAltitude = path_history[i]->alt - path_history[i - 1]->alt;
|
||||
} else {
|
||||
ph->list.array[i]->pathPosition.deltaAltitude = DeltaAltitude_unavailable;
|
||||
}
|
||||
|
||||
if (path_history[i]->lat != Latitude_unavailable && path_history[i - 1]->lat != Latitude_unavailable) {
|
||||
ph->list.array[i]->pathPosition.deltaLatitude = path_history[i]->lat - path_history[i - 1]->lat;
|
||||
} else {
|
||||
ph->list.array[i]->pathPosition.deltaLatitude = DeltaLatitude_unavailable;
|
||||
}
|
||||
|
||||
if (path_history[i]->lon != Longitude_unavailable && path_history[i - 1]->lon != Longitude_unavailable) {
|
||||
ph->list.array[i]->pathPosition.deltaLongitude = path_history[i]->lon - path_history[i - 1]->lon;
|
||||
} else {
|
||||
ph->list.array[i]->pathPosition.deltaLongitude = DeltaLongitude_unavailable;
|
||||
}
|
||||
|
||||
ph->list.array[i]->pathDeltaTime = calloc(1, sizeof(PathDeltaTime_t));
|
||||
*ph->list.array[i]->pathDeltaTime = (path_history[i - 1]->ts - path_history[i]->ts) / 10;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&facilities.lightship.lock);
|
||||
switch (frm->itsMessageType) {
|
||||
case ItsMessageType_denm:
|
||||
managed_msg = true;
|
||||
uint8_t event_type = event_manage(its_msg, &id, NULL, 0);
|
||||
// Do not free its_msg! event_manage takes care of the msg
|
||||
// id will get set to another val if EVENT NEW or UPDATE or CANCELLATION or NEGATION
|
||||
if (event_type != EVENT_NEW &&
|
||||
event_type != EVENT_UPDATE &&
|
||||
event_type != EVENT_CANCELLATION &&
|
||||
event_type != EVENT_NEGATION) {
|
||||
fwd = false;
|
||||
}
|
||||
|
||||
// get, set retransmission, duration
|
||||
if (((DENM_t *)its_msg)->denm.management.transmissionInterval) {
|
||||
transmission_interval = *((uint32_t *)((DENM_t *)its_msg)->denm.management.transmissionInterval);
|
||||
if (event_type == EVENT_UPDATE ||
|
||||
event_type == EVENT_CANCELLATION ||
|
||||
event_type == EVENT_NEGATION) {
|
||||
is_update = true;
|
||||
}
|
||||
|
||||
if (((DENM_t *)its_msg)->denm.management.validityDuration) {
|
||||
transmission_duration = *((uint32_t *)((DENM_t *)its_msg)->denm.management.validityDuration) * 1000;
|
||||
if (fwd) {
|
||||
// set stationID
|
||||
pthread_mutex_lock(&facilities.id.lock);
|
||||
((DENM_t *)its_msg)->header.stationID = facilities.id.station_id;
|
||||
pthread_mutex_unlock(&facilities.id.lock);
|
||||
|
||||
// Set only one trace
|
||||
if (facilities.station_type != 15) {
|
||||
pthread_mutex_lock(&facilities.lightship.lock);
|
||||
if (facilities.lightship.path_history_len > 0) {
|
||||
if (!((DENM_t *)its_msg)->denm.location) {
|
||||
((DENM_t *)its_msg)->denm.location = calloc(1, sizeof(LocationContainer_t));
|
||||
}
|
||||
((DENM_t *)its_msg)->denm.location->traces.list.count = 1;
|
||||
((DENM_t *)its_msg)->denm.location->traces.list.size = 1 * sizeof(void *);
|
||||
((DENM_t *)its_msg)->denm.location->traces.list.array = malloc(1 * sizeof(void *));
|
||||
((DENM_t *)its_msg)->denm.location->traces.list.array[0] = calloc(1, sizeof(PathHistory_t));
|
||||
PathHistory_t *ph = ((DENM_t *)its_msg)->denm.location->traces.list.array[0];
|
||||
|
||||
pos_point_t **path_history = facilities.lightship.path_history;
|
||||
uint16_t path_history_len = facilities.lightship.path_history_len;
|
||||
|
||||
ph->list.array = malloc((path_history_len) * sizeof(void *));
|
||||
ph->list.count = path_history_len;
|
||||
ph->list.size = (path_history_len) * sizeof(void *);
|
||||
|
||||
ph->list.array[0] = calloc(1, sizeof(PathPoint_t));
|
||||
|
||||
itss_space_lock();
|
||||
if (path_history[0]->alt != AltitudeValue_unavailable && epv.space.altitude != AltitudeValue_unavailable) {
|
||||
ph->list.array[0]->pathPosition.deltaAltitude = path_history[0]->alt - epv.space.altitude;
|
||||
} else {
|
||||
ph->list.array[0]->pathPosition.deltaAltitude = DeltaAltitude_unavailable;
|
||||
}
|
||||
|
||||
if (path_history[0]->lat != Latitude_unavailable && epv.space.latitude != Latitude_unavailable) {
|
||||
ph->list.array[0]->pathPosition.deltaLatitude = path_history[0]->lat - epv.space.latitude;
|
||||
} else {
|
||||
ph->list.array[0]->pathPosition.deltaLatitude = DeltaLatitude_unavailable;
|
||||
}
|
||||
|
||||
if (path_history[0]->lon != Longitude_unavailable && epv.space.longitude != Longitude_unavailable) {
|
||||
ph->list.array[0]->pathPosition.deltaLongitude = path_history[0]->lon - epv.space.longitude;
|
||||
} else {
|
||||
ph->list.array[0]->pathPosition.deltaLongitude = DeltaLongitude_unavailable;
|
||||
}
|
||||
itss_space_unlock();
|
||||
|
||||
ph->list.array[0]->pathDeltaTime = calloc(1, sizeof(PathDeltaTime_t));
|
||||
*ph->list.array[0]->pathDeltaTime = (itss_time_get() - path_history[0]->ts) / 10;
|
||||
|
||||
for (int i = 1; i < path_history_len; ++i) {
|
||||
ph->list.array[i] = calloc(1, sizeof(PathPoint_t));
|
||||
|
||||
if (path_history[i]->alt != AltitudeValue_unavailable && path_history[i - 1]->alt != AltitudeValue_unavailable) {
|
||||
ph->list.array[i]->pathPosition.deltaAltitude = path_history[i]->alt - path_history[i - 1]->alt;
|
||||
} else {
|
||||
ph->list.array[i]->pathPosition.deltaAltitude = DeltaAltitude_unavailable;
|
||||
}
|
||||
|
||||
if (path_history[i]->lat != Latitude_unavailable && path_history[i - 1]->lat != Latitude_unavailable) {
|
||||
ph->list.array[i]->pathPosition.deltaLatitude = path_history[i]->lat - path_history[i - 1]->lat;
|
||||
} else {
|
||||
ph->list.array[i]->pathPosition.deltaLatitude = DeltaLatitude_unavailable;
|
||||
}
|
||||
|
||||
if (path_history[i]->lon != Longitude_unavailable && path_history[i - 1]->lon != Longitude_unavailable) {
|
||||
ph->list.array[i]->pathPosition.deltaLongitude = path_history[i]->lon - path_history[i - 1]->lon;
|
||||
} else {
|
||||
ph->list.array[i]->pathPosition.deltaLongitude = DeltaLongitude_unavailable;
|
||||
}
|
||||
|
||||
ph->list.array[i]->pathDeltaTime = calloc(1, sizeof(PathDeltaTime_t));
|
||||
*ph->list.array[i]->pathDeltaTime = (path_history[i - 1]->ts - path_history[i]->ts) / 10;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&facilities.lightship.lock);
|
||||
}
|
||||
|
||||
// get, set retransmission, duration
|
||||
if (((DENM_t *)its_msg)->denm.management.transmissionInterval) {
|
||||
transmission_interval = *((uint32_t *)((DENM_t *)its_msg)->denm.management.transmissionInterval);
|
||||
|
||||
if (((DENM_t *)its_msg)->denm.management.validityDuration) {
|
||||
transmission_duration = *((uint32_t *)((DENM_t *)its_msg)->denm.management.validityDuration) * 1000;
|
||||
} else {
|
||||
transmission_duration = 600 * 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ItsMessageType_ivim:
|
||||
managed_msg = true;
|
||||
uint8_t service_type = service_eval(SERVICE_IVI, its_msg, &id, NULL, 0);
|
||||
|
||||
if (service_type != SERVICE_NEW &&
|
||||
service_type != SERVICE_UPDATE &&
|
||||
service_type != SERVICE_CANCELLATION &&
|
||||
service_type != SERVICE_NEGATION) {
|
||||
fwd = false;
|
||||
}
|
||||
|
||||
if (service_type == SERVICE_UPDATE ||
|
||||
service_type == SERVICE_CANCELLATION ||
|
||||
service_type == SERVICE_NEGATION) {
|
||||
is_update = true;
|
||||
}
|
||||
|
||||
if (fwd) {
|
||||
uint64_t valid_to, valid_from;
|
||||
|
||||
if (!((IVIM_t *)its_msg)->ivi.mandatory.validFrom) {
|
||||
valid_from = itss_time_get();
|
||||
} else {
|
||||
transmission_duration = 600 * 1000;
|
||||
asn_INTEGER2ulong((INTEGER_t *)((IVIM_t *)its_msg)->ivi.mandatory.validFrom, (unsigned long long *)&valid_from);
|
||||
}
|
||||
|
||||
if (!((IVIM_t *)its_msg)->ivi.mandatory.validTo) {
|
||||
valid_to = valid_from + facilities.infrastructure.default_service_duration;
|
||||
} else {
|
||||
asn_INTEGER2ulong((INTEGER_t *)((IVIM_t *)its_msg)->ivi.mandatory.validTo, (unsigned long long *)&valid_to);
|
||||
}
|
||||
|
||||
transmission_start = valid_from;
|
||||
transmission_interval = facilities.infrastructure.replay_interval;
|
||||
transmission_duration = valid_to - valid_from;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (frm->itsMessageType == ItsMessageType_ivim) {
|
||||
managed_msg = true;
|
||||
|
||||
uint8_t service_type = service_eval(SERVICE_IVI, its_msg, &id, NULL, 0);
|
||||
|
||||
if (service_type != SERVICE_NEW &&
|
||||
service_type != SERVICE_UPDATE &&
|
||||
service_type != SERVICE_CANCELLATION &&
|
||||
service_type != SERVICE_NEGATION) {
|
||||
fwd = false;
|
||||
if (!facilities.replay) {
|
||||
transmission_interval = 0;
|
||||
transmission_duration = 0;
|
||||
}
|
||||
|
||||
if (service_type == SERVICE_UPDATE ||
|
||||
service_type == SERVICE_CANCELLATION ||
|
||||
service_type == SERVICE_NEGATION) {
|
||||
is_update = true;
|
||||
}
|
||||
|
||||
if (fwd) {
|
||||
uint64_t valid_to, valid_from;
|
||||
|
||||
if (!((IVIM_t *)its_msg)->ivi.mandatory.validFrom) {
|
||||
valid_from = itss_time_get();
|
||||
} else {
|
||||
asn_INTEGER2ulong((INTEGER_t *)((IVIM_t *)its_msg)->ivi.mandatory.validFrom, (unsigned long long *)&valid_from);
|
||||
}
|
||||
|
||||
if (!((IVIM_t *)its_msg)->ivi.mandatory.validTo) {
|
||||
valid_to = valid_from + facilities.infrastructure.default_service_duration;
|
||||
} else {
|
||||
asn_INTEGER2ulong((INTEGER_t *)((IVIM_t *)its_msg)->ivi.mandatory.validTo, (unsigned long long *)&valid_to);
|
||||
}
|
||||
|
||||
transmission_start = valid_from;
|
||||
transmission_interval = facilities.infrastructure.replay_interval;
|
||||
transmission_duration = valid_to - valid_from;
|
||||
}
|
||||
} else if (frm->itsMessageType == ItsMessageType_evrsr) {
|
||||
managed_msg = true;
|
||||
}
|
||||
if (!facilities.replay) {
|
||||
transmission_interval = 0;
|
||||
transmission_duration = 0;
|
||||
}
|
||||
|
||||
// Respond to [applications]
|
||||
|
|
@ -641,6 +651,7 @@ static int networking_packet_indication_btp(NetworkingPacketIndication_t* npi, v
|
|||
|
||||
bool fwd = false;
|
||||
bool stored = false;
|
||||
bool process_msg = true;
|
||||
|
||||
uint16_t buf_len = 2048;
|
||||
uint8_t buf[buf_len];
|
||||
|
|
@ -704,150 +715,158 @@ static int networking_packet_indication_btp(NetworkingPacketIndication_t* npi, v
|
|||
break;
|
||||
|
||||
default:
|
||||
log_debug("messsage with unhandled BTP port received (%lld), ignoring", bpi->destinationPort);
|
||||
if (!facilities.upf) {
|
||||
log_debug("messsage with unhandled BTP port received (%lld), ignoring", bpi->destinationPort);
|
||||
goto cleanup;
|
||||
} else {
|
||||
process_msg = false;
|
||||
fwd = true;
|
||||
its_msg_type = 7120;
|
||||
}
|
||||
}
|
||||
|
||||
if (process_msg) {
|
||||
asn_dec_rval_t dec = uper_decode_complete(NULL, its_msg_descriptor, (void **)&its_msg, npi->data.buf, npi->data.size);
|
||||
if (dec.code) {
|
||||
log_debug("<- invalid %s received", its_msg_descriptor->name);
|
||||
rv = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
asn_dec_rval_t dec = uper_decode_complete(NULL, its_msg_descriptor, (void **)&its_msg, npi->data.buf, npi->data.size);
|
||||
if (dec.code) {
|
||||
log_debug("<- invalid %s received", its_msg_descriptor->name);
|
||||
rv = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
// Get permisisons
|
||||
uint8_t *ssp = NULL;
|
||||
uint16_t ssp_len;
|
||||
uint8_t* neighbour_cert = NULL;
|
||||
|
||||
// Get permisisons
|
||||
uint8_t *ssp = NULL;
|
||||
uint16_t ssp_len;
|
||||
uint8_t* neighbour_cert = NULL;
|
||||
switch (npi->network.present) {
|
||||
case NetworkingPacketRequestNW_PR_gn:
|
||||
if (npi->network.choice.gn.securityPermissions) {
|
||||
ssp = npi->network.choice.gn.securityPermissions->ssp.buf;
|
||||
ssp_len = npi->network.choice.gn.securityPermissions->ssp.size;
|
||||
}
|
||||
if (npi->network.choice.gn.securityNeighbour) {
|
||||
neighbour_cert = npi->network.choice.gn.securityNeighbour->buf;
|
||||
}
|
||||
break;
|
||||
case NetworkingPacketRequestNW_PR_gn6a:
|
||||
if (npi->network.choice.gn6a.gn.securityPermissions) {
|
||||
ssp = npi->network.choice.gn6a.gn.securityPermissions->ssp.buf;
|
||||
ssp_len = npi->network.choice.gn6a.gn.securityPermissions->ssp.size;
|
||||
}
|
||||
if (npi->network.choice.gn6a.gn.securityNeighbour) {
|
||||
neighbour_cert = npi->network.choice.gn6a.gn.securityNeighbour->buf;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (npi->network.present) {
|
||||
case NetworkingPacketRequestNW_PR_gn:
|
||||
if (npi->network.choice.gn.securityPermissions) {
|
||||
ssp = npi->network.choice.gn.securityPermissions->ssp.buf;
|
||||
ssp_len = npi->network.choice.gn.securityPermissions->ssp.size;
|
||||
}
|
||||
if (npi->network.choice.gn.securityNeighbour) {
|
||||
neighbour_cert = npi->network.choice.gn.securityNeighbour->buf;
|
||||
}
|
||||
break;
|
||||
case NetworkingPacketRequestNW_PR_gn6a:
|
||||
if (npi->network.choice.gn6a.gn.securityPermissions) {
|
||||
ssp = npi->network.choice.gn6a.gn.securityPermissions->ssp.buf;
|
||||
ssp_len = npi->network.choice.gn6a.gn.securityPermissions->ssp.size;
|
||||
}
|
||||
if (npi->network.choice.gn6a.gn.securityNeighbour) {
|
||||
neighbour_cert = npi->network.choice.gn6a.gn.securityNeighbour->buf;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// Manage message
|
||||
switch (bpi->destinationPort) {
|
||||
case Port_cam:
|
||||
switch (check_cam(bpi, its_msg, ssp, ssp_len)) {
|
||||
case CAM_OK:
|
||||
fwd = true;
|
||||
break;
|
||||
case CAM_INVALID:
|
||||
case CAM_BAD_PERMISSIONS:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
// Manage message
|
||||
switch (bpi->destinationPort) {
|
||||
case Port_cam:
|
||||
switch (check_cam(bpi, its_msg, ssp, ssp_len)) {
|
||||
case CAM_OK:
|
||||
fwd = true;
|
||||
break;
|
||||
case CAM_INVALID:
|
||||
case CAM_BAD_PERMISSIONS:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case Port_denm:
|
||||
case Port_denm:
|
||||
#ifdef DEBUG
|
||||
uint8_t *xml_denm = malloc(32768);
|
||||
asn_enc_rval_t rve = xer_encode_to_buffer(xml_denm, 32768, 0x02, &asn_DEF_DENM, its_msg);
|
||||
log_debug("DENM XER %d: %.*s", (int)rve.encoded, (int)rve.encoded, xml_denm);
|
||||
free(xml_denm);
|
||||
uint8_t *xml_denm = malloc(32768);
|
||||
asn_enc_rval_t rve = xer_encode_to_buffer(xml_denm, 32768, 0x02, &asn_DEF_DENM, its_msg);
|
||||
log_debug("DENM XER %d: %.*s", (int)rve.encoded, (int)rve.encoded, xml_denm);
|
||||
free(xml_denm);
|
||||
#endif
|
||||
stored = true;
|
||||
switch (event_manage(its_msg, &id, ssp, ssp_len)) {
|
||||
case EVENT_NEW:
|
||||
case EVENT_CANCELLATION:
|
||||
case EVENT_NEGATION:
|
||||
case EVENT_UPDATE:
|
||||
case EVENT_NUMBER_EXCEEDED:
|
||||
fwd = true;
|
||||
break;
|
||||
case EVENT_INVALID:
|
||||
case EVENT_PASSED:
|
||||
case EVENT_REPEATED:
|
||||
case EVENT_BAD_PERMISSIONS:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
stored = true;
|
||||
switch (event_manage(its_msg, &id, ssp, ssp_len)) {
|
||||
case EVENT_NEW:
|
||||
case EVENT_CANCELLATION:
|
||||
case EVENT_NEGATION:
|
||||
case EVENT_UPDATE:
|
||||
case EVENT_NUMBER_EXCEEDED:
|
||||
fwd = true;
|
||||
break;
|
||||
case EVENT_INVALID:
|
||||
case EVENT_PASSED:
|
||||
case EVENT_REPEATED:
|
||||
case EVENT_BAD_PERMISSIONS:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case Port_ivim:
|
||||
stored = true;
|
||||
switch (service_eval(SERVICE_IVI, its_msg, &id, ssp, ssp_len)) {
|
||||
case SERVICE_NEW:
|
||||
case SERVICE_CANCELLATION:
|
||||
case SERVICE_NEGATION:
|
||||
case SERVICE_UPDATE:
|
||||
case SERVICE_NUMBER_EXCEEDED:
|
||||
fwd = true;
|
||||
break;
|
||||
case SERVICE_INVALID:
|
||||
case SERVICE_REPEATED:
|
||||
case SERVICE_PASSED:
|
||||
case SERVICE_BAD_PERMISSIONS:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Port_ivim:
|
||||
stored = true;
|
||||
switch (service_eval(SERVICE_IVI, its_msg, &id, ssp, ssp_len)) {
|
||||
case SERVICE_NEW:
|
||||
case SERVICE_CANCELLATION:
|
||||
case SERVICE_NEGATION:
|
||||
case SERVICE_UPDATE:
|
||||
case SERVICE_NUMBER_EXCEEDED:
|
||||
fwd = true;
|
||||
break;
|
||||
case SERVICE_INVALID:
|
||||
case SERVICE_REPEATED:
|
||||
case SERVICE_PASSED:
|
||||
case SERVICE_BAD_PERMISSIONS:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case Port_saem:
|
||||
switch (saem_check(its_msg, neighbour_cert)) {
|
||||
case SAEM_NEW:
|
||||
fwd = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Port_saem:
|
||||
switch (saem_check(its_msg, neighbour_cert)) {
|
||||
case SAEM_NEW:
|
||||
fwd = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 7011:
|
||||
if (facilities.tolling.protocol.p == TOLLING_PROTOCOL_GN_SPKI) { /* do not wait for facilities process if spki */
|
||||
case 7011:
|
||||
if (facilities.tolling.protocol.p == TOLLING_PROTOCOL_GN_SPKI) { /* do not wait for facilities process if spki */
|
||||
fwd_to_apps(npi->data.buf, npi->data.size, bpi->destinationPort, npi->id);
|
||||
fwd = false;
|
||||
} else {
|
||||
fwd = true;
|
||||
}
|
||||
if (facilities.tolling.enabled) {
|
||||
tpm_recv(its_msg, security_socket, neighbour_cert, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2043:
|
||||
fwd_to_apps(npi->data.buf, npi->data.size, bpi->destinationPort, npi->id);
|
||||
fwd = false;
|
||||
} else {
|
||||
fwd = true;
|
||||
}
|
||||
if (facilities.tolling.enabled) {
|
||||
tpm_recv(its_msg, security_socket, neighbour_cert, NULL);
|
||||
}
|
||||
break;
|
||||
if (facilities.coordination.active) {
|
||||
vcm_check(its_msg);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2043:
|
||||
fwd_to_apps(npi->data.buf, npi->data.size, bpi->destinationPort, npi->id);
|
||||
fwd = false;
|
||||
if (facilities.coordination.active) {
|
||||
vcm_check(its_msg);
|
||||
}
|
||||
break;
|
||||
case Port_poi:
|
||||
if (facilities.evm_args.activate) {
|
||||
evcsnm_check(its_msg);
|
||||
fwd = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case Port_poi:
|
||||
if (facilities.evm_args.activate) {
|
||||
evcsnm_check(its_msg);
|
||||
fwd = true;
|
||||
}
|
||||
break;
|
||||
case Port_evrsr:
|
||||
if (facilities.evm_args.activate) {
|
||||
evrsrm_check(its_msg);
|
||||
fwd = true;
|
||||
EV_RSR_t *evrsr_request = (EV_RSR_t *)its_msg;
|
||||
evrsrm_recv(evrsr_request);
|
||||
}
|
||||
break;
|
||||
|
||||
case Port_evrsr:
|
||||
if (facilities.evm_args.activate) {
|
||||
evrsrm_check(its_msg);
|
||||
fwd = true;
|
||||
EV_RSR_t *evrsr_request = (EV_RSR_t *)its_msg;
|
||||
evrsrm_recv(evrsr_request);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Forward to [applications]
|
||||
|
|
|
|||
Loading…
Reference in New Issue