Commit 238c743b authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Code cleanup/format for PFCP/UDP

parent 6937f31e
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -26,7 +26,6 @@
\email: lionel.gauthier@eurecom.fr
*/
#include "3gpp_29.244.hpp"
#include <string>
......@@ -34,954 +33,908 @@
using namespace pfcp;
//------------------------------------------------------------------------------
pfcp_ie * pfcp_ie::new_pfcp_ie_from_stream(std::istream& is) {
pfcp_ie* pfcp_ie::new_pfcp_ie_from_stream(std::istream& is) {
pfcp_tlv tlv;
tlv.load_from(is);
if (tlv.length) {
switch (tlv.type) {
case PFCP_IE_CREATE_PDR: {
pfcp_create_pdr_ie *ie = new pfcp_create_pdr_ie(tlv);
pfcp_create_pdr_ie* ie = new pfcp_create_pdr_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_PDI: {
pfcp_pdi_ie *ie = new pfcp_pdi_ie(tlv);
pfcp_pdi_ie* ie = new pfcp_pdi_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_CREATE_FAR: {
pfcp_create_far_ie *ie = new pfcp_create_far_ie(tlv);
pfcp_create_far_ie* ie = new pfcp_create_far_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_FORWARDING_PARAMETERS: {
pfcp_forwarding_parameters_ie *ie = new pfcp_forwarding_parameters_ie(tlv);
pfcp_forwarding_parameters_ie* ie =
new pfcp_forwarding_parameters_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_DUPLICATING_PARAMETERS: {
pfcp_duplicating_parameters_ie *ie = new pfcp_duplicating_parameters_ie(tlv);
pfcp_duplicating_parameters_ie* ie =
new pfcp_duplicating_parameters_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_CREATE_URR: {
pfcp_create_urr_ie *ie = new pfcp_create_urr_ie(tlv);
pfcp_create_urr_ie* ie = new pfcp_create_urr_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_CREATE_QER: {
pfcp_create_qer_ie *ie = new pfcp_create_qer_ie(tlv);
pfcp_create_qer_ie* ie = new pfcp_create_qer_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_CREATED_PDR: {
pfcp_created_pdr_ie *ie = new pfcp_created_pdr_ie(tlv);
pfcp_created_pdr_ie* ie = new pfcp_created_pdr_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_UPDATE_PDR: {
pfcp_update_pdr_ie *ie = new pfcp_update_pdr_ie(tlv);
pfcp_update_pdr_ie* ie = new pfcp_update_pdr_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_UPDATE_FAR: {
pfcp_update_far_ie *ie = new pfcp_update_far_ie(tlv);
pfcp_update_far_ie* ie = new pfcp_update_far_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_UPDATE_FORWARDING_PARAMETERS: {
pfcp_update_forwarding_parameters_ie *ie = new pfcp_update_forwarding_parameters_ie(tlv);
pfcp_update_forwarding_parameters_ie* ie =
new pfcp_update_forwarding_parameters_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_UPDATE_BAR_WITHIN_PFCP_SESSION_REPORT_RESPONSE: {
pfcp_update_bar_within_pfcp_session_report_response_ie *ie = new pfcp_update_bar_within_pfcp_session_report_response_ie(tlv);
pfcp_update_bar_within_pfcp_session_report_response_ie* ie =
new pfcp_update_bar_within_pfcp_session_report_response_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_UPDATE_URR: {
pfcp_update_urr_ie *ie = new pfcp_update_urr_ie(tlv);
pfcp_update_urr_ie* ie = new pfcp_update_urr_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_UPDATE_QER: {
pfcp_update_qer_ie *ie = new pfcp_update_qer_ie(tlv);
pfcp_update_qer_ie* ie = new pfcp_update_qer_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_REMOVE_PDR: {
pfcp_remove_pdr_ie *ie = new pfcp_remove_pdr_ie(tlv);
pfcp_remove_pdr_ie* ie = new pfcp_remove_pdr_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_REMOVE_FAR: {
pfcp_remove_far_ie *ie = new pfcp_remove_far_ie(tlv);
pfcp_remove_far_ie* ie = new pfcp_remove_far_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_REMOVE_URR: {
pfcp_remove_urr_ie *ie = new pfcp_remove_urr_ie(tlv);
pfcp_remove_urr_ie* ie = new pfcp_remove_urr_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_REMOVE_QER: {
pfcp_remove_qer_ie *ie = new pfcp_remove_qer_ie(tlv);
pfcp_remove_qer_ie* ie = new pfcp_remove_qer_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_CAUSE: {
pfcp_cause_ie *ie = new pfcp_cause_ie(tlv);
pfcp_cause_ie* ie = new pfcp_cause_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_SOURCE_INTERFACE: {
pfcp_source_interface_ie *ie = new pfcp_source_interface_ie(tlv);
pfcp_source_interface_ie* ie = new pfcp_source_interface_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_F_TEID: {
pfcp_fteid_ie *ie = new pfcp_fteid_ie(tlv);
pfcp_fteid_ie* ie = new pfcp_fteid_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_NETWORK_INSTANCE: {
pfcp_network_instance_ie *ie = new pfcp_network_instance_ie(tlv);
pfcp_network_instance_ie* ie = new pfcp_network_instance_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_SDF_FILTER: {
pfcp_sdf_filter_ie *ie = new pfcp_sdf_filter_ie(tlv);
pfcp_sdf_filter_ie* ie = new pfcp_sdf_filter_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_APPLICATION_ID: {
pfcp_application_id_ie *ie = new pfcp_application_id_ie(tlv);
pfcp_application_id_ie* ie = new pfcp_application_id_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_GATE_STATUS: {
pfcp_gate_status_ie *ie = new pfcp_gate_status_ie(tlv);
pfcp_gate_status_ie* ie = new pfcp_gate_status_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_MBR: {
pfcp_mbr_ie *ie = new pfcp_mbr_ie(tlv);
pfcp_mbr_ie* ie = new pfcp_mbr_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_GBR: {
pfcp_gbr_ie *ie = new pfcp_gbr_ie(tlv);
pfcp_gbr_ie* ie = new pfcp_gbr_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_QER_CORRELATION_ID: {
pfcp_qer_correlation_id_ie *ie = new pfcp_qer_correlation_id_ie(tlv);
pfcp_qer_correlation_id_ie* ie = new pfcp_qer_correlation_id_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_PRECEDENCE: {
pfcp_precedence_ie *ie = new pfcp_precedence_ie(tlv);
pfcp_precedence_ie* ie = new pfcp_precedence_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_TRANSPORT_LEVEL_MARKING: {
pfcp_transport_level_marking_ie *ie = new pfcp_transport_level_marking_ie(tlv);
pfcp_transport_level_marking_ie* ie =
new pfcp_transport_level_marking_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_VOLUME_THRESHOLD: {
pfcp_volume_threshold_ie *ie = new pfcp_volume_threshold_ie(tlv);
pfcp_volume_threshold_ie* ie = new pfcp_volume_threshold_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_TIME_THRESHOLD: {
pfcp_time_threshold_ie *ie = new pfcp_time_threshold_ie(tlv);
pfcp_time_threshold_ie* ie = new pfcp_time_threshold_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_MONITORING_TIME: {
pfcp_monitoring_time_ie *ie = new pfcp_monitoring_time_ie(tlv);
pfcp_monitoring_time_ie* ie = new pfcp_monitoring_time_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_SUBSEQUENT_VOLUME_THRESHOLD: {
pfcp_subsequent_volume_threshold_ie *ie = new pfcp_subsequent_volume_threshold_ie(tlv);
pfcp_subsequent_volume_threshold_ie* ie =
new pfcp_subsequent_volume_threshold_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_SUBSEQUENT_TIME_THRESHOLD: {
pfcp_subsequent_time_threshold_ie *ie = new pfcp_subsequent_time_threshold_ie(tlv);
pfcp_subsequent_time_threshold_ie* ie =
new pfcp_subsequent_time_threshold_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_INACTIVITY_DETECTION_TIME: {
pfcp_inactivity_detection_time_ie *ie = new pfcp_inactivity_detection_time_ie(tlv);
pfcp_inactivity_detection_time_ie* ie =
new pfcp_inactivity_detection_time_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_REPORTING_TRIGGERS: {
pfcp_reporting_triggers_ie *ie = new pfcp_reporting_triggers_ie(tlv);
pfcp_reporting_triggers_ie* ie = new pfcp_reporting_triggers_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_REDIRECT_INFORMATION: {
// pfcp_redirect_information_ie *ie = new pfcp_redirect_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
} break;
// case PFCP_IE_REDIRECT_INFORMATION: {
// pfcp_redirect_information_ie *ie = new
// pfcp_redirect_information_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
case PFCP_IE_REPORT_TYPE: {
pfcp_report_type_ie *ie = new pfcp_report_type_ie(tlv);
pfcp_report_type_ie* ie = new pfcp_report_type_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_OFFENDING_IE: {
pfcp_offending_ie_ie *ie = new pfcp_offending_ie_ie(tlv);
pfcp_offending_ie_ie* ie = new pfcp_offending_ie_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_FORWARDING_POLICY: {
pfcp_forwarding_policy_ie *ie = new pfcp_forwarding_policy_ie(tlv);
pfcp_forwarding_policy_ie* ie = new pfcp_forwarding_policy_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_DESTINATION_INTERFACE: {
pfcp_destination_interface_ie *ie = new pfcp_destination_interface_ie(tlv);
pfcp_destination_interface_ie* ie =
new pfcp_destination_interface_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_UP_FUNCTION_FEATURES: {
pfcp_up_function_features_ie *ie = new pfcp_up_function_features_ie(tlv);
pfcp_up_function_features_ie* ie =
new pfcp_up_function_features_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_APPLY_ACTION: {
pfcp_apply_action_ie *ie = new pfcp_apply_action_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_DOWNLINK_DATA_SERVICE_INFORMATION: {
// pfcp_downlink_data_service_information_ie *ie = new pfcp_downlink_data_service_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_DOWNLINK_DATA_NOTIFICATION_DELAY: {
// pfcp_downlink_data_notification_delay_ie *ie = new pfcp_downlink_data_notification_delay_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_DL_BUFFERING_DURATION: {
// pfcp_dl_buffering_duration_ie *ie = new pfcp_dl_buffering_duration_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_DL_BUFFERING_SUGGESTED_PACKET_COUNT: {
// pfcp_dl_buffering_suggested_packet_count_ie *ie = new pfcp_dl_buffering_suggested_packet_count_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_PFCPSMREQ_FLAGS: {
// pfcp_pfcpsmreq_flags_ie *ie = new pfcp_pfcpsmreq_flags_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_PFCPSRRSP_FLAGS: {
// pfcp_pfcpsrrsp_flags_ie *ie = new pfcp_pfcpsrrsp_flags_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_LOAD_CONTROL_INFORMATION: {
// pfcp_load_control_information_ie *ie = new pfcp_load_control_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_SEQUENCE_NUMBER: {
// pfcp_sequence_number_ie *ie = new pfcp_sequence_number_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_METRIC: {
// pfcp_metric_ie *ie = new pfcp_metric_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_OVERLOAD_CONTROL_INFORMATION: {
// pfcp_overload_control_information_ie *ie = new pfcp_overload_control_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_TIMER: {
// pfcp_timer_ie *ie = new pfcp_timer_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
pfcp_apply_action_ie* ie = new pfcp_apply_action_ie(tlv);
ie->load_from(is);
return ie;
} break;
// case PFCP_IE_DOWNLINK_DATA_SERVICE_INFORMATION: {
// pfcp_downlink_data_service_information_ie *ie = new
// pfcp_downlink_data_service_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_DOWNLINK_DATA_NOTIFICATION_DELAY: {
// pfcp_downlink_data_notification_delay_ie *ie = new
// pfcp_downlink_data_notification_delay_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_DL_BUFFERING_DURATION: {
// pfcp_dl_buffering_duration_ie *ie = new
// pfcp_dl_buffering_duration_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
// case PFCP_IE_DL_BUFFERING_SUGGESTED_PACKET_COUNT: {
// pfcp_dl_buffering_suggested_packet_count_ie *ie = new
// pfcp_dl_buffering_suggested_packet_count_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_PFCPSMREQ_FLAGS: {
// pfcp_pfcpsmreq_flags_ie *ie = new
// pfcp_pfcpsmreq_flags_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_PFCPSRRSP_FLAGS: {
// pfcp_pfcpsrrsp_flags_ie *ie = new
// pfcp_pfcpsrrsp_flags_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_LOAD_CONTROL_INFORMATION: {
// pfcp_load_control_information_ie *ie = new
// pfcp_load_control_information_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_SEQUENCE_NUMBER: {
// pfcp_sequence_number_ie *ie = new
// pfcp_sequence_number_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_METRIC: {
// pfcp_metric_ie *ie = new pfcp_metric_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_OVERLOAD_CONTROL_INFORMATION: {
// pfcp_overload_control_information_ie *ie = new
// pfcp_overload_control_information_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_TIMER: {
// pfcp_timer_ie *ie = new pfcp_timer_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
case PFCP_IE_PACKET_DETECTION_RULE_ID: {
pfcp_pdr_id_ie *ie = new pfcp_pdr_id_ie(tlv);
pfcp_pdr_id_ie* ie = new pfcp_pdr_id_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_F_SEID: {
pfcp_f_seid_ie *ie = new pfcp_f_seid_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_APPLICATION_IDS_PFDS: {
// pfcp_application_ids_pfds_ie *ie = new pfcp_application_ids_pfds_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_PFD: {
// pfcp_pfd_ie *ie = new pfcp_pfd_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
pfcp_f_seid_ie* ie = new pfcp_f_seid_ie(tlv);
ie->load_from(is);
return ie;
} break;
// case PFCP_IE_APPLICATION_IDS_PFDS: {
// pfcp_application_ids_pfds_ie *ie = new
// pfcp_application_ids_pfds_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
// case PFCP_IE_PFD: {
// pfcp_pfd_ie *ie = new pfcp_pfd_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
case PFCP_IE_NODE_ID: {
pfcp_node_id_ie *ie = new pfcp_node_id_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_PFD_CONTENTS: {
// pfcp_pfd_contents_ie *ie = new pfcp_pfd_contents_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_MEASUREMENT_METHOD: {
// pfcp_measurement_method_ie *ie = new pfcp_measurement_method_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_USAGE_REPORT_TRIGGER: {
// pfcp_usage_report_trigger_ie *ie = new pfcp_usage_report_trigger_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_MEASUREMENT_PERIOD: {
// pfcp_measurement_period_ie *ie = new pfcp_measurement_period_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_FQ_CSID: {
// pfcp_fq_csid_ie *ie = new pfcp_fq_csid_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_VOLUME_MEASUREMENT: {
// pfcp_volume_measurement_ie *ie = new pfcp_volume_measurement_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_DURATION_MEASUREMENT: {
// pfcp_duration_measurement_ie *ie = new pfcp_duration_measurement_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_APPLICATION_DETECTION_INFORMATION: {
// pfcp_application_detection_information_ie *ie = new pfcp_application_detection_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_TIME_OF_FIRST_PACKET: {
// pfcp_time_of_first_packet_ie *ie = new pfcp_time_of_first_packet_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_TIME_OF_LAST_PACKET: {
// pfcp_time_of_last_packet_ie *ie = new pfcp_time_of_last_packet_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_QUOTA_HOLDING_TIME: {
// pfcp_quota_holding_time_ie *ie = new pfcp_quota_holding_time_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_DROPPED_DL_TRAFFIC_THRESHOLD: {
// pfcp_dropped_dl_traffic_threshold_ie *ie = new pfcp_dropped_dl_traffic_threshold_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_VOLUME_QUOTA: {
// pfcp_volume_quota_ie *ie = new pfcp_volume_quota_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_TIME_QUOTA: {
// pfcp_time_quota_ie *ie = new pfcp_time_quota_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_START_TIME: {
// pfcp_start_time_ie *ie = new pfcp_start_time_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_END_TIME: {
// pfcp_end_time_ie *ie = new pfcp_end_time_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_QUERY_URR: {
// pfcp_query_urr_ie *ie = new pfcp_query_urr_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_USAGE_REPORT_WITHIN_SESSION_MODIFICATION_RESPONSE: {
// pfcp_usage_report_within_session_modification_response_ie *ie = new pfcp_usage_report_within_session_modification_response_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_USAGE_REPORT_WITHIN_SESSION_DELETION_RESPONSE: {
// pfcp_usage_report_within_session_deletion_response_ie *ie = new pfcp_usage_report_within_session_deletion_response_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_USAGE_REPORT_WITHIN_SESSION_REPORT_REQUEST: {
// pfcp_usage_report_within_session_report_request_ie *ie = new pfcp_usage_report_within_session_report_request_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
pfcp_node_id_ie* ie = new pfcp_node_id_ie(tlv);
ie->load_from(is);
return ie;
} break;
// case PFCP_IE_PFD_CONTENTS: {
// pfcp_pfd_contents_ie *ie = new pfcp_pfd_contents_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_MEASUREMENT_METHOD: {
// pfcp_measurement_method_ie *ie = new
// pfcp_measurement_method_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_USAGE_REPORT_TRIGGER: {
// pfcp_usage_report_trigger_ie *ie = new
// pfcp_usage_report_trigger_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
// case PFCP_IE_MEASUREMENT_PERIOD: {
// pfcp_measurement_period_ie *ie = new
// pfcp_measurement_period_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_FQ_CSID: {
// pfcp_fq_csid_ie *ie = new pfcp_fq_csid_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_VOLUME_MEASUREMENT: {
// pfcp_volume_measurement_ie *ie = new
// pfcp_volume_measurement_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_DURATION_MEASUREMENT: {
// pfcp_duration_measurement_ie *ie = new
// pfcp_duration_measurement_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
// case PFCP_IE_APPLICATION_DETECTION_INFORMATION: {
// pfcp_application_detection_information_ie *ie = new
// pfcp_application_detection_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_TIME_OF_FIRST_PACKET: {
// pfcp_time_of_first_packet_ie *ie = new
// pfcp_time_of_first_packet_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
// case PFCP_IE_TIME_OF_LAST_PACKET: {
// pfcp_time_of_last_packet_ie *ie = new
// pfcp_time_of_last_packet_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
// case PFCP_IE_QUOTA_HOLDING_TIME: {
// pfcp_quota_holding_time_ie *ie = new
// pfcp_quota_holding_time_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_DROPPED_DL_TRAFFIC_THRESHOLD: {
// pfcp_dropped_dl_traffic_threshold_ie *ie = new
// pfcp_dropped_dl_traffic_threshold_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_VOLUME_QUOTA: {
// pfcp_volume_quota_ie *ie = new pfcp_volume_quota_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_TIME_QUOTA: {
// pfcp_time_quota_ie *ie = new pfcp_time_quota_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_START_TIME: {
// pfcp_start_time_ie *ie = new pfcp_start_time_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_END_TIME: {
// pfcp_end_time_ie *ie = new pfcp_end_time_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_QUERY_URR: {
// pfcp_query_urr_ie *ie = new pfcp_query_urr_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_USAGE_REPORT_WITHIN_SESSION_MODIFICATION_RESPONSE: {
// pfcp_usage_report_within_session_modification_response_ie *ie
// = new
// pfcp_usage_report_within_session_modification_response_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_USAGE_REPORT_WITHIN_SESSION_DELETION_RESPONSE: {
// pfcp_usage_report_within_session_deletion_response_ie *ie =
// new
// pfcp_usage_report_within_session_deletion_response_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_USAGE_REPORT_WITHIN_SESSION_REPORT_REQUEST: {
// pfcp_usage_report_within_session_report_request_ie *ie = new
// pfcp_usage_report_within_session_report_request_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
case PFCP_IE_URR_ID: {
pfcp_urr_id_ie *ie = new pfcp_urr_id_ie(tlv);
pfcp_urr_id_ie* ie = new pfcp_urr_id_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_LINKED_URR_ID: {
// pfcp_linked_urr_id_ie *ie = new pfcp_linked_urr_id_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
} break;
// case PFCP_IE_LINKED_URR_ID: {
// pfcp_linked_urr_id_ie *ie = new pfcp_linked_urr_id_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
case PFCP_IE_DOWNLINK_DATA_REPORT: {
pfcp_downlink_data_report_ie *ie = new pfcp_downlink_data_report_ie(tlv);
pfcp_downlink_data_report_ie* ie =
new pfcp_downlink_data_report_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_OUTER_HEADER_CREATION: {
pfcp_outer_header_creation_ie *ie = new pfcp_outer_header_creation_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_CREATE_BAR: {
// pfcp_create_bar_ie *ie = new pfcp_create_bar_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_UPDATE_BAR_WITHIN_PFCP_SESSION_MODIFICATION_REQUEST: {
// pfcp_update_bar_within_session_modification_request_ie *ie = new pfcp_update_bar_within_session_modification_request_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_REMOVE_BAR: {
// pfcp_remove_bar_ie *ie = new pfcp_remove_bar_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
pfcp_outer_header_creation_ie* ie =
new pfcp_outer_header_creation_ie(tlv);
ie->load_from(is);
return ie;
} break;
// case PFCP_IE_CREATE_BAR: {
// pfcp_create_bar_ie *ie = new pfcp_create_bar_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_UPDATE_BAR_WITHIN_PFCP_SESSION_MODIFICATION_REQUEST:
// {
// pfcp_update_bar_within_session_modification_request_ie *ie =
// new
// pfcp_update_bar_within_session_modification_request_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_REMOVE_BAR: {
// pfcp_remove_bar_ie *ie = new pfcp_remove_bar_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
case PFCP_IE_BAR_ID: {
pfcp_bar_id_ie *ie = new pfcp_bar_id_ie(tlv);
pfcp_bar_id_ie* ie = new pfcp_bar_id_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_CP_FUNCTION_FEATURES: {
pfcp_cp_function_features_ie *ie = new pfcp_cp_function_features_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_USAGE_INFORMATION: {
// pfcp_usage_information_ie *ie = new pfcp_usage_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_APPLICATION_INSTANCE_ID: {
// pfcp_application_instance_id_ie *ie = new pfcp_application_instance_id_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_FLOW_INFORMATION: {
// pfcp_flow_information_ie *ie = new pfcp_flow_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
pfcp_cp_function_features_ie* ie =
new pfcp_cp_function_features_ie(tlv);
ie->load_from(is);
return ie;
} break;
// case PFCP_IE_USAGE_INFORMATION: {
// pfcp_usage_information_ie *ie = new
// pfcp_usage_information_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_APPLICATION_INSTANCE_ID: {
// pfcp_application_instance_id_ie *ie = new
// pfcp_application_instance_id_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_FLOW_INFORMATION: {
// pfcp_flow_information_ie *ie = new
// pfcp_flow_information_ie(tlv); ie->load_from(is); return ie;
// }
// break;
case PFCP_IE_UE_IP_ADDRESS: {
pfcp_ue_ip_address_ie *ie = new pfcp_ue_ip_address_ie(tlv);
pfcp_ue_ip_address_ie* ie = new pfcp_ue_ip_address_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_PACKET_RATE: {
// pfcp_packet_rate_ie *ie = new pfcp_packet_rate_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
} break;
// case PFCP_IE_PACKET_RATE: {
// pfcp_packet_rate_ie *ie = new pfcp_packet_rate_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
case PFCP_IE_OUTER_HEADER_REMOVAL: {
pfcp_outer_header_removal_ie *ie = new pfcp_outer_header_removal_ie(tlv);
pfcp_outer_header_removal_ie* ie =
new pfcp_outer_header_removal_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_RECOVERY_TIME_STAMP: {
pfcp_recovery_time_stamp_ie *ie = new pfcp_recovery_time_stamp_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_DL_FLOW_LEVEL_MARKING: {
// pfcp_dl_flow_level_marking_ie *ie = new pfcp_dl_flow_level_marking_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_HEADER_ENRICHMENT: {
// pfcp_header_enrichment_ie *ie = new pfcp_header_enrichment_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_ERROR_INDICATION_REPORT: {
// pfcp_error_indication_report_ie *ie = new pfcp_error_indication_report_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_MEASUREMENT_INFORMATION: {
// pfcp_measurement_information_ie *ie = new pfcp_measurement_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_NODE_REPORT_TYPE: {
// pfcp_node_report_type_ie *ie = new pfcp_node_report_type_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_USER_PLANE_PATH_FAILURE_REPORT: {
// pfcp_user_plane_path_failure_report_ie *ie = new pfcp_user_plane_path_failure_report_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_REMOTE_GTP_U_PEER: {
// pfcp_remote_gtp_u_peer_ie *ie = new pfcp_remote_gtp_u_peer_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_UR_SEQN: {
// pfcp_ur_seqn_ie *ie = new pfcp_ur_seqn_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_UPDATE_DUPLICATING_PARAMETERS: {
// pfcp_update_duplicating_parameters_ie *ie = new pfcp_update_duplicating_parameters_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
pfcp_recovery_time_stamp_ie* ie = new pfcp_recovery_time_stamp_ie(tlv);
ie->load_from(is);
return ie;
} break;
// case PFCP_IE_DL_FLOW_LEVEL_MARKING: {
// pfcp_dl_flow_level_marking_ie *ie = new
// pfcp_dl_flow_level_marking_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
// case PFCP_IE_HEADER_ENRICHMENT: {
// pfcp_header_enrichment_ie *ie = new
// pfcp_header_enrichment_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_ERROR_INDICATION_REPORT: {
// pfcp_error_indication_report_ie *ie = new
// pfcp_error_indication_report_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_MEASUREMENT_INFORMATION: {
// pfcp_measurement_information_ie *ie = new
// pfcp_measurement_information_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_NODE_REPORT_TYPE: {
// pfcp_node_report_type_ie *ie = new
// pfcp_node_report_type_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_USER_PLANE_PATH_FAILURE_REPORT: {
// pfcp_user_plane_path_failure_report_ie *ie = new
// pfcp_user_plane_path_failure_report_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_REMOTE_GTP_U_PEER: {
// pfcp_remote_gtp_u_peer_ie *ie = new
// pfcp_remote_gtp_u_peer_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_UR_SEQN: {
// pfcp_ur_seqn_ie *ie = new pfcp_ur_seqn_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_UPDATE_DUPLICATING_PARAMETERS: {
// pfcp_update_duplicating_parameters_ie *ie = new
// pfcp_update_duplicating_parameters_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
case PFCP_IE_ACTIVATE_PREDEFINED_RULES: {
pfcp_activate_predefined_rules_ie *ie = new pfcp_activate_predefined_rules_ie(tlv);
pfcp_activate_predefined_rules_ie* ie =
new pfcp_activate_predefined_rules_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_DEACTIVATE_PREDEFINED_RULES: {
pfcp_deactivate_predefined_rules_ie *ie = new pfcp_deactivate_predefined_rules_ie(tlv);
pfcp_deactivate_predefined_rules_ie* ie =
new pfcp_deactivate_predefined_rules_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_FAR_ID: {
pfcp_far_id_ie *ie = new pfcp_far_id_ie(tlv);
pfcp_far_id_ie* ie = new pfcp_far_id_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_QER_ID: {
pfcp_qer_id_ie *ie = new pfcp_qer_id_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_OCI_FLAGS: {
// pfcp_oci_flags_ie *ie = new pfcp_oci_flags_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_PFCP_ASSOCIATION_RELEASE_REQUEST: {
// pfcp_pfcp_association_release_request_ie *ie = new pfcp_pfcp_association_release_request_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_GRACEFUL_RELEASE_PERIOD: {
// pfcp_graceful_release_period_ie *ie = new pfcp_graceful_release_period_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_PDN_TYPE: {
// pfcp_pdn_type_ie *ie = new pfcp_pdn_type_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
pfcp_qer_id_ie* ie = new pfcp_qer_id_ie(tlv);
ie->load_from(is);
return ie;
} break;
// case PFCP_IE_OCI_FLAGS: {
// pfcp_oci_flags_ie *ie = new pfcp_oci_flags_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_PFCP_ASSOCIATION_RELEASE_REQUEST: {
// pfcp_pfcp_association_release_request_ie *ie = new
// pfcp_pfcp_association_release_request_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_GRACEFUL_RELEASE_PERIOD: {
// pfcp_graceful_release_period_ie *ie = new
// pfcp_graceful_release_period_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_PDN_TYPE: {
// pfcp_pdn_type_ie *ie = new pfcp_pdn_type_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
case PFCP_IE_FAILED_RULE_ID: {
pfcp_failed_rule_id_ie *ie = new pfcp_failed_rule_id_ie(tlv);
pfcp_failed_rule_id_ie* ie = new pfcp_failed_rule_id_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_TIME_QUOTA_MECHANISM: {
// pfcp_time_quota_mechanism_ie *ie = new pfcp_time_quota_mechanism_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
} break;
// case PFCP_IE_TIME_QUOTA_MECHANISM: {
// pfcp_time_quota_mechanism_ie *ie = new
// pfcp_time_quota_mechanism_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
case PFCP_IE_USER_PLANE_IP_RESOURCE_INFORMATION: {
pfcp_user_plane_ip_resource_information_ie *ie = new pfcp_user_plane_ip_resource_information_ie(tlv);
pfcp_user_plane_ip_resource_information_ie* ie =
new pfcp_user_plane_ip_resource_information_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
case PFCP_IE_USER_PLANE_INACTIVITY_TIMER: {
pfcp_user_plane_inactivity_timer_ie *ie = new pfcp_user_plane_inactivity_timer_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_AGGREGATED_URRS: {
// pfcp_aggregated_urrs_ie *ie = new pfcp_aggregated_urrs_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_MULTIPLIER: {
// pfcp_multiplier_ie *ie = new pfcp_multiplier_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_AGGREGATED_URR_ID: {
// pfcp_aggregated_urr_id_ie *ie = new pfcp_aggregated_urr_id_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_SUBSEQUENT_VOLUME_QUOTA: {
// pfcp_subsequent_volume_quota_ie *ie = new pfcp_subsequent_volume_quota_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_SUBSEQUENT_TIME_QUOTA: {
// pfcp_subsequent_time_quota_ie *ie = new pfcp_subsequent_time_quota_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_RQI: {
// pfcp_rqi_ie *ie = new pfcp_rqi_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
pfcp_user_plane_inactivity_timer_ie* ie =
new pfcp_user_plane_inactivity_timer_ie(tlv);
ie->load_from(is);
return ie;
} break;
// case PFCP_IE_AGGREGATED_URRS: {
// pfcp_aggregated_urrs_ie *ie = new
// pfcp_aggregated_urrs_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_MULTIPLIER: {
// pfcp_multiplier_ie *ie = new pfcp_multiplier_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_AGGREGATED_URR_ID: {
// pfcp_aggregated_urr_id_ie *ie = new
// pfcp_aggregated_urr_id_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_SUBSEQUENT_VOLUME_QUOTA: {
// pfcp_subsequent_volume_quota_ie *ie = new
// pfcp_subsequent_volume_quota_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_SUBSEQUENT_TIME_QUOTA: {
// pfcp_subsequent_time_quota_ie *ie = new
// pfcp_subsequent_time_quota_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
// case PFCP_IE_RQI: {
// pfcp_rqi_ie *ie = new pfcp_rqi_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
case PFCP_IE_QFI: {
pfcp_qfi_ie *ie = new pfcp_qfi_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_QUERY_URR_REFERENCE: {
// pfcp_query_urr_reference_ie *ie = new pfcp_query_urr_reference_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_ADDITIONAL_USAGE_REPORTS_INFORMATION: {
// pfcp_additional_usage_reports_information_ie *ie = new pfcp_additional_usage_reports_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_CREATE_TRAFFIC_ENDPOINT: {
// pfcp_create_traffic_endpoint_ie *ie = new pfcp_create_traffic_endpoint_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_CREATED_TRAFFIC_ENDPOINT: {
// pfcp_created_traffic_endpoint_ie *ie = new pfcp_created_traffic_endpoint_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_UPDATE_TRAFFIC_ENDPOINT: {
// pfcp_update_traffic_endpoint_ie *ie = new pfcp_update_traffic_endpoint_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_REMOVE_TRAFFIC_ENDPOINT: {
// pfcp_remove_traffic_endpoint_ie *ie = new pfcp_remove_traffic_endpoint_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_TRAFFIC_ENDPOINT_ID: {
// pfcp_traffic_endpoint_id_ie *ie = new pfcp_traffic_endpoint_id_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_ETHERNET_PACKET_FILTER: {
// pfcp_ethernet_packet_filter_ie *ie = new pfcp_ethernet_packet_filter_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_MAC_ADDRESS: {
// pfcp_mac_address_ie *ie = new pfcp_mac_address_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_C_TAG: {
// pfcp_c_tag_ie *ie = new pfcp_c_tag_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_S_TAG: {
// pfcp_s_tag_ie *ie = new pfcp_s_tag_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_ETHERTYPE: {
// pfcp_ethertype_ie *ie = new pfcp_ethertype_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_PROXYING: {
// pfcp_proxying_ie *ie = new pfcp_proxying_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_ETHERNET_FILTER_ID: {
// pfcp_ethernet_filter_id_ie *ie = new pfcp_ethernet_filter_id_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_ETHERNET_FILTER_PROPERTIES: {
// pfcp_ethernet_filter_properties_ie *ie = new pfcp_ethernet_filter_properties_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_SUGGESTED_BUFFERING_PACKETS_COUNT: {
// pfcp_suggested_buffering_packets_count_ie *ie = new pfcp_suggested_buffering_packets_count_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
pfcp_qfi_ie* ie = new pfcp_qfi_ie(tlv);
ie->load_from(is);
return ie;
} break;
// case PFCP_IE_QUERY_URR_REFERENCE: {
// pfcp_query_urr_reference_ie *ie = new
// pfcp_query_urr_reference_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
// case PFCP_IE_ADDITIONAL_USAGE_REPORTS_INFORMATION: {
// pfcp_additional_usage_reports_information_ie *ie = new
// pfcp_additional_usage_reports_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_CREATE_TRAFFIC_ENDPOINT: {
// pfcp_create_traffic_endpoint_ie *ie = new
// pfcp_create_traffic_endpoint_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_CREATED_TRAFFIC_ENDPOINT: {
// pfcp_created_traffic_endpoint_ie *ie = new
// pfcp_created_traffic_endpoint_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_UPDATE_TRAFFIC_ENDPOINT: {
// pfcp_update_traffic_endpoint_ie *ie = new
// pfcp_update_traffic_endpoint_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_REMOVE_TRAFFIC_ENDPOINT: {
// pfcp_remove_traffic_endpoint_ie *ie = new
// pfcp_remove_traffic_endpoint_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_TRAFFIC_ENDPOINT_ID: {
// pfcp_traffic_endpoint_id_ie *ie = new
// pfcp_traffic_endpoint_id_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
// case PFCP_IE_ETHERNET_PACKET_FILTER: {
// pfcp_ethernet_packet_filter_ie *ie = new
// pfcp_ethernet_packet_filter_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
// case PFCP_IE_MAC_ADDRESS: {
// pfcp_mac_address_ie *ie = new pfcp_mac_address_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_C_TAG: {
// pfcp_c_tag_ie *ie = new pfcp_c_tag_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_S_TAG: {
// pfcp_s_tag_ie *ie = new pfcp_s_tag_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_ETHERTYPE: {
// pfcp_ethertype_ie *ie = new pfcp_ethertype_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_PROXYING: {
// pfcp_proxying_ie *ie = new pfcp_proxying_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_ETHERNET_FILTER_ID: {
// pfcp_ethernet_filter_id_ie *ie = new
// pfcp_ethernet_filter_id_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_ETHERNET_FILTER_PROPERTIES: {
// pfcp_ethernet_filter_properties_ie *ie = new
// pfcp_ethernet_filter_properties_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_SUGGESTED_BUFFERING_PACKETS_COUNT: {
// pfcp_suggested_buffering_packets_count_ie *ie = new
// pfcp_suggested_buffering_packets_count_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
case PFCP_IE_USER_ID: {
pfcp_user_id_ie *ie = new pfcp_user_id_ie(tlv);
ie->load_from(is);
return ie;
}
break;
// case PFCP_IE_ETHERNET_PDU_SESSION_INFORMATION: {
// pfcp_ethernet_pdu_session_information_ie *ie = new pfcp_ethernet_pdu_session_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_ETHERNET_TRAFFIC_INFORMATION: {
// pfcp_ethernet_traffic_information_ie *ie = new pfcp_ethernet_traffic_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_MAC_ADDRESSES_DETECTED: {
// pfcp_mac_addresses_detected_ie *ie = new pfcp_mac_addresses_detected_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_MAC_ADDRESSES_REMOVED: {
// pfcp_mac_addresses_removed_ie *ie = new pfcp_mac_addresses_removed_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_ETHERNET_INACTIVITY_TIMER: {
// pfcp_ethernet_inactivity_timer_ie *ie = new pfcp_ethernet_inactivity_timer_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_ADDITIONAL_MONITORING_TIME: {
// pfcp_additional_monitoring_time_ie *ie = new pfcp_additional_monitoring_time_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_EVENT_INFORMATION: {
// pfcp_event_information_ie *ie = new pfcp_event_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_EVENT_REPORTING: {
// pfcp_event_reporting_ie *ie = new pfcp_event_reporting_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_EVENT_ID: {
// pfcp_event_id_ie *ie = new pfcp_event_id_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_EVENT_THRESHOLD: {
// pfcp_event_threshold_ie *ie = new pfcp_event_threshold_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_TRACE_INFORMATION: {
// pfcp_trace_information_ie *ie = new pfcp_trace_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_FRAMED_ROUTE: {
// pfcp_framed_route_ie *ie = new pfcp_framed_route_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_FRAMED_ROUTING: {
// pfcp_framed_routing_ie *ie = new pfcp_framed_routing_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_FRAMED_IPV6_ROUTE: {
// pfcp_framed_ipv6_route_ie *ie = new pfcp_framed_ipv6_route_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
pfcp_user_id_ie* ie = new pfcp_user_id_ie(tlv);
ie->load_from(is);
return ie;
} break;
// case PFCP_IE_ETHERNET_PDU_SESSION_INFORMATION: {
// pfcp_ethernet_pdu_session_information_ie *ie = new
// pfcp_ethernet_pdu_session_information_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_ETHERNET_TRAFFIC_INFORMATION: {
// pfcp_ethernet_traffic_information_ie *ie = new
// pfcp_ethernet_traffic_information_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_MAC_ADDRESSES_DETECTED: {
// pfcp_mac_addresses_detected_ie *ie = new
// pfcp_mac_addresses_detected_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
// case PFCP_IE_MAC_ADDRESSES_REMOVED: {
// pfcp_mac_addresses_removed_ie *ie = new
// pfcp_mac_addresses_removed_ie(tlv); ie->load_from(is); return
// ie;
// }
// break;
// case PFCP_IE_ETHERNET_INACTIVITY_TIMER: {
// pfcp_ethernet_inactivity_timer_ie *ie = new
// pfcp_ethernet_inactivity_timer_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_ADDITIONAL_MONITORING_TIME: {
// pfcp_additional_monitoring_time_ie *ie = new
// pfcp_additional_monitoring_time_ie(tlv); ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_EVENT_INFORMATION: {
// pfcp_event_information_ie *ie = new
// pfcp_event_information_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_EVENT_REPORTING: {
// pfcp_event_reporting_ie *ie = new
// pfcp_event_reporting_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_EVENT_ID: {
// pfcp_event_id_ie *ie = new pfcp_event_id_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_EVENT_THRESHOLD: {
// pfcp_event_threshold_ie *ie = new
// pfcp_event_threshold_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_TRACE_INFORMATION: {
// pfcp_trace_information_ie *ie = new
// pfcp_trace_information_ie(tlv); ie->load_from(is); return ie;
// }
// break;
// case PFCP_IE_FRAMED_ROUTE: {
// pfcp_framed_route_ie *ie = new pfcp_framed_route_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_FRAMED_ROUTING: {
// pfcp_framed_routing_ie *ie = new pfcp_framed_routing_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
// case PFCP_IE_FRAMED_IPV6_ROUTE: {
// pfcp_framed_ipv6_route_ie *ie = new
// pfcp_framed_ipv6_route_ie(tlv); ie->load_from(is); return ie;
// }
// break;
case PFCP_IE_3GPP_INTERFACE_TYPE: {
pfcp_3gpp_interface_type_ie *ie = new pfcp_3gpp_interface_type_ie(tlv);
pfcp_3gpp_interface_type_ie* ie = new pfcp_3gpp_interface_type_ie(tlv);
ie->load_from(is);
return ie;
}
break;
} break;
default:
Logger::pfcp().error("Unknown PFCP IE type %d (length %d)", tlv.get_type(), tlv.get_length());
Logger::pfcp().error(
"Unknown PFCP IE type %d (length %d)", tlv.get_type(),
tlv.get_length());
return nullptr;
}
} else {
Logger::pfcp().error("PFCP IE type %d length %d", tlv.get_type(), tlv.get_length());
Logger::pfcp().error(
"PFCP IE type %d length %d", tlv.get_type(), tlv.get_length());
return nullptr;
}
}
......@@ -989,74 +942,162 @@ pfcp_ie * pfcp_ie::new_pfcp_ie_from_stream(std::istream& is) {
pfcp_msg::pfcp_msg(const pfcp_heartbeat_request& pfcp_ies) : pfcp_msg_header() {
ies = {};
set_message_type(PFCP_HEARTBEAT_REQUEST);
if (pfcp_ies.recovery_time_stamp.first) {std::shared_ptr<pfcp_recovery_time_stamp_ie> sie(new pfcp_recovery_time_stamp_ie(pfcp_ies.recovery_time_stamp.second)); add_ie(sie);}
if (pfcp_ies.recovery_time_stamp.first) {
std::shared_ptr<pfcp_recovery_time_stamp_ie> sie(
new pfcp_recovery_time_stamp_ie(pfcp_ies.recovery_time_stamp.second));
add_ie(sie);
}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_heartbeat_response& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_heartbeat_response& pfcp_ies)
: pfcp_msg_header() {
ies = {};
set_message_type(PFCP_HEARTBEAT_RESPONSE);
if (pfcp_ies.recovery_time_stamp.first) {std::shared_ptr<pfcp_recovery_time_stamp_ie> sie(new pfcp_recovery_time_stamp_ie(pfcp_ies.recovery_time_stamp.second)); add_ie(sie);}
if (pfcp_ies.recovery_time_stamp.first) {
std::shared_ptr<pfcp_recovery_time_stamp_ie> sie(
new pfcp_recovery_time_stamp_ie(pfcp_ies.recovery_time_stamp.second));
add_ie(sie);
}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_association_setup_request& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_association_setup_request& pfcp_ies)
: pfcp_msg_header() {
ies = {};
set_message_type(PFCP_ASSOCIATION_SETUP_REQUEST);
if (pfcp_ies.node_id.first) {std::shared_ptr<pfcp_node_id_ie> sie(new pfcp_node_id_ie(pfcp_ies.node_id.second)); add_ie(sie);}
if (pfcp_ies.recovery_time_stamp.first) {std::shared_ptr<pfcp_recovery_time_stamp_ie> sie(new pfcp_recovery_time_stamp_ie(pfcp_ies.recovery_time_stamp.second)); add_ie(sie);}
if (pfcp_ies.up_function_features.first) {std::shared_ptr<pfcp_up_function_features_ie> sie(new pfcp_up_function_features_ie(pfcp_ies.up_function_features.second)); add_ie(sie);}
if (pfcp_ies.cp_function_features.first) {std::shared_ptr<pfcp_cp_function_features_ie> sie(new pfcp_cp_function_features_ie(pfcp_ies.cp_function_features.second)); add_ie(sie);}
if (pfcp_ies.user_plane_ip_resource_information.first) {std::shared_ptr<pfcp_user_plane_ip_resource_information_ie> sie(new
pfcp_user_plane_ip_resource_information_ie(pfcp_ies.user_plane_ip_resource_information.second)); add_ie(sie);}
if (pfcp_ies.node_id.first) {
std::shared_ptr<pfcp_node_id_ie> sie(
new pfcp_node_id_ie(pfcp_ies.node_id.second));
add_ie(sie);
}
if (pfcp_ies.recovery_time_stamp.first) {
std::shared_ptr<pfcp_recovery_time_stamp_ie> sie(
new pfcp_recovery_time_stamp_ie(pfcp_ies.recovery_time_stamp.second));
add_ie(sie);
}
if (pfcp_ies.up_function_features.first) {
std::shared_ptr<pfcp_up_function_features_ie> sie(
new pfcp_up_function_features_ie(pfcp_ies.up_function_features.second));
add_ie(sie);
}
if (pfcp_ies.cp_function_features.first) {
std::shared_ptr<pfcp_cp_function_features_ie> sie(
new pfcp_cp_function_features_ie(pfcp_ies.cp_function_features.second));
add_ie(sie);
}
if (pfcp_ies.user_plane_ip_resource_information.first) {
std::shared_ptr<pfcp_user_plane_ip_resource_information_ie> sie(
new pfcp_user_plane_ip_resource_information_ie(
pfcp_ies.user_plane_ip_resource_information.second));
add_ie(sie);
}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_association_setup_response& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_association_setup_response& pfcp_ies)
: pfcp_msg_header() {
ies = {};
set_message_type(PFCP_ASSOCIATION_SETUP_RESPONSE);
if (pfcp_ies.node_id.first) {std::shared_ptr<pfcp_node_id_ie> sie(new pfcp_node_id_ie(pfcp_ies.node_id.second)); add_ie(sie);}
if (pfcp_ies.cause.first) {std::shared_ptr<pfcp_cause_ie> sie(new pfcp_cause_ie(pfcp_ies.cause.second)); add_ie(sie);}
if (pfcp_ies.recovery_time_stamp.first) {std::shared_ptr<pfcp_recovery_time_stamp_ie> sie(new pfcp_recovery_time_stamp_ie(pfcp_ies.recovery_time_stamp.second)); add_ie(sie);}
if (pfcp_ies.up_function_features.first) {std::shared_ptr<pfcp_up_function_features_ie> sie(new pfcp_up_function_features_ie(pfcp_ies.up_function_features.second)); add_ie(sie);}
if (pfcp_ies.cp_function_features.first) {std::shared_ptr<pfcp_cp_function_features_ie> sie(new pfcp_cp_function_features_ie(pfcp_ies.cp_function_features.second)); add_ie(sie);}
if (pfcp_ies.user_plane_ip_resource_information.first) {std::shared_ptr<pfcp_user_plane_ip_resource_information_ie> sie(new
pfcp_user_plane_ip_resource_information_ie(pfcp_ies.user_plane_ip_resource_information.second)); add_ie(sie);}
if (pfcp_ies.node_id.first) {
std::shared_ptr<pfcp_node_id_ie> sie(
new pfcp_node_id_ie(pfcp_ies.node_id.second));
add_ie(sie);
}
if (pfcp_ies.cause.first) {
std::shared_ptr<pfcp_cause_ie> sie(
new pfcp_cause_ie(pfcp_ies.cause.second));
add_ie(sie);
}
if (pfcp_ies.recovery_time_stamp.first) {
std::shared_ptr<pfcp_recovery_time_stamp_ie> sie(
new pfcp_recovery_time_stamp_ie(pfcp_ies.recovery_time_stamp.second));
add_ie(sie);
}
if (pfcp_ies.up_function_features.first) {
std::shared_ptr<pfcp_up_function_features_ie> sie(
new pfcp_up_function_features_ie(pfcp_ies.up_function_features.second));
add_ie(sie);
}
if (pfcp_ies.cp_function_features.first) {
std::shared_ptr<pfcp_cp_function_features_ie> sie(
new pfcp_cp_function_features_ie(pfcp_ies.cp_function_features.second));
add_ie(sie);
}
if (pfcp_ies.user_plane_ip_resource_information.first) {
std::shared_ptr<pfcp_user_plane_ip_resource_information_ie> sie(
new pfcp_user_plane_ip_resource_information_ie(
pfcp_ies.user_plane_ip_resource_information.second));
add_ie(sie);
}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_association_release_request& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_association_release_request& pfcp_ies)
: pfcp_msg_header() {
ies = {};
set_message_type(PFCP_ASSOCIATION_RELEASE_REQUEST);
if (pfcp_ies.node_id.first) {std::shared_ptr<pfcp_node_id_ie> sie(new pfcp_node_id_ie(pfcp_ies.node_id.second)); add_ie(sie);}
if (pfcp_ies.node_id.first) {
std::shared_ptr<pfcp_node_id_ie> sie(
new pfcp_node_id_ie(pfcp_ies.node_id.second));
add_ie(sie);
}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_association_release_response& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_association_release_response& pfcp_ies)
: pfcp_msg_header() {
ies = {};
set_message_type(PFCP_ASSOCIATION_RELEASE_RESPONSE);
if (pfcp_ies.node_id.first) {std::shared_ptr<pfcp_node_id_ie> sie(new pfcp_node_id_ie(pfcp_ies.node_id.second)); add_ie(sie);}
if (pfcp_ies.cause.first) {std::shared_ptr<pfcp_cause_ie> sie(new pfcp_cause_ie(pfcp_ies.cause.second)); add_ie(sie);}
if (pfcp_ies.node_id.first) {
std::shared_ptr<pfcp_node_id_ie> sie(
new pfcp_node_id_ie(pfcp_ies.node_id.second));
add_ie(sie);
}
if (pfcp_ies.cause.first) {
std::shared_ptr<pfcp_cause_ie> sie(
new pfcp_cause_ie(pfcp_ies.cause.second));
add_ie(sie);
}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_node_report_request& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_node_report_request& pfcp_ies)
: pfcp_msg_header() {
ies = {};
set_message_type(PFCP_NODE_REPORT_REQUEST);
std::pair<bool, pfcp::node_id_t> node_id;
std::pair<bool, pfcp::node_report_type_t> node_report_type;
// TODO LATER std::pair<bool, pfcp::user_plane_path_failure_report> user_plane_path_failure_report;
// TODO LATER std::pair<bool, pfcp::user_plane_path_failure_report>
// user_plane_path_failure_report;
if (pfcp_ies.node_id.first) {std::shared_ptr<pfcp_node_id_ie> sie(new pfcp_node_id_ie(pfcp_ies.node_id.second)); add_ie(sie);}
if (pfcp_ies.node_report_type.first) {std::shared_ptr<pfcp_node_report_type_ie> sie(new pfcp_node_report_type_ie(pfcp_ies.node_report_type.second)); add_ie(sie);}
if (pfcp_ies.node_id.first) {
std::shared_ptr<pfcp_node_id_ie> sie(
new pfcp_node_id_ie(pfcp_ies.node_id.second));
add_ie(sie);
}
if (pfcp_ies.node_report_type.first) {
std::shared_ptr<pfcp_node_report_type_ie> sie(
new pfcp_node_report_type_ie(pfcp_ies.node_report_type.second));
add_ie(sie);
}
// TODO LATER if (pfcp_ies.user_plane_path_failure_report.first) {
// std::shared_ptr<pfcp_user_plane_path_failure_report_ie>
// sie(new pfcp_user_plane_path_failure_report_ie(pfcp_ies.user_plane_path_failure_report.second));
// sie(new
// pfcp_user_plane_path_failure_report_ie(pfcp_ies.user_plane_path_failure_report.second));
// add_ie(sie);
//}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_session_establishment_request& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_session_establishment_request& pfcp_ies)
: pfcp_msg_header() {
ies = {};
set_message_type(PFCP_SESSION_ESTABLISHMENT_REQUEST);
if (pfcp_ies.node_id.first) {std::shared_ptr<pfcp_node_id_ie> sie(new pfcp_node_id_ie(pfcp_ies.node_id.second)); add_ie(sie);}
if (pfcp_ies.cp_fseid.first) {std::shared_ptr<pfcp_f_seid_ie> sie(new pfcp_f_seid_ie(pfcp_ies.cp_fseid.second)); add_ie(sie);}
if (pfcp_ies.node_id.first) {
std::shared_ptr<pfcp_node_id_ie> sie(
new pfcp_node_id_ie(pfcp_ies.node_id.second));
add_ie(sie);
}
if (pfcp_ies.cp_fseid.first) {
std::shared_ptr<pfcp_f_seid_ie> sie(
new pfcp_f_seid_ie(pfcp_ies.cp_fseid.second));
add_ie(sie);
}
for (auto it : pfcp_ies.create_pdrs) {
std::shared_ptr<pfcp_create_pdr_ie> sie(new pfcp_create_pdr_ie(it));
add_ie(sie);
......@@ -1073,44 +1114,97 @@ pfcp_msg::pfcp_msg(const pfcp_session_establishment_request& pfcp_ies) : pfcp_ms
std::shared_ptr<pfcp_create_qer_ie> sie(new pfcp_create_qer_ie(it));
add_ie(sie);
}
// if (pfcp_ies.create_bar.first) {std::shared_ptr<pfcp_create_bar_ie> sie(new pfcp_create_bar_ie(pfcp_ies.create_bar.second)); add_ie(sie);}
if (pfcp_ies.create_traffic_endpoint.first) {std::shared_ptr<pfcp_create_traffic_endpoint_ie> sie(new pfcp_create_traffic_endpoint_ie(pfcp_ies.create_traffic_endpoint.second)); add_ie(sie);}
// if (pfcp_ies.pdn_type.first) {std::shared_ptr<pfcp_pdn_type_ie> sie(new pfcp_pdn_type_ie(pfcp_ies.pdn_type.second)); add_ie(sie);}
// if (pfcp_ies.sgw_c_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new pfcp_fq_csid_ie(pfcp_ies.sgw_c_fq_csid.second)); add_ie(sie);}
// if (pfcp_ies.mme_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new pfcp_fq_csid_ie(pfcp_ies.mme_fq_csid.second)); add_ie(sie);}
// if (pfcp_ies.pgw_c_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new pfcp_fq_csid_ie(pfcp_ies.pgw_c_fq_csid.second)); add_ie(sie);}
// if (pfcp_ies.epdg_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new pfcp_fq_csid_ie(pfcp_ies.epdg_fq_csid.second)); add_ie(sie);}
// if (pfcp_ies.twan_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new pfcp_fq_csid_ie(pfcp_ies.twan_fq_csid.second)); add_ie(sie);}
if (pfcp_ies.user_plane_inactivity_timer.first) {std::shared_ptr<pfcp_user_plane_inactivity_timer_ie> sie(new pfcp_user_plane_inactivity_timer_ie(pfcp_ies.user_plane_inactivity_timer.second)); add_ie(sie);}
if (pfcp_ies.user_id.first) {std::shared_ptr<pfcp_user_id_ie> sie(new pfcp_user_id_ie(pfcp_ies.user_id.second)); add_ie(sie);}
// if (pfcp_ies.trace_information.first) {std::shared_ptr<pfcp_trace_information_ie> sie(new pfcp_trace_information_ie(pfcp_ies.trace_information.second)); add_ie(sie);}
// if (pfcp_ies.create_bar.first) {std::shared_ptr<pfcp_create_bar_ie>
// sie(new pfcp_create_bar_ie(pfcp_ies.create_bar.second)); add_ie(sie);}
if (pfcp_ies.create_traffic_endpoint.first) {
std::shared_ptr<pfcp_create_traffic_endpoint_ie> sie(
new pfcp_create_traffic_endpoint_ie(
pfcp_ies.create_traffic_endpoint.second));
add_ie(sie);
}
// if (pfcp_ies.pdn_type.first) {std::shared_ptr<pfcp_pdn_type_ie> sie(new
// pfcp_pdn_type_ie(pfcp_ies.pdn_type.second)); add_ie(sie);} if
// (pfcp_ies.sgw_c_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new
// pfcp_fq_csid_ie(pfcp_ies.sgw_c_fq_csid.second)); add_ie(sie);} if
// (pfcp_ies.mme_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new
// pfcp_fq_csid_ie(pfcp_ies.mme_fq_csid.second)); add_ie(sie);} if
// (pfcp_ies.pgw_c_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new
// pfcp_fq_csid_ie(pfcp_ies.pgw_c_fq_csid.second)); add_ie(sie);} if
// (pfcp_ies.epdg_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new
// pfcp_fq_csid_ie(pfcp_ies.epdg_fq_csid.second)); add_ie(sie);} if
// (pfcp_ies.twan_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new
// pfcp_fq_csid_ie(pfcp_ies.twan_fq_csid.second)); add_ie(sie);}
if (pfcp_ies.user_plane_inactivity_timer.first) {
std::shared_ptr<pfcp_user_plane_inactivity_timer_ie> sie(
new pfcp_user_plane_inactivity_timer_ie(
pfcp_ies.user_plane_inactivity_timer.second));
add_ie(sie);
}
if (pfcp_ies.user_id.first) {
std::shared_ptr<pfcp_user_id_ie> sie(
new pfcp_user_id_ie(pfcp_ies.user_id.second));
add_ie(sie);
}
// if (pfcp_ies.trace_information.first)
// {std::shared_ptr<pfcp_trace_information_ie> sie(new
// pfcp_trace_information_ie(pfcp_ies.trace_information.second));
// add_ie(sie);}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_session_establishment_response& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_session_establishment_response& pfcp_ies)
: pfcp_msg_header() {
ies = {};
set_message_type(PFCP_SESSION_ESTABLISHMENT_RESPONSE);
if (pfcp_ies.node_id.first) {std::shared_ptr<pfcp_node_id_ie> sie(new pfcp_node_id_ie(pfcp_ies.node_id.second)); add_ie(sie);}
if (pfcp_ies.cause.first) {std::shared_ptr<pfcp_cause_ie> sie(new pfcp_cause_ie(pfcp_ies.cause.second)); add_ie(sie);}
if (pfcp_ies.offending_ie.first) {std::shared_ptr<pfcp_offending_ie_ie> sie(new pfcp_offending_ie_ie(pfcp_ies.offending_ie.second)); add_ie(sie);}
if (pfcp_ies.up_fseid.first) {std::shared_ptr<pfcp_f_seid_ie> sie(new pfcp_f_seid_ie(pfcp_ies.up_fseid.second)); add_ie(sie);}
if (pfcp_ies.node_id.first) {
std::shared_ptr<pfcp_node_id_ie> sie(
new pfcp_node_id_ie(pfcp_ies.node_id.second));
add_ie(sie);
}
if (pfcp_ies.cause.first) {
std::shared_ptr<pfcp_cause_ie> sie(
new pfcp_cause_ie(pfcp_ies.cause.second));
add_ie(sie);
}
if (pfcp_ies.offending_ie.first) {
std::shared_ptr<pfcp_offending_ie_ie> sie(
new pfcp_offending_ie_ie(pfcp_ies.offending_ie.second));
add_ie(sie);
}
if (pfcp_ies.up_fseid.first) {
std::shared_ptr<pfcp_f_seid_ie> sie(
new pfcp_f_seid_ie(pfcp_ies.up_fseid.second));
add_ie(sie);
}
for (auto it : pfcp_ies.created_pdrs) {
std::shared_ptr<pfcp_created_pdr_ie> sie(new pfcp_created_pdr_ie(it));
add_ie(sie);
}
// std::pair<bool, pfcp::load_control_information> load_control_information;
// std::pair<bool, pfcp::overload_control_information> overload_control_information;
// if (pfcp_ies.sgw_u_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new pfcp_fq_csid_ie(pfcp_ies.sgw_u_fq_csid.second)); add_ie(sie);}
// if (pfcp_ies.pgw_u_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new pfcp_fq_csid_ie(pfcp_ies.pgw_u_fq_csid.second)); add_ie(sie);}
if (pfcp_ies.failed_rule_id.first) {std::shared_ptr<pfcp_failed_rule_id_ie> sie(new pfcp_failed_rule_id_ie(pfcp_ies.failed_rule_id.second)); add_ie(sie);}
// std::pair<bool, pfcp::overload_control_information>
// overload_control_information; if (pfcp_ies.sgw_u_fq_csid.first)
// {std::shared_ptr<pfcp_fq_csid_ie> sie(new
// pfcp_fq_csid_ie(pfcp_ies.sgw_u_fq_csid.second)); add_ie(sie);} if
// (pfcp_ies.pgw_u_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new
// pfcp_fq_csid_ie(pfcp_ies.pgw_u_fq_csid.second)); add_ie(sie);}
if (pfcp_ies.failed_rule_id.first) {
std::shared_ptr<pfcp_failed_rule_id_ie> sie(
new pfcp_failed_rule_id_ie(pfcp_ies.failed_rule_id.second));
add_ie(sie);
}
// std::pair<bool, pfcp::created_traffic_endpoint> created_traffic_endpoint;
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_session_modification_request& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_session_modification_request& pfcp_ies)
: pfcp_msg_header() {
ies = {};
set_message_type(PFCP_SESSION_MODIFICATION_REQUEST);
if (pfcp_ies.cp_fseid.first) {std::shared_ptr<pfcp_f_seid_ie> sie(new pfcp_f_seid_ie(pfcp_ies.cp_fseid.second)); add_ie(sie);}
if (pfcp_ies.cp_fseid.first) {
std::shared_ptr<pfcp_f_seid_ie> sie(
new pfcp_f_seid_ie(pfcp_ies.cp_fseid.second));
add_ie(sie);
}
for (auto it : pfcp_ies.remove_pdrs) {
std::shared_ptr<pfcp_remove_pdr_ie> sie(new pfcp_remove_pdr_ie(it));
add_ie(sie);
......@@ -1127,8 +1221,12 @@ pfcp_msg::pfcp_msg(const pfcp_session_modification_request& pfcp_ies) : pfcp_msg
std::shared_ptr<pfcp_remove_qer_ie> sie(new pfcp_remove_qer_ie(it));
add_ie(sie);
}
//if (pfcp_ies.remove_bar.first) {std::shared_ptr<pfcp_remove_bar_ie> sie(new pfcp_remove_bar_ie(pfcp_ies.remove_bar.second)); add_ie(sie);}
//if (pfcp_ies.remove_traffic_endpoint.first) {std::shared_ptr<pfcp_remove_traffic_endpoint_ie> sie(new pfcp_remove_traffic_endpoint_ie(pfcp_ies.remove_traffic_endpoint.second)); add_ie(sie);}
// if (pfcp_ies.remove_bar.first) {std::shared_ptr<pfcp_remove_bar_ie> sie(new
// pfcp_remove_bar_ie(pfcp_ies.remove_bar.second)); add_ie(sie);} if
// (pfcp_ies.remove_traffic_endpoint.first)
// {std::shared_ptr<pfcp_remove_traffic_endpoint_ie> sie(new
// pfcp_remove_traffic_endpoint_ie(pfcp_ies.remove_traffic_endpoint.second));
// add_ie(sie);}
for (auto it : pfcp_ies.create_pdrs) {
std::shared_ptr<pfcp_create_pdr_ie> sie(new pfcp_create_pdr_ie(it));
add_ie(sie);
......@@ -1145,8 +1243,14 @@ pfcp_msg::pfcp_msg(const pfcp_session_modification_request& pfcp_ies) : pfcp_msg
std::shared_ptr<pfcp_create_qer_ie> sie(new pfcp_create_qer_ie(it));
add_ie(sie);
}
//if (pfcp_ies.create_bar.first) {std::shared_ptr<pfcp_create_bar_ie> sie(new pfcp_create_bar_ie(pfcp_ies.create_bar.second)); add_ie(sie);}
if (pfcp_ies.create_traffic_endpoint.first) {std::shared_ptr<pfcp_create_traffic_endpoint_ie> sie(new pfcp_create_traffic_endpoint_ie(pfcp_ies.create_traffic_endpoint.second)); add_ie(sie);}
// if (pfcp_ies.create_bar.first) {std::shared_ptr<pfcp_create_bar_ie> sie(new
// pfcp_create_bar_ie(pfcp_ies.create_bar.second)); add_ie(sie);}
if (pfcp_ies.create_traffic_endpoint.first) {
std::shared_ptr<pfcp_create_traffic_endpoint_ie> sie(
new pfcp_create_traffic_endpoint_ie(
pfcp_ies.create_traffic_endpoint.second));
add_ie(sie);
}
for (auto it : pfcp_ies.update_pdrs) {
std::shared_ptr<pfcp_update_pdr_ie> sie(new pfcp_update_pdr_ie(it));
add_ie(sie);
......@@ -1163,76 +1267,170 @@ pfcp_msg::pfcp_msg(const pfcp_session_modification_request& pfcp_ies) : pfcp_msg
std::shared_ptr<pfcp_update_qer_ie> sie(new pfcp_update_qer_ie(it));
add_ie(sie);
}
// if (pfcp_ies.update_bar.first) {std::shared_ptr<pfcp_update_bar_ie> sie(new pfcp_update_bar_ie(pfcp_ies.update_bar.second)); add_ie(sie);}
// if (pfcp_ies.update_traffic_endpoint.first) {std::shared_ptr<pfcp_update_traffic_endpoint_ie> sie(new pfcp_update_traffic_endpoint_ie(pfcp_ies.update_traffic_endpoint.second)); add_ie(sie);}
// if (pfcp_ies.pfcpsmreq_flags.first) {std::shared_ptr<pfcp_pfcpsmreq_flags_ie> sie(new pfcp_pfcpsmreq_flags_ie(pfcp_ies.pfcp_pfcpsmreq_flags.second)); add_ie(sie);}
// if (pfcp_ies.query_urr.first) {std::shared_ptr<pfcp_query_urr_ie> sie(new pfcp_query_urr_ie(pfcp_ies.query_urr.second)); add_ie(sie);}
// if (pfcp_ies.pgw_c_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new pfcp_fq_csid_ie(pfcp_ies.pgw_c_fq_csid.second)); add_ie(sie);}
// if (pfcp_ies.sgw_c_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new pfcp_fq_csid_ie(pfcp_ies.sgw_c_fq_csid.second)); add_ie(sie);}
// if (pfcp_ies.mme_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new pfcp_fq_csid_ie(pfcp_ies.mme_fq_csid.second)); add_ie(sie);}
// if (pfcp_ies.epdg_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new pfcp_fq_csid_ie(pfcp_ies.epdg_fq_csid.second)); add_ie(sie);}
// if (pfcp_ies.twan_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new pfcp_fq_csid_ie(pfcp_ies.twan_fq_csid.second)); add_ie(sie);}
if (pfcp_ies.user_plane_inactivity_timer.first) {std::shared_ptr<pfcp_user_plane_inactivity_timer_ie> sie(new pfcp_user_plane_inactivity_timer_ie(pfcp_ies.user_plane_inactivity_timer.second)); add_ie(sie);}
// if (pfcp_ies.user_id.first) {std::shared_ptr<pfcp_user_id_ie> sie(new pfcp_user_id_ie(pfcp_ies.user_id.second)); add_ie(sie);}
// if (pfcp_ies.query_urr_reference.first) {std::shared_ptr<pfcp_query_urr_reference_ie> sie(new pfcp_query_urr_reference_ie(pfcp_ies.query_urr_reference.second)); add_ie(sie);}
// if (pfcp_ies.trace_information.first) {std::shared_ptr<pfcp_trace_information_ie> sie(new pfcp_trace_information_ie(pfcp_ies.trace_information.second)); add_ie(sie);}
// if (pfcp_ies.update_bar.first) {std::shared_ptr<pfcp_update_bar_ie>
// sie(new pfcp_update_bar_ie(pfcp_ies.update_bar.second)); add_ie(sie);} if
// (pfcp_ies.update_traffic_endpoint.first)
// {std::shared_ptr<pfcp_update_traffic_endpoint_ie> sie(new
// pfcp_update_traffic_endpoint_ie(pfcp_ies.update_traffic_endpoint.second));
// add_ie(sie);} if (pfcp_ies.pfcpsmreq_flags.first)
// {std::shared_ptr<pfcp_pfcpsmreq_flags_ie> sie(new
// pfcp_pfcpsmreq_flags_ie(pfcp_ies.pfcp_pfcpsmreq_flags.second));
// add_ie(sie);} if (pfcp_ies.query_urr.first)
// {std::shared_ptr<pfcp_query_urr_ie> sie(new
// pfcp_query_urr_ie(pfcp_ies.query_urr.second)); add_ie(sie);} if
// (pfcp_ies.pgw_c_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new
// pfcp_fq_csid_ie(pfcp_ies.pgw_c_fq_csid.second)); add_ie(sie);} if
// (pfcp_ies.sgw_c_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new
// pfcp_fq_csid_ie(pfcp_ies.sgw_c_fq_csid.second)); add_ie(sie);} if
// (pfcp_ies.mme_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new
// pfcp_fq_csid_ie(pfcp_ies.mme_fq_csid.second)); add_ie(sie);} if
// (pfcp_ies.epdg_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new
// pfcp_fq_csid_ie(pfcp_ies.epdg_fq_csid.second)); add_ie(sie);} if
// (pfcp_ies.twan_fq_csid.first) {std::shared_ptr<pfcp_fq_csid_ie> sie(new
// pfcp_fq_csid_ie(pfcp_ies.twan_fq_csid.second)); add_ie(sie);}
if (pfcp_ies.user_plane_inactivity_timer.first) {
std::shared_ptr<pfcp_user_plane_inactivity_timer_ie> sie(
new pfcp_user_plane_inactivity_timer_ie(
pfcp_ies.user_plane_inactivity_timer.second));
add_ie(sie);
}
// if (pfcp_ies.user_id.first) {std::shared_ptr<pfcp_user_id_ie> sie(new
// pfcp_user_id_ie(pfcp_ies.user_id.second)); add_ie(sie);} if
// (pfcp_ies.query_urr_reference.first)
// {std::shared_ptr<pfcp_query_urr_reference_ie> sie(new
// pfcp_query_urr_reference_ie(pfcp_ies.query_urr_reference.second));
// add_ie(sie);} if (pfcp_ies.trace_information.first)
// {std::shared_ptr<pfcp_trace_information_ie> sie(new
// pfcp_trace_information_ie(pfcp_ies.trace_information.second));
// add_ie(sie);}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_session_modification_response& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_session_modification_response& pfcp_ies)
: pfcp_msg_header() {
ies = {};
set_message_type(PFCP_SESSION_MODIFICATION_RESPONSE);
if (pfcp_ies.cause.first) {std::shared_ptr<pfcp_cause_ie> sie(new pfcp_cause_ie(pfcp_ies.cause.second)); add_ie(sie);}
if (pfcp_ies.offending_ie.first) {std::shared_ptr<pfcp_offending_ie_ie> sie(new pfcp_offending_ie_ie(pfcp_ies.offending_ie.second)); add_ie(sie);}
if (pfcp_ies.cause.first) {
std::shared_ptr<pfcp_cause_ie> sie(
new pfcp_cause_ie(pfcp_ies.cause.second));
add_ie(sie);
}
if (pfcp_ies.offending_ie.first) {
std::shared_ptr<pfcp_offending_ie_ie> sie(
new pfcp_offending_ie_ie(pfcp_ies.offending_ie.second));
add_ie(sie);
}
for (auto it : pfcp_ies.created_pdrs) {
std::shared_ptr<pfcp_created_pdr_ie> sie(new pfcp_created_pdr_ie(it));
add_ie(sie);
}
//if (pfcp_ies.load_control_information.first) {std::shared_ptr<pfcp_load_control_information_ie> sie(new pfcp_load_control_information_ie(pfcp_ies.load_control_information.second)); add_ie(sie);}
//if (pfcp_ies.overload_control_information.first) {std::shared_ptr<pfcp_overload_control_information_ie> sie(new pfcp_overload_control_information_ie(pfcp_ies.overload_control_information.second)); add_ie(sie);}
//if (pfcp_ies.usage_report.first) {std::shared_ptr<pfcp_usage_report_within_pfcp_session_modification_response_ie> sie(new pfcp_usage_report_within_pfcp_session_modification_response_ie(pfcp_ies.usage_report.second)); add_ie(sie);}
if (pfcp_ies.failed_rule_id.first) {std::shared_ptr<pfcp_failed_rule_id_ie> sie(new pfcp_failed_rule_id_ie(pfcp_ies.failed_rule_id.second)); add_ie(sie);}
//if (pfcp_ies.additional_usage_reports_information.first) {std::shared_ptr<pfcp_additional_usage_reports_information_ie> sie(new pfcp_additional_usage_reports_information_ie(pfcp_ies.additional_usage_reports_information.second)); add_ie(sie);}
//if (pfcp_ies.created_traffic_endpoint.first) {std::shared_ptr<pfcp_created_traffic_endpoint_ie> sie(new pfcp_created_traffic_endpoint_ie(pfcp_ies.created_traffic_endpoint.second)); add_ie(sie);}
// if (pfcp_ies.load_control_information.first)
// {std::shared_ptr<pfcp_load_control_information_ie> sie(new
// pfcp_load_control_information_ie(pfcp_ies.load_control_information.second));
// add_ie(sie);} if (pfcp_ies.overload_control_information.first)
// {std::shared_ptr<pfcp_overload_control_information_ie> sie(new
// pfcp_overload_control_information_ie(pfcp_ies.overload_control_information.second));
// add_ie(sie);} if (pfcp_ies.usage_report.first)
// {std::shared_ptr<pfcp_usage_report_within_pfcp_session_modification_response_ie>
// sie(new
// pfcp_usage_report_within_pfcp_session_modification_response_ie(pfcp_ies.usage_report.second));
// add_ie(sie);}
if (pfcp_ies.failed_rule_id.first) {
std::shared_ptr<pfcp_failed_rule_id_ie> sie(
new pfcp_failed_rule_id_ie(pfcp_ies.failed_rule_id.second));
add_ie(sie);
}
// if (pfcp_ies.additional_usage_reports_information.first)
// {std::shared_ptr<pfcp_additional_usage_reports_information_ie> sie(new
// pfcp_additional_usage_reports_information_ie(pfcp_ies.additional_usage_reports_information.second));
// add_ie(sie);} if (pfcp_ies.created_traffic_endpoint.first)
// {std::shared_ptr<pfcp_created_traffic_endpoint_ie> sie(new
// pfcp_created_traffic_endpoint_ie(pfcp_ies.created_traffic_endpoint.second));
// add_ie(sie);}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_session_deletion_request& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_session_deletion_request& pfcp_ies)
: pfcp_msg_header() {
ies = {};
remote_port = 0;
set_message_type(PFCP_SESSION_DELETION_REQUEST);
// NO IEs !
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_session_deletion_response& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_session_deletion_response& pfcp_ies)
: pfcp_msg_header() {
ies = {};
set_message_type(PFCP_SESSION_DELETION_RESPONSE);
if (pfcp_ies.cause.first) {std::shared_ptr<pfcp_cause_ie> sie(new pfcp_cause_ie(pfcp_ies.cause.second)); add_ie(sie);}
if (pfcp_ies.offending_ie.first) {std::shared_ptr<pfcp_offending_ie_ie> sie(new pfcp_offending_ie_ie(pfcp_ies.offending_ie.second)); add_ie(sie);}
//if (pfcp_ies.load_control_information.first) {std::shared_ptr<pfcp_load_control_information_ie> sie(new pfcp_load_control_information_ie(pfcp_ies.load_control_information.second)); add_ie(sie);}
//if (pfcp_ies.overload_control_information.first) {std::shared_ptr<pfcp_overload_control_information_ie> sie(new pfcp_overload_control_information_ie(pfcp_ies.overload_control_information.second)); add_ie(sie);}
//if (pfcp_ies.usage_report_information.first) {std::shared_ptr<pfcp_usage_report_within_session_deletion_response_ie> sie(new pfcp_usage_report_within_session_deletion_response_ie(pfcp_ies.additional_usage_reports_information.second)); add_ie(sie);}
if (pfcp_ies.cause.first) {
std::shared_ptr<pfcp_cause_ie> sie(
new pfcp_cause_ie(pfcp_ies.cause.second));
add_ie(sie);
}
if (pfcp_ies.offending_ie.first) {
std::shared_ptr<pfcp_offending_ie_ie> sie(
new pfcp_offending_ie_ie(pfcp_ies.offending_ie.second));
add_ie(sie);
}
// if (pfcp_ies.load_control_information.first)
// {std::shared_ptr<pfcp_load_control_information_ie> sie(new
// pfcp_load_control_information_ie(pfcp_ies.load_control_information.second));
// add_ie(sie);} if (pfcp_ies.overload_control_information.first)
// {std::shared_ptr<pfcp_overload_control_information_ie> sie(new
// pfcp_overload_control_information_ie(pfcp_ies.overload_control_information.second));
// add_ie(sie);} if (pfcp_ies.usage_report_information.first)
// {std::shared_ptr<pfcp_usage_report_within_session_deletion_response_ie>
// sie(new
// pfcp_usage_report_within_session_deletion_response_ie(pfcp_ies.additional_usage_reports_information.second));
// add_ie(sie);}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_session_report_request& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_session_report_request& pfcp_ies)
: pfcp_msg_header() {
ies = {};
set_message_type(PFCP_SESSION_REPORT_REQUEST);
if (pfcp_ies.report_type.first) {std::shared_ptr<pfcp_report_type_ie> sie(new pfcp_report_type_ie(pfcp_ies.report_type.second)); add_ie(sie);}
if (pfcp_ies.downlink_data_report.first) {std::shared_ptr<pfcp_downlink_data_report_ie> sie(new pfcp_downlink_data_report_ie(pfcp_ies.downlink_data_report.second)); add_ie(sie);}
//TODO std::pair<bool, pfcp::usage_report_within_pfcp_session_report_request> usage_report;
//TODO std::pair<bool, pfcp::error_indication_report> error_indication_report;
//TODO std::pair<bool, pfcp::load_control_information> load_control_information;
//TODO std::pair<bool, pfcp::overload_control_information> overload_control_information;
//TODO std::pair<bool, pfcp::additional_usage_reports_information_t> additional_usage_reports_information;
if (pfcp_ies.report_type.first) {
std::shared_ptr<pfcp_report_type_ie> sie(
new pfcp_report_type_ie(pfcp_ies.report_type.second));
add_ie(sie);
}
if (pfcp_ies.downlink_data_report.first) {
std::shared_ptr<pfcp_downlink_data_report_ie> sie(
new pfcp_downlink_data_report_ie(pfcp_ies.downlink_data_report.second));
add_ie(sie);
}
// TODO std::pair<bool, pfcp::usage_report_within_pfcp_session_report_request>
// usage_report;
// TODO std::pair<bool, pfcp::error_indication_report>
// error_indication_report;
// TODO std::pair<bool, pfcp::load_control_information>
// load_control_information;
// TODO std::pair<bool, pfcp::overload_control_information>
// overload_control_information;
// TODO std::pair<bool, pfcp::additional_usage_reports_information_t>
// additional_usage_reports_information;
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_session_report_response& pfcp_ies) : pfcp_msg_header() {
pfcp_msg::pfcp_msg(const pfcp_session_report_response& pfcp_ies)
: pfcp_msg_header() {
ies = {};
set_message_type(PFCP_SESSION_REPORT_RESPONSE);
if (pfcp_ies.cause.first) {std::shared_ptr<pfcp_cause_ie> sie(new pfcp_cause_ie(pfcp_ies.cause.second)); add_ie(sie);}
if (pfcp_ies.offending_ie.first) {std::shared_ptr<pfcp_offending_ie_ie> sie(new pfcp_offending_ie_ie(pfcp_ies.offending_ie.second)); add_ie(sie);}
// TODO if (pfcp_ies.update_bar.first) {std::shared_ptr<pfcp_update_bar_within_pfcp_session_report_response_ie> sie(new pfcp_update_bar_within_pfcp_session_report_response_ie(pfcp_ies.update_bar.second)); add_ie(sie);}
if (pfcp_ies.cause.first) {
std::shared_ptr<pfcp_cause_ie> sie(
new pfcp_cause_ie(pfcp_ies.cause.second));
add_ie(sie);
}
if (pfcp_ies.offending_ie.first) {
std::shared_ptr<pfcp_offending_ie_ie> sie(
new pfcp_offending_ie_ie(pfcp_ies.offending_ie.second));
add_ie(sie);
}
// TODO if (pfcp_ies.update_bar.first)
// {std::shared_ptr<pfcp_update_bar_within_pfcp_session_report_response_ie>
// sie(new
// pfcp_update_bar_within_pfcp_session_report_response_ie(pfcp_ies.update_bar.second));
// add_ie(sie);}
// TODO SPEC std::pair<bool, pfcp::sxsrrsp_flags_t> sxsrrsp_flags;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -33,13 +33,16 @@
using namespace pfcp;
using namespace std;
extern itti_mw *itti_inst;
extern itti_mw* itti_inst;
//------------------------------------------------------------------------------
pfcp_l4_stack::pfcp_l4_stack(const string& ip_address, const unsigned short port_num, const util::thread_sched_params& sched_params) :
udp_s_8805(ip_address.c_str(), port_num),
udp_s_allocated(ip_address.c_str(), 0){
Logger::pfcp().info( "pfcp_l4_stack created listening to %s:%d", ip_address.c_str(), port_num);
pfcp_l4_stack::pfcp_l4_stack(
const string& ip_address, const unsigned short port_num,
const util::thread_sched_params& sched_params)
: udp_s_8805(ip_address.c_str(), port_num),
udp_s_allocated(ip_address.c_str(), 0) {
Logger::pfcp().info(
"pfcp_l4_stack created listening to %s:%d", ip_address.c_str(), port_num);
trxn_id2seq_num = {};
proc_cleanup_timers = {};
msg_out_retry_timers = {};
......@@ -63,13 +66,13 @@ uint32_t pfcp_l4_stack::get_next_seq_num() {
return seq_num;
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::handle_receive(char* recv_buffer, const std::size_t bytes_transferred, endpoint& remote_endpoint)
{
Logger::pfcp().error( "TODO implement in derived class");
void pfcp_l4_stack::handle_receive(
char* recv_buffer, const std::size_t bytes_transferred,
endpoint& remote_endpoint) {
Logger::pfcp().error("TODO implement in derived class");
}
//------------------------------------------------------------------------------
bool pfcp_l4_stack::check_request_type(const uint8_t initial)
{
bool pfcp_l4_stack::check_request_type(const uint8_t initial) {
switch (initial) {
case PFCP_HEARTBEAT_REQUEST:
case PFCP_PFCP_PFD_MANAGEMENT_REQUEST:
......@@ -90,9 +93,10 @@ bool pfcp_l4_stack::check_request_type(const uint8_t initial)
}
}
//------------------------------------------------------------------------------
bool pfcp_l4_stack::check_response_type(const uint8_t initial, const uint8_t triggered)
{
//Logger::pfcp().info( "check_response_type PFCP msg type %d/%d", (int)initial, (int)triggered);
bool pfcp_l4_stack::check_response_type(
const uint8_t initial, const uint8_t triggered) {
// Logger::pfcp().info( "check_response_type PFCP msg type %d/%d",
// (int)initial, (int)triggered);
switch (initial) {
case PFCP_HEARTBEAT_REQUEST:
case PFCP_PFCP_PFD_MANAGEMENT_REQUEST:
......@@ -104,93 +108,112 @@ bool pfcp_l4_stack::check_response_type(const uint8_t initial, const uint8_t tri
case PFCP_SESSION_MODIFICATION_REQUEST:
case PFCP_SESSION_DELETION_REQUEST:
case PFCP_SESSION_REPORT_REQUEST:
if (triggered == (initial+1)) return true;
if (triggered == (initial + 1)) return true;
break;
default:
if (triggered == PFCP_VERSION_NOT_SUPPORTED_RESPONSE) return true;
}
return false;
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::start_msg_retry_timer(pfcp_procedure& p, uint32_t time_out_milli_seconds, const task_id_t& task_id, const uint32_t& seq_num)
{
p.retry_timer_id = itti_inst->timer_setup (time_out_milli_seconds/1000, time_out_milli_seconds%1000, task_id);
msg_out_retry_timers.insert(std::pair<timer_id_t, uint32_t>(p.retry_timer_id, seq_num));
//Logger::pfcp().trace( "Started Msg retry timer %d, proc %" PRId64", seq %d",p.retry_timer_id, p.trxn_id, seq_num);
void pfcp_l4_stack::start_msg_retry_timer(
pfcp_procedure& p, uint32_t time_out_milli_seconds,
const task_id_t& task_id, const uint32_t& seq_num) {
p.retry_timer_id = itti_inst->timer_setup(
time_out_milli_seconds / 1000, time_out_milli_seconds % 1000, task_id);
msg_out_retry_timers.insert(
std::pair<timer_id_t, uint32_t>(p.retry_timer_id, seq_num));
// Logger::pfcp().trace( "Started Msg retry timer %d, proc %" PRId64", seq
// %d",p.retry_timer_id, p.trxn_id, seq_num);
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::stop_msg_retry_timer(pfcp_procedure& p)
{
void pfcp_l4_stack::stop_msg_retry_timer(pfcp_procedure& p) {
if (p.retry_timer_id) {
itti_inst->timer_remove(p.retry_timer_id);
msg_out_retry_timers.erase(p.retry_timer_id);
//Logger::pfcp().trace( "Stopped Msg retry timer %d, proc %" PRId64", seq %d",p.retry_timer_id, p.trxn_id, p.retry_msg->get_sequence_number());
// Logger::pfcp().trace( "Stopped Msg retry timer %d, proc %" PRId64", seq
// %d",p.retry_timer_id, p.trxn_id, p.retry_msg->get_sequence_number());
p.retry_timer_id = 0;
}
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::stop_msg_retry_timer(timer_id_t& t)
{
void pfcp_l4_stack::stop_msg_retry_timer(timer_id_t& t) {
itti_inst->timer_remove(t);
msg_out_retry_timers.erase(t);
//Logger::pfcp().trace( "Stopped Msg retry timer %d",t);
// Logger::pfcp().trace( "Stopped Msg retry timer %d",t);
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::start_proc_cleanup_timer(pfcp_procedure& p, uint32_t time_out_milli_seconds, const task_id_t& task_id, const uint32_t& seq_num)
{
p.proc_cleanup_timer_id = itti_inst->timer_setup (time_out_milli_seconds/1000, time_out_milli_seconds%1000, task_id);
proc_cleanup_timers.insert(std::pair<timer_id_t, uint32_t>(p.proc_cleanup_timer_id, seq_num));
//Logger::pfcp().trace( "Started proc cleanup timer %d, proc %" PRId64" t-out %" PRIu32" ms",p.proc_cleanup_timer_id,p.trxn_id, time_out_milli_seconds);
void pfcp_l4_stack::start_proc_cleanup_timer(
pfcp_procedure& p, uint32_t time_out_milli_seconds,
const task_id_t& task_id, const uint32_t& seq_num) {
p.proc_cleanup_timer_id = itti_inst->timer_setup(
time_out_milli_seconds / 1000, time_out_milli_seconds % 1000, task_id);
proc_cleanup_timers.insert(
std::pair<timer_id_t, uint32_t>(p.proc_cleanup_timer_id, seq_num));
// Logger::pfcp().trace( "Started proc cleanup timer %d, proc %" PRId64" t-out
// %" PRIu32" ms",p.proc_cleanup_timer_id,p.trxn_id, time_out_milli_seconds);
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::stop_proc_cleanup_timer(pfcp_procedure& p)
{
void pfcp_l4_stack::stop_proc_cleanup_timer(pfcp_procedure& p) {
itti_inst->timer_remove(p.proc_cleanup_timer_id);
//Logger::pfcp().trace( "Stopped proc cleanup timer %d, proc %" PRId64"",p.proc_cleanup_timer_id, p.trxn_id);
// Logger::pfcp().trace( "Stopped proc cleanup timer %d, proc %"
// PRId64"",p.proc_cleanup_timer_id, p.trxn_id);
msg_out_retry_timers.erase(p.proc_cleanup_timer_id);
p.proc_cleanup_timer_id = 0;
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::handle_receive_message_cb(const pfcp_msg& msg, const endpoint& remote_endpoint, const task_id_t& task_id, bool &error, uint64_t& trxn_id)
{
void pfcp_l4_stack::handle_receive_message_cb(
const pfcp_msg& msg, const endpoint& remote_endpoint,
const task_id_t& task_id, bool& error, uint64_t& trxn_id) {
trxn_id = 0;
error = true;
std::map<uint32_t , pfcp_procedure>::iterator it;
std::map<uint32_t, pfcp_procedure>::iterator it;
it = pending_procedures.find(msg.get_sequence_number());
if (it == pending_procedures.end()) {
if (pfcp_l4_stack::check_request_type(msg.get_message_type())) {
pfcp_procedure proc = {};
proc.trxn_id = generate_trxn_id();
proc.initial_msg_type = msg.get_message_type();
// TODO later 13.3 Detection and handling of requests which have timed out at the originating entity
// if (msg_has_timestamp()) {
// start_proc_cleanup_timer(proc, (N3+1) x T3, task_id, msg.get_sequence_number());
// } else
start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
// TODO later 13.3 Detection and handling of requests which have timed out
// at the originating entity if (msg_has_timestamp()) {
// start_proc_cleanup_timer(proc, (N3+1) x T3, task_id,
// msg.get_sequence_number()); } else
start_proc_cleanup_timer(
proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(
std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(
proc.trxn_id, msg.get_sequence_number()));
error = false;
trxn_id = proc.trxn_id;
//Logger::pfcp().info( "Received Initial PFCP msg type %d, seq %d, proc %" PRId64"", msg.get_message_type(), msg.get_sequence_number(), proc.trxn_id);
// Logger::pfcp().info( "Received Initial PFCP msg type %d, seq %d, proc
// %" PRId64"", msg.get_message_type(), msg.get_sequence_number(),
// proc.trxn_id);
} else {
Logger::pfcp().info( "Failed to check Initial message type, Silently discarding PFCP msg type %d, seq %d", msg.get_message_type(), msg.get_sequence_number());
Logger::pfcp().info(
"Failed to check Initial message type, Silently discarding PFCP msg "
"type %d, seq %d",
msg.get_message_type(), msg.get_sequence_number());
error = true;
}
return;
} else {
// Logger::pfcp().info( "pfcp_procedure retry_timer_id %d", it->second.retry_timer_id);
// Logger::pfcp().info( "pfcp_procedure proc_cleanup_timer_id %d", it->second.proc_cleanup_timer_id);
// Logger::pfcp().info( "pfcp_procedure trxn_id %ld", it->second.trxn_id);
// Logger::pfcp().info( "pfcp_procedure initial_msg_type %d", it->second.initial_msg_type);
// Logger::pfcp().info( "pfcp_procedure triggered_msg_type %d", it->second.triggered_msg_type);
// Logger::pfcp().info( "pfcp_procedure retry_count %d", it->second.retry_count);
// Logger::pfcp().info( "pfcp_procedure retry_timer_id %d",
// it->second.retry_timer_id); Logger::pfcp().info( "pfcp_procedure
// proc_cleanup_timer_id %d", it->second.proc_cleanup_timer_id);
// Logger::pfcp().info( "pfcp_procedure trxn_id %ld",
// it->second.trxn_id); Logger::pfcp().info( "pfcp_procedure
// initial_msg_type %d", it->second.initial_msg_type);
// Logger::pfcp().info( "pfcp_procedure triggered_msg_type %d",
// it->second.triggered_msg_type); Logger::pfcp().info( "pfcp_procedure
// retry_count %d", it->second.retry_count);
uint8_t check_initial_msg_type = it->second.triggered_msg_type;
if (!it->second.triggered_msg_type) {
check_initial_msg_type = it->second.initial_msg_type;
}
if (pfcp_l4_stack::check_response_type(check_initial_msg_type, msg.get_message_type())) {
if (pfcp_l4_stack::check_response_type(
check_initial_msg_type, msg.get_message_type())) {
if (!it->second.triggered_msg_type) {
it->second.triggered_msg_type = msg.get_message_type();
}
......@@ -199,99 +222,134 @@ void pfcp_l4_stack::handle_receive_message_cb(const pfcp_msg& msg, const endpoin
if (it->second.retry_timer_id) {
stop_msg_retry_timer(it->second);
}
//Logger::pfcp().info( "Received Triggered PFCP msg type %d, seq %d, proc %" PRId64"", msg.get_message_type(), msg.get_sequence_number(), trxn_id);
// Logger::pfcp().info( "Received Triggered PFCP msg type %d, seq %d, proc
// %" PRId64"", msg.get_message_type(), msg.get_sequence_number(),
// trxn_id);
} else {
Logger::pfcp().info( "Failed to check Triggered message type, Silently discarding PFCP msg type %d, seq %d", msg.get_message_type(), msg.get_sequence_number());
Logger::pfcp().info(
"Failed to check Triggered message type, Silently discarding PFCP "
"msg type %d, seq %d",
msg.get_message_type(), msg.get_sequence_number());
error = true;
}
}
}
//------------------------------------------------------------------------------
uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_heartbeat_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id)
{
uint32_t pfcp_l4_stack::send_request(
const endpoint& dest, const pfcp_heartbeat_request& pfcp_ies,
const task_id_t& task_id, const uint64_t trxn_id) {
std::ostringstream oss(std::ostringstream::binary);
pfcp_msg msg(pfcp_ies);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
//std::cout << string_to_hex(oss.str()) << std::endl;
//std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
// std::cout << string_to_hex(oss.str()) << std::endl;
// std::cout << std::hex << "msg length 0x" << msg.get_message_length() <<
// "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
Logger::pfcp().trace(
"Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
pfcp_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.trxn_id = trxn_id;
proc.retry_msg = std::make_shared<pfcp_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
start_msg_retry_timer(
proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(
proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(
std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(
std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
// TTN: temporary fix to be able to work with UPF from dsTester (should be
// removed later) udp_s_allocated.async_send_to(reinterpret_cast<const
// char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_association_setup_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id)
{
uint32_t pfcp_l4_stack::send_request(
const endpoint& dest, const pfcp_association_setup_request& pfcp_ies,
const task_id_t& task_id, const uint64_t trxn_id) {
std::ostringstream oss(std::ostringstream::binary);
pfcp_msg msg(pfcp_ies);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
//std::cout << string_to_hex(oss.str()) << std::endl;
//std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
// std::cout << string_to_hex(oss.str()) << std::endl;
// std::cout << std::hex << "msg length 0x" << msg.get_message_length() <<
// "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
Logger::pfcp().trace(
"Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
pfcp_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.trxn_id = trxn_id;
proc.retry_msg = std::make_shared<pfcp_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
start_msg_retry_timer(
proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(
proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(
std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(
std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
// TTN: temporary fix to be able to work with UPF from dsTester (should be
// removed later)
// udp_s_allocated.async_send_to(reinterpret_cast<const
// char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_association_release_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id)
{
uint32_t pfcp_l4_stack::send_request(
const endpoint& dest, const pfcp_association_release_request& pfcp_ies,
const task_id_t& task_id, const uint64_t trxn_id) {
std::ostringstream oss(std::ostringstream::binary);
pfcp_msg msg(pfcp_ies);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
//std::cout << string_to_hex(oss.str()) << std::endl;
//std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
// std::cout << string_to_hex(oss.str()) << std::endl;
// std::cout << std::hex << "msg length 0x" << msg.get_message_length() <<
// "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
Logger::pfcp().trace(
"Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
pfcp_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.trxn_id = trxn_id;
proc.retry_msg = std::make_shared<pfcp_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
start_msg_retry_timer(
proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(
proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(
std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(
std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
// TTN: temporary fix to be able to work with UPF from dsTester (should be
// removed later) udp_s_allocated.async_send_to(reinterpret_cast<const
// char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
////------------------------------------------------------------------------------
//uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid, const pfcp_association_update_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id)
// uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t
// seid, const pfcp_association_update_request& pfcp_ies, const task_id_t&
// task_id, const uint64_t trxn_id)
//{
// std::ostringstream oss(std::ostringstream::binary);
// pfcp_msg msg(pfcp_ies);
......@@ -299,25 +357,29 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_associatio
// msg.set_sequence_number(get_next_seq_num());
// msg.dump_to(oss);
// //std::cout << string_to_hex(oss.str()) << std::endl;
// //std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
// std::string bstream = oss.str();
// //std::cout << std::hex << "msg length 0x" << msg.get_message_length() <<
// "msg seqnum 0x" << msg.get_sequence_number() << std::endl; std::string
// bstream = oss.str();
//
// Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
// pfcp_procedure proc = {};
// proc.initial_msg_type = msg.get_message_type();
// proc.trxn_id = trxn_id;
// proc.retry_msg = std::make_shared<pfcp_msg>(msg);
// proc.remote_endpoint = dest;
// start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
// start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
// pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
// trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
// Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(),
// msg.get_sequence_number()); pfcp_procedure proc = {}; proc.initial_msg_type
// = msg.get_message_type(); proc.trxn_id = trxn_id; proc.retry_msg =
// std::make_shared<pfcp_msg>(msg); proc.remote_endpoint = dest;
// start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id,
// msg.get_sequence_number()); start_proc_cleanup_timer(proc,
// PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
// pending_procedures.insert(std::pair<uint32_t,
// pfcp_procedure>(msg.get_sequence_number(), proc));
// trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id,
// msg.get_sequence_number()));
//
// udp_s.async_send_to(sm, dest);
// return msg.get_sequence_number();
//}
////------------------------------------------------------------------------------
//uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid, const pfcp_association_release_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id)
// uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t
// seid, const pfcp_association_release_request& pfcp_ies, const task_id_t&
// task_id, const uint64_t trxn_id)
//{
// std::ostringstream oss(std::ostringstream::binary);
// pfcp_msg msg(pfcp_ies);
......@@ -325,108 +387,144 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_associatio
// msg.set_sequence_number(get_next_seq_num());
// msg.dump_to(oss);
// //std::cout << string_to_hex(oss.str()) << std::endl;
// //std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
// std::string bstream = oss.str();
// //std::cout << std::hex << "msg length 0x" << msg.get_message_length() <<
// "msg seqnum 0x" << msg.get_sequence_number() << std::endl; std::string
// bstream = oss.str();
//
// Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
// pfcp_procedure proc = {};
// proc.initial_msg_type = msg.get_message_type();
// proc.trxn_id = trxn_id;
// proc.retry_msg = std::make_shared<pfcp_msg>(msg);
// proc.remote_endpoint = dest;
// start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
// start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
// pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
// trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
// Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(),
// msg.get_sequence_number()); pfcp_procedure proc = {}; proc.initial_msg_type
// = msg.get_message_type(); proc.trxn_id = trxn_id; proc.retry_msg =
// std::make_shared<pfcp_msg>(msg); proc.remote_endpoint = dest;
// start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id,
// msg.get_sequence_number()); start_proc_cleanup_timer(proc,
// PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
// pending_procedures.insert(std::pair<uint32_t,
// pfcp_procedure>(msg.get_sequence_number(), proc));
// trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id,
// msg.get_sequence_number()));
//
// udp_s.async_send_to(sm, dest);
// return msg.get_sequence_number();
//}
//------------------------------------------------------------------------------
uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid, const pfcp_node_report_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id)
{
uint32_t pfcp_l4_stack::send_request(
const endpoint& dest, const uint64_t seid,
const pfcp_node_report_request& pfcp_ies, const task_id_t& task_id,
const uint64_t trxn_id) {
std::ostringstream oss(std::ostringstream::binary);
pfcp_msg msg(pfcp_ies);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
//std::cout << string_to_hex(oss.str()) << std::endl;
//std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
// std::cout << string_to_hex(oss.str()) << std::endl;
// std::cout << std::hex << "msg length 0x" << msg.get_message_length() <<
// "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
Logger::pfcp().trace(
"Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
pfcp_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.trxn_id = trxn_id;
proc.retry_msg = std::make_shared<pfcp_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
start_msg_retry_timer(
proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(
proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(
std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(
std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
// TTN: temporary fix to be able to work with UPF from dsTester (should be
// removed later) udp_s_allocated.async_send_to(reinterpret_cast<const
// char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_establishment_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id)
{
uint32_t pfcp_l4_stack::send_request(
const endpoint& dest, const uint64_t seid,
const pfcp_session_establishment_request& pfcp_ies,
const task_id_t& task_id, const uint64_t trxn_id) {
std::ostringstream oss(std::ostringstream::binary);
pfcp_msg msg(pfcp_ies);
msg.set_seid(seid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
//std::cout << string_to_hex(oss.str()) << std::endl;
//std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
// std::cout << string_to_hex(oss.str()) << std::endl;
// std::cout << std::hex << "msg length 0x" << msg.get_message_length() <<
// "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(), msg.get_sequence_number(), seid);
Logger::pfcp().trace(
"Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(),
msg.get_sequence_number(), seid);
pfcp_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.trxn_id = trxn_id;
proc.retry_msg = std::make_shared<pfcp_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
start_msg_retry_timer(
proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(
proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(
std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(
std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
// TTN: temporary fix to be able to work with UPF from dsTester (should be
// removed later) udp_s_allocated.async_send_to(reinterpret_cast<const
// char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_modification_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id)
{
uint32_t pfcp_l4_stack::send_request(
const endpoint& dest, const uint64_t seid,
const pfcp_session_modification_request& pfcp_ies, const task_id_t& task_id,
const uint64_t trxn_id) {
std::ostringstream oss(std::ostringstream::binary);
pfcp_msg msg(pfcp_ies);
msg.set_seid(seid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
//std::cout << string_to_hex(oss.str()) << std::endl;
//std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
// std::cout << string_to_hex(oss.str()) << std::endl;
// std::cout << std::hex << "msg length 0x" << msg.get_message_length() <<
// "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(), msg.get_sequence_number(), seid);
Logger::pfcp().trace(
"Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(),
msg.get_sequence_number(), seid);
pfcp_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.trxn_id = trxn_id;
proc.retry_msg = std::make_shared<pfcp_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
start_msg_retry_timer(
proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(
proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(
std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(
std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
// TTN: temporary fix to be able to work with UPF from dsTester (should be
// removed later) udp_s_allocated.async_send_to(reinterpret_cast<const
// char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
////------------------------------------------------------------------------------
//uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_modification_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id)
// uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t
// seid, const pfcp_session_modification_request& pfcp_ies, const task_id_t&
// task_id, const uint64_t trxn_id)
//{
// std::ostringstream oss(std::ostringstream::binary);
// pfcp_msg msg(pfcp_ies);
......@@ -434,83 +532,108 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
// msg.set_sequence_number(get_next_seq_num());
// msg.dump_to(oss);
// //std::cout << string_to_hex(oss.str()) << std::endl;
// //std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
// std::string bstream = oss.str();
// //std::cout << std::hex << "msg length 0x" << msg.get_message_length() <<
// "msg seqnum 0x" << msg.get_sequence_number() << std::endl; std::string
// bstream = oss.str();
//
// Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
// pfcp_procedure proc = {};
// proc.initial_msg_type = msg.get_message_type();
// proc.trxn_id = trxn_id;
// proc.retry_msg = std::make_shared<pfcp_msg>(msg);
// proc.remote_endpoint = dest;
// start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
// start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
// pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
// trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
// Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(),
// msg.get_sequence_number()); pfcp_procedure proc = {}; proc.initial_msg_type
// = msg.get_message_type(); proc.trxn_id = trxn_id; proc.retry_msg =
// std::make_shared<pfcp_msg>(msg); proc.remote_endpoint = dest;
// start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id,
// msg.get_sequence_number()); start_proc_cleanup_timer(proc,
// PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
// pending_procedures.insert(std::pair<uint32_t,
// pfcp_procedure>(msg.get_sequence_number(), proc));
// trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id,
// msg.get_sequence_number()));
//
// udp_s.async_send_to(sm, dest);
// return msg.get_sequence_number();
//}
//------------------------------------------------------------------------------
uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_deletion_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id)
{
uint32_t pfcp_l4_stack::send_request(
const endpoint& dest, const uint64_t seid,
const pfcp_session_deletion_request& pfcp_ies, const task_id_t& task_id,
const uint64_t trxn_id) {
std::ostringstream oss(std::ostringstream::binary);
pfcp_msg msg(pfcp_ies);
msg.set_seid(seid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
//std::cout << string_to_hex(oss.str()) << std::endl;
//std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
// std::cout << string_to_hex(oss.str()) << std::endl;
// std::cout << std::hex << "msg length 0x" << msg.get_message_length() <<
// "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(), msg.get_sequence_number(), seid);
Logger::pfcp().trace(
"Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(),
msg.get_sequence_number(), seid);
pfcp_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.trxn_id = trxn_id;
proc.retry_msg = std::make_shared<pfcp_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
start_msg_retry_timer(
proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(
proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(
std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(
std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
// TTN: temporary fix to be able to work with UPF from dsTester (should be
// removed later) udp_s_allocated.async_send_to(reinterpret_cast<const
// char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_report_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id)
{
uint32_t pfcp_l4_stack::send_request(
const endpoint& dest, const uint64_t seid,
const pfcp_session_report_request& pfcp_ies, const task_id_t& task_id,
const uint64_t trxn_id) {
std::ostringstream oss(std::ostringstream::binary);
pfcp_msg msg(pfcp_ies);
msg.set_seid(seid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
//std::cout << string_to_hex(oss.str()) << std::endl;
//std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
// std::cout << string_to_hex(oss.str()) << std::endl;
// std::cout << std::hex << "msg length 0x" << msg.get_message_length() <<
// "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(), msg.get_sequence_number(), seid);
Logger::pfcp().trace(
"Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(),
msg.get_sequence_number(), seid);
pfcp_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.trxn_id = trxn_id;
proc.retry_msg = std::make_shared<pfcp_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
start_msg_retry_timer(
proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(
proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(
std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(
std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
// TTN: temporary fix to be able to work with UPF from dsTester (should be
// removed later) udp_s_allocated.async_send_to(reinterpret_cast<const
// char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::send_response(const endpoint& dest, const pfcp_heartbeat_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
void pfcp_l4_stack::send_response(
const endpoint& dest, const pfcp_heartbeat_response& pfcp_ies,
const uint64_t trxn_id, const pfcp_transaction_action& a) {
std::map<uint64_t, uint32_t>::iterator it;
it = trxn_id2seq_num.find(trxn_id);
if (it != trxn_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
......@@ -518,11 +641,15 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const pfcp_heartbeat_res
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
Logger::pfcp().trace(
"Sending %s, seq %d", pfcp_ies.get_msg_name(),
msg.get_sequence_number());
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
if (a == DELETE_TX) {
std::map<uint32_t , pfcp_procedure>::iterator it_proc = pending_procedures.find(it->second);
std::map<uint32_t, pfcp_procedure>::iterator it_proc =
pending_procedures.find(it->second);
if (it_proc != pending_procedures.end()) {
stop_proc_cleanup_timer(it_proc->second);
pending_procedures.erase(it_proc);
......@@ -530,13 +657,16 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const pfcp_heartbeat_res
trxn_id2seq_num.erase(it);
}
} else {
Logger::pfcp().error( "Sending %s, trxn_id %ld proc not found, discarded!", pfcp_ies.get_msg_name(), trxn_id);
Logger::pfcp().error(
"Sending %s, trxn_id %ld proc not found, discarded!",
pfcp_ies.get_msg_name(), trxn_id);
}
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::send_response(const endpoint& dest, const pfcp_association_setup_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
void pfcp_l4_stack::send_response(
const endpoint& dest, const pfcp_association_setup_response& pfcp_ies,
const uint64_t trxn_id, const pfcp_transaction_action& a) {
std::map<uint64_t, uint32_t>::iterator it;
it = trxn_id2seq_num.find(trxn_id);
if (it != trxn_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
......@@ -544,11 +674,15 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const pfcp_association_s
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
Logger::pfcp().trace(
"Sending %s, seq %d", pfcp_ies.get_msg_name(),
msg.get_sequence_number());
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
if (a == DELETE_TX) {
std::map<uint32_t , pfcp_procedure>::iterator it_proc = pending_procedures.find(it->second);
std::map<uint32_t, pfcp_procedure>::iterator it_proc =
pending_procedures.find(it->second);
if (it_proc != pending_procedures.end()) {
stop_proc_cleanup_timer(it_proc->second);
pending_procedures.erase(it_proc);
......@@ -556,14 +690,17 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const pfcp_association_s
trxn_id2seq_num.erase(it);
}
} else {
Logger::pfcp().error( "Sending %s, trxn_id %ld proc not found, discarded!", pfcp_ies.get_msg_name(), trxn_id);
Logger::pfcp().error(
"Sending %s, trxn_id %ld proc not found, discarded!",
pfcp_ies.get_msg_name(), trxn_id);
}
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::send_response(const endpoint& dest, const pfcp_association_release_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
void pfcp_l4_stack::send_response(
const endpoint& dest, const pfcp_association_release_response& pfcp_ies,
const uint64_t trxn_id, const pfcp_transaction_action& a) {
std::map<uint64_t, uint32_t>::iterator it;
it = trxn_id2seq_num.find(trxn_id);
if (it != trxn_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
......@@ -571,11 +708,15 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const pfcp_association_r
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
Logger::pfcp().trace(
"Sending %s, seq %d", pfcp_ies.get_msg_name(),
msg.get_sequence_number());
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
if (a == DELETE_TX) {
std::map<uint32_t , pfcp_procedure>::iterator it_proc = pending_procedures.find(it->second);
std::map<uint32_t, pfcp_procedure>::iterator it_proc =
pending_procedures.find(it->second);
if (it_proc != pending_procedures.end()) {
stop_proc_cleanup_timer(it_proc->second);
pending_procedures.erase(it_proc);
......@@ -583,14 +724,18 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const pfcp_association_r
trxn_id2seq_num.erase(it);
}
} else {
Logger::pfcp().error( "Sending %s, trxn_id %ld proc not found, discarded!", pfcp_ies.get_msg_name(), trxn_id);
Logger::pfcp().error(
"Sending %s, trxn_id %ld proc not found, discarded!",
pfcp_ies.get_msg_name(), trxn_id);
}
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::send_response(const endpoint& dest, const uint64_t seid, const pfcp_session_establishment_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
void pfcp_l4_stack::send_response(
const endpoint& dest, const uint64_t seid,
const pfcp_session_establishment_response& pfcp_ies, const uint64_t trxn_id,
const pfcp_transaction_action& a) {
std::map<uint64_t, uint32_t>::iterator it;
it = trxn_id2seq_num.find(trxn_id);
if (it != trxn_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
......@@ -599,11 +744,15 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const uint64_t seid, con
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(), msg.get_sequence_number(), seid);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
Logger::pfcp().trace(
"Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(),
msg.get_sequence_number(), seid);
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
if (a == DELETE_TX) {
std::map<uint32_t , pfcp_procedure>::iterator it_proc = pending_procedures.find(it->second);
std::map<uint32_t, pfcp_procedure>::iterator it_proc =
pending_procedures.find(it->second);
if (it_proc != pending_procedures.end()) {
stop_proc_cleanup_timer(it_proc->second);
pending_procedures.erase(it_proc);
......@@ -611,13 +760,17 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const uint64_t seid, con
trxn_id2seq_num.erase(it);
}
} else {
Logger::pfcp().error( "Sending %s, trxn_id %ld proc not found, discarded!", pfcp_ies.get_msg_name(), trxn_id);
Logger::pfcp().error(
"Sending %s, trxn_id %ld proc not found, discarded!",
pfcp_ies.get_msg_name(), trxn_id);
}
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::send_response(const endpoint& dest, const uint64_t seid, const pfcp_session_modification_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
void pfcp_l4_stack::send_response(
const endpoint& dest, const uint64_t seid,
const pfcp_session_modification_response& pfcp_ies, const uint64_t trxn_id,
const pfcp_transaction_action& a) {
std::map<uint64_t, uint32_t>::iterator it;
it = trxn_id2seq_num.find(trxn_id);
if (it != trxn_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
......@@ -626,11 +779,15 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const uint64_t seid, con
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(), msg.get_sequence_number(), seid);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
Logger::pfcp().trace(
"Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(),
msg.get_sequence_number(), seid);
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
if (a == DELETE_TX) {
std::map<uint32_t , pfcp_procedure>::iterator it_proc = pending_procedures.find(it->second);
std::map<uint32_t, pfcp_procedure>::iterator it_proc =
pending_procedures.find(it->second);
if (it_proc != pending_procedures.end()) {
stop_proc_cleanup_timer(it_proc->second);
pending_procedures.erase(it_proc);
......@@ -638,13 +795,17 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const uint64_t seid, con
trxn_id2seq_num.erase(it);
}
} else {
Logger::pfcp().error( "Sending %s, trxn_id %ld proc not found, discarded!", pfcp_ies.get_msg_name(), trxn_id);
Logger::pfcp().error(
"Sending %s, trxn_id %ld proc not found, discarded!",
pfcp_ies.get_msg_name(), trxn_id);
}
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::send_response(const endpoint& dest, const uint64_t seid, const pfcp_session_deletion_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
void pfcp_l4_stack::send_response(
const endpoint& dest, const uint64_t seid,
const pfcp_session_deletion_response& pfcp_ies, const uint64_t trxn_id,
const pfcp_transaction_action& a) {
std::map<uint64_t, uint32_t>::iterator it;
it = trxn_id2seq_num.find(trxn_id);
if (it != trxn_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
......@@ -653,11 +814,15 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const uint64_t seid, con
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(), msg.get_sequence_number(), seid);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
Logger::pfcp().trace(
"Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(),
msg.get_sequence_number(), seid);
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
if (a == DELETE_TX) {
std::map<uint32_t , pfcp_procedure>::iterator it_proc = pending_procedures.find(it->second);
std::map<uint32_t, pfcp_procedure>::iterator it_proc =
pending_procedures.find(it->second);
if (it_proc != pending_procedures.end()) {
stop_proc_cleanup_timer(it_proc->second);
pending_procedures.erase(it_proc);
......@@ -665,13 +830,17 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const uint64_t seid, con
trxn_id2seq_num.erase(it);
}
} else {
Logger::pfcp().error( "Sending %s, trxn_id %ld proc not found, discarded!", pfcp_ies.get_msg_name(), trxn_id);
Logger::pfcp().error(
"Sending %s, trxn_id %ld proc not found, discarded!",
pfcp_ies.get_msg_name(), trxn_id);
}
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::send_response(const endpoint& dest, const uint64_t seid, const pfcp_session_report_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
void pfcp_l4_stack::send_response(
const endpoint& dest, const uint64_t seid,
const pfcp_session_report_response& pfcp_ies, const uint64_t trxn_id,
const pfcp_transaction_action& a) {
std::map<uint64_t, uint32_t>::iterator it;
it = trxn_id2seq_num.find(trxn_id);
if (it != trxn_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
......@@ -680,11 +849,15 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const uint64_t seid, con
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d seid " SEID_FMT " to %s", pfcp_ies.get_msg_name(), msg.get_sequence_number(), seid, dest.toString().c_str());
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
Logger::pfcp().trace(
"Sending %s, seq %d seid " SEID_FMT " to %s", pfcp_ies.get_msg_name(),
msg.get_sequence_number(), seid, dest.toString().c_str());
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
if (a == DELETE_TX) {
std::map<uint32_t , pfcp_procedure>::iterator it_proc = pending_procedures.find(it->second);
std::map<uint32_t, pfcp_procedure>::iterator it_proc =
pending_procedures.find(it->second);
if (it_proc != pending_procedures.end()) {
stop_proc_cleanup_timer(it_proc->second);
pending_procedures.erase(it_proc);
......@@ -692,53 +865,67 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const uint64_t seid, con
trxn_id2seq_num.erase(it);
}
} else {
Logger::pfcp().error( "Sending %s, trxn_id %ld proc not found, discarded!", pfcp_ies.get_msg_name(), trxn_id);
Logger::pfcp().error(
"Sending %s, trxn_id %ld proc not found, discarded!",
pfcp_ies.get_msg_name(), trxn_id);
}
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::notify_ul_error(const pfcp_procedure& p, const ::cause_value_e cause)
{
Logger::pfcp().trace( "notify_ul_error proc %" PRId64" cause %d", p.trxn_id, cause);
void pfcp_l4_stack::notify_ul_error(
const pfcp_procedure& p, const ::cause_value_e cause) {
Logger::pfcp().trace(
"notify_ul_error proc %" PRId64 " cause %d", p.trxn_id, cause);
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::time_out_event(const uint32_t timer_id, const task_id_t& task_id, bool &handled)
{
void pfcp_l4_stack::time_out_event(
const uint32_t timer_id, const task_id_t& task_id, bool& handled) {
handled = false;
std::map<timer_id_t, uint32_t>::iterator it = msg_out_retry_timers.find(timer_id);
std::map<timer_id_t, uint32_t>::iterator it =
msg_out_retry_timers.find(timer_id);
if (it != msg_out_retry_timers.end()) {
std::map<uint32_t , pfcp_procedure>::iterator it_proc = pending_procedures.find(it->second);
std::map<uint32_t, pfcp_procedure>::iterator it_proc =
pending_procedures.find(it->second);
msg_out_retry_timers.erase(it);
handled = true;
if (it_proc != pending_procedures.end()) {
if (it_proc->second.retry_count < PFCP_N1_REQUESTS) {
it_proc->second.retry_count++;
start_msg_retry_timer(it_proc->second, PFCP_T1_RESPONSE_MS, task_id, it_proc->second.retry_msg->get_sequence_number());
start_msg_retry_timer(
it_proc->second, PFCP_T1_RESPONSE_MS, task_id,
it_proc->second.retry_msg->get_sequence_number());
// send again message
Logger::pfcp().trace( "Retry %d Sending msg type %d, seq %d",
it_proc->second.retry_count, it_proc->second.retry_msg->get_message_type(), it_proc->second.retry_msg->get_sequence_number());
Logger::pfcp().trace(
"Retry %d Sending msg type %d, seq %d", it_proc->second.retry_count,
it_proc->second.retry_msg->get_message_type(),
it_proc->second.retry_msg->get_sequence_number());
std::ostringstream oss(std::ostringstream::binary);
it_proc->second.retry_msg->dump_to(oss);
std::string bstream = oss.str();
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), it_proc->second.remote_endpoint);
udp_s_8805.async_send_to(
reinterpret_cast<const char*>(bstream.c_str()), bstream.length(),
it_proc->second.remote_endpoint);
} else {
// abort procedure
notify_ul_error(it_proc->second, ::cause_value_e::REMOTE_PEER_NOT_RESPONDING);
notify_ul_error(
it_proc->second, ::cause_value_e::REMOTE_PEER_NOT_RESPONDING);
}
}
} else {
it = proc_cleanup_timers.find(timer_id);
if (it != proc_cleanup_timers.end()) {
std::map<uint32_t , pfcp_procedure>::iterator it_proc = pending_procedures.find(it->second);
std::map<uint32_t, pfcp_procedure>::iterator it_proc =
pending_procedures.find(it->second);
proc_cleanup_timers.erase(it);
handled = true;
if (it_proc != pending_procedures.end()) {
it_proc->second.proc_cleanup_timer_id = 0;
Logger::pfcp().trace( "Delete proc %" PRId64" Retry %d seq %d timer id %u",
it_proc->second.trxn_id, it_proc->second.retry_count, it_proc->first, timer_id);
Logger::pfcp().trace(
"Delete proc %" PRId64 " Retry %d seq %d timer id %u",
it_proc->second.trxn_id, it_proc->second.retry_count,
it_proc->first, timer_id);
pending_procedures.erase(it_proc);
}
}
}
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -47,7 +47,7 @@ namespace pfcp {
static const uint16_t default_port = 8805;
class pfcp_procedure {
public:
public:
std::shared_ptr<pfcp_msg> retry_msg;
endpoint remote_endpoint;
timer_id_t retry_timer_id;
......@@ -57,7 +57,8 @@ public:
uint8_t triggered_msg_type; // sent or received
uint8_t retry_count;
pfcp_procedure() : retry_msg(),
pfcp_procedure()
: retry_msg(),
remote_endpoint(),
retry_timer_id(0),
proc_cleanup_timer_id(0),
......@@ -66,7 +67,8 @@ public:
triggered_msg_type(0),
retry_count(0) {}
pfcp_procedure(const pfcp_procedure& p) : retry_msg(p.retry_msg),
pfcp_procedure(const pfcp_procedure& p)
: retry_msg(p.retry_msg),
remote_endpoint(p.remote_endpoint),
retry_timer_id(p.retry_timer_id),
proc_cleanup_timer_id(p.proc_cleanup_timer_id),
......@@ -76,18 +78,15 @@ public:
retry_count(p.retry_count) {}
};
enum pfcp_transaction_action {
DELETE_TX = 0,
CONTINUE_TX
};
enum pfcp_transaction_action { DELETE_TX = 0, CONTINUE_TX };
class pfcp_l4_stack : public udp_application {
#define PFCP_T1_RESPONSE_MS 1000
#define PFCP_N1_REQUESTS 3
#define PFCP_PROC_TIME_OUT_MS ((PFCP_T1_RESPONSE_MS) * (PFCP_N1_REQUESTS + 1 + 1))
#define PFCP_PROC_TIME_OUT_MS \
((PFCP_T1_RESPONSE_MS) * (PFCP_N1_REQUESTS + 1 + 1))
protected:
protected:
uint32_t id;
udp_server udp_s_8805;
udp_server udp_s_allocated;
......@@ -99,7 +98,7 @@ protected:
std::map<uint64_t, uint32_t> trxn_id2seq_num;
std::map<timer_id_t, uint32_t> proc_cleanup_timers;
std::map<timer_id_t, uint32_t> msg_out_retry_timers;
std::map<uint32_t , pfcp_procedure> pending_procedures;
std::map<uint32_t, pfcp_procedure> pending_procedures;
static const char* msg_type2cstr[256];
......@@ -110,46 +109,101 @@ protected:
}
static bool check_request_type(const uint8_t initial);
static bool check_response_type(const uint8_t initial, const uint8_t triggered);
void start_proc_cleanup_timer(pfcp_procedure& p, uint32_t time_out_milli_seconds, const task_id_t& task_id, const uint32_t& seq_num);
void start_msg_retry_timer(pfcp_procedure& p, uint32_t time_out_milli_seconds, const task_id_t& task_id, const uint32_t& seq_num);
static bool check_response_type(
const uint8_t initial, const uint8_t triggered);
void start_proc_cleanup_timer(
pfcp_procedure& p, uint32_t time_out_milli_seconds,
const task_id_t& task_id, const uint32_t& seq_num);
void start_msg_retry_timer(
pfcp_procedure& p, uint32_t time_out_milli_seconds,
const task_id_t& task_id, const uint32_t& seq_num);
void stop_msg_retry_timer(pfcp_procedure& p);
void stop_msg_retry_timer(timer_id_t& t);
void stop_proc_cleanup_timer(pfcp_procedure& p);
void notify_ul_error(const pfcp_procedure& p, const ::cause_value_e cause);
public:
public:
static const uint8_t version = 2;
pfcp_l4_stack(const std::string& ip_address, const unsigned short port_num, const util::thread_sched_params& sched_params);
virtual void handle_receive(char* recv_buffer, const std::size_t bytes_transferred, endpoint& remote_endpoint);
void handle_receive_message_cb(const pfcp_msg& msg, const endpoint& remote_endpoint, const task_id_t& task_id, bool& error, uint64_t& trxn_id);
pfcp_l4_stack(
const std::string& ip_address, const unsigned short port_num,
const util::thread_sched_params& sched_params);
virtual void handle_receive(
char* recv_buffer, const std::size_t bytes_transferred,
endpoint& remote_endpoint);
void handle_receive_message_cb(
const pfcp_msg& msg, const endpoint& remote_endpoint,
const task_id_t& task_id, bool& error, uint64_t& trxn_id);
// Node related messages
// virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_pfd_management_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(const endpoint& dest, const pfcp_heartbeat_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(const endpoint& dest, const pfcp_association_setup_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
// virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_association_update_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(const endpoint& dest, const pfcp_association_release_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_node_report_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
// virtual uint32_t send_request(const endpoint& dest, const uint64_t seid,
// const pfcp_pfd_management_request& pfcp_ies, const task_id_t& task_id,
// const uint64_t trxn_id);
virtual uint32_t send_request(
const endpoint& dest, const pfcp_heartbeat_request& pfcp_ies,
const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(
const endpoint& dest, const pfcp_association_setup_request& pfcp_ies,
const task_id_t& task_id, const uint64_t trxn_id);
// virtual uint32_t send_request(const endpoint& dest, const uint64_t seid,
// const pfcp_association_update_request& pfcp_ies, const task_id_t& task_id,
// const uint64_t trxn_id);
virtual uint32_t send_request(
const endpoint& dest, const pfcp_association_release_request& pfcp_ies,
const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(
const endpoint& dest, const uint64_t seid,
const pfcp_node_report_request& pfcp_ies, const task_id_t& task_id,
const uint64_t trxn_id);
// session related messages
virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_establishment_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_modification_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_deletion_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_report_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(
const endpoint& dest, const uint64_t seid,
const pfcp_session_establishment_request& pfcp_ies,
const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(
const endpoint& dest, const uint64_t seid,
const pfcp_session_modification_request& pfcp_ies,
const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(
const endpoint& dest, const uint64_t seid,
const pfcp_session_deletion_request& pfcp_ies, const task_id_t& task_id,
const uint64_t trxn_id);
virtual uint32_t send_request(
const endpoint& dest, const uint64_t seid,
const pfcp_session_report_request& pfcp_ies, const task_id_t& task_id,
const uint64_t trxn_id);
// Node related messages
virtual void send_response(const endpoint& dest, const pfcp_heartbeat_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a = DELETE_TX);
virtual void send_response(const endpoint& dest, const pfcp_association_setup_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a = DELETE_TX);
virtual void send_response(const endpoint& dest, const pfcp_association_release_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a = DELETE_TX);
virtual void send_response(
const endpoint& dest, const pfcp_heartbeat_response& pfcp_ies,
const uint64_t trxn_id, const pfcp_transaction_action& a = DELETE_TX);
virtual void send_response(
const endpoint& dest, const pfcp_association_setup_response& pfcp_ies,
const uint64_t trxn_id, const pfcp_transaction_action& a = DELETE_TX);
virtual void send_response(
const endpoint& dest, const pfcp_association_release_response& pfcp_ies,
const uint64_t trxn_id, const pfcp_transaction_action& a = DELETE_TX);
// session related messages
virtual void send_response(const endpoint& dest, const uint64_t seid, const pfcp_session_establishment_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a = DELETE_TX);
virtual void send_response(const endpoint& dest, const uint64_t seid, const pfcp_session_modification_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a = DELETE_TX);
virtual void send_response(const endpoint& dest, const uint64_t seid, const pfcp_session_deletion_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a = DELETE_TX);
virtual void send_response(const endpoint& dest, const uint64_t seid, const pfcp_session_report_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a = DELETE_TX);
void time_out_event(const uint32_t timer_id, const task_id_t& task_id, bool &error);
virtual void send_response(
const endpoint& dest, const uint64_t seid,
const pfcp_session_establishment_response& pfcp_ies,
const uint64_t trxn_id, const pfcp_transaction_action& a = DELETE_TX);
virtual void send_response(
const endpoint& dest, const uint64_t seid,
const pfcp_session_modification_response& pfcp_ies,
const uint64_t trxn_id, const pfcp_transaction_action& a = DELETE_TX);
virtual void send_response(
const endpoint& dest, const uint64_t seid,
const pfcp_session_deletion_response& pfcp_ies, const uint64_t trxn_id,
const pfcp_transaction_action& a = DELETE_TX);
virtual void send_response(
const endpoint& dest, const uint64_t seid,
const pfcp_session_report_response& pfcp_ies, const uint64_t trxn_id,
const pfcp_transaction_action& a = DELETE_TX);
void time_out_event(
const uint32_t timer_id, const task_id_t& task_id, bool& error);
};
} // namespace pfcp
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -31,27 +31,26 @@
#include <cstdlib>
//------------------------------------------------------------------------------
void udp_application::handle_receive(char* recv_buffer, const std::size_t bytes_transferred, const endpoint& r_endpoint)
{
Logger::udp().warn( "Missing implementation of interface udp_application\n");
void udp_application::handle_receive(
char* recv_buffer, const std::size_t bytes_transferred,
const endpoint& r_endpoint) {
Logger::udp().warn("Missing implementation of interface udp_application\n");
}
//------------------------------------------------------------------------------
void udp_application::start_receive(udp_application * gtp_stack, const util::thread_sched_params& sched_params)
{
Logger::udp().warn( "Missing implementation of interface udp_application\n");
void udp_application::start_receive(
udp_application* gtp_stack, const util::thread_sched_params& sched_params) {
Logger::udp().warn("Missing implementation of interface udp_application\n");
}
//------------------------------------------------------------------------------
static std::string string_to_hex(const std::string& input)
{
static std::string string_to_hex(const std::string& input) {
static const char* const lut = "0123456789ABCDEF";
size_t len = input.length();
std::string output;
output.reserve(2 * len);
for (size_t i = 0; i < len; ++i)
{
for (size_t i = 0; i < len; ++i) {
const unsigned char c = input[i];
output.push_back(lut[c >> 4]);
output.push_back(lut[c & 15]);
......@@ -59,8 +58,7 @@ static std::string string_to_hex(const std::string& input)
return output;
}
//------------------------------------------------------------------------------
void udp_server::udp_read_loop(const util::thread_sched_params& sched_params)
{
void udp_server::udp_read_loop(const util::thread_sched_params& sched_params) {
endpoint r_endpoint = {};
size_t bytes_received = 0;
......@@ -68,106 +66,117 @@ void udp_server::udp_read_loop(const util::thread_sched_params& sched_params)
while (1) {
r_endpoint.addr_storage_len = sizeof(struct sockaddr_storage);
if ((bytes_received = recvfrom (socket_, recv_buffer_, UDP_RECV_BUFFER_SIZE, 0, (struct sockaddr *)&r_endpoint.addr_storage, &r_endpoint.addr_storage_len)) > 0) {
if ((bytes_received = recvfrom(
socket_, recv_buffer_, UDP_RECV_BUFFER_SIZE, 0,
(struct sockaddr*) &r_endpoint.addr_storage,
&r_endpoint.addr_storage_len)) > 0) {
app_->handle_receive(recv_buffer_, bytes_received, r_endpoint);
} else {
Logger::udp().error( "Recvfrom failed %s\n", strerror (errno));
Logger::udp().error("Recvfrom failed %s\n", strerror(errno));
}
}
}
//------------------------------------------------------------------------------
int udp_server::create_socket (const struct in_addr &address, const uint16_t port)
{
int udp_server::create_socket(
const struct in_addr& address, const uint16_t port) {
struct sockaddr_in addr = {};
int sd = 0;
/*
* Create UDP socket
*/
if ((sd = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
if ((sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
/*
* Socket creation has failed...
*/
Logger::udp().error( "Socket creation failed (%s)\n", strerror (errno));
Logger::udp().error("Socket creation failed (%s)\n", strerror(errno));
return errno;
}
addr.sin_family = AF_INET;
addr.sin_port = htons (port);
addr.sin_port = htons(port);
addr.sin_addr.s_addr = address.s_addr;
std::string ipv4 = conv::toString(address);
Logger::udp().debug("Creating new listen socket on address %s and port %" PRIu16 " ", ipv4.c_str(), port);
Logger::udp().debug(
"Creating new listen socket on address %s and port %" PRIu16 " ",
ipv4.c_str(), port);
if (bind (sd, (struct sockaddr *)&addr, sizeof (struct sockaddr_in)) < 0) {
if (bind(sd, (struct sockaddr*) &addr, sizeof(struct sockaddr_in)) < 0) {
/*
* Bind failed
*/
Logger::udp().error("Socket bind failed (%s) for address %s and port %" PRIu16 " ", strerror (errno), ipv4.c_str(), port);
close (sd);
Logger::udp().error(
"Socket bind failed (%s) for address %s and port %" PRIu16 " ",
strerror(errno), ipv4.c_str(), port);
close(sd);
return errno;
}
sa_family = AF_INET;
return sd;
}
//------------------------------------------------------------------------------
int udp_server::create_socket (const struct in6_addr &address, const uint16_t port)
{
int udp_server::create_socket(
const struct in6_addr& address, const uint16_t port) {
struct sockaddr_in6 addr = {};
int sd = 0;
/*
* Create UDP socket
*/
if ((sd = socket (AF_INET6, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
if ((sd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
/*
* Socket creation has failed...
*/
Logger::udp().error( "Socket creation failed (%s)\n", strerror (errno));
Logger::udp().error("Socket creation failed (%s)\n", strerror(errno));
return errno;
}
addr.sin6_family = AF_INET6;
addr.sin6_port = htons (port);
addr.sin6_port = htons(port);
addr.sin6_addr = address;
std::string ipv6 = conv::toString(address);
Logger::udp().debug("Creating new listen socket on address %s and port %" PRIu16 "\n", ipv6.c_str(), port);
Logger::udp().debug(
"Creating new listen socket on address %s and port %" PRIu16 "\n",
ipv6.c_str(), port);
if (bind (sd, (struct sockaddr *)&addr, sizeof (struct sockaddr_in6)) < 0) {
if (bind(sd, (struct sockaddr*) &addr, sizeof(struct sockaddr_in6)) < 0) {
/*
* Bind failed
*/
Logger::udp().error("Socket bind failed (%s) for address %s and port %" PRIu16 "\n", strerror (errno), ipv6.c_str(), port);
close (sd);
Logger::udp().error(
"Socket bind failed (%s) for address %s and port %" PRIu16 "\n",
strerror(errno), ipv6.c_str(), port);
close(sd);
return errno;
}
sa_family = AF_INET6;
return sd;
}
//------------------------------------------------------------------------------
int udp_server::create_socket (const char * address, const uint16_t port_num)
{
int udp_server::create_socket(const char* address, const uint16_t port_num) {
unsigned char buf_in_addr[sizeof(struct in6_addr)];
if (inet_pton (AF_INET, address, buf_in_addr) == 1) {
if (inet_pton(AF_INET, address, buf_in_addr) == 1) {
struct in_addr addr4 = {};
memcpy (&addr4, buf_in_addr, sizeof (struct in_addr));
memcpy(&addr4, buf_in_addr, sizeof(struct in_addr));
return create_socket(addr4, port_num);
} else if (inet_pton (AF_INET6, address, buf_in_addr) == 1) {
} else if (inet_pton(AF_INET6, address, buf_in_addr) == 1) {
struct in6_addr addr6 = {};
memcpy (&addr6, buf_in_addr, sizeof (struct in6_addr));
memcpy(&addr6, buf_in_addr, sizeof(struct in6_addr));
return create_socket(addr6, port_num);
} else {
Logger::udp().error( "udp_server::create_socket(%s:%d)", address, port_num);
Logger::udp().error("udp_server::create_socket(%s:%d)", address, port_num);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
throw std::system_error(socket_, std::generic_category(), "UDP socket creation failed!");
throw std::system_error(
socket_, std::generic_category(), "UDP socket creation failed!");
}
}
//------------------------------------------------------------------------------
void udp_server::start_receive(udp_application * app, const util::thread_sched_params& sched_params)
{
void udp_server::start_receive(
udp_application* app, const util::thread_sched_params& sched_params) {
app_ = app;
Logger::udp().trace( "udp_server::start_receive");
thread_ = std::thread(&udp_server::udp_read_loop,this, sched_params);
Logger::udp().trace("udp_server::start_receive");
thread_ = std::thread(&udp_server::udp_read_loop, this, sched_params);
thread_.detach();
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -47,111 +47,125 @@
#include <utility>
#include <vector>
class udp_application
{
public:
virtual void handle_receive(char* recv_buffer, const std::size_t bytes_transferred, const endpoint& r_endpoint);
virtual void start_receive(udp_application * gtp_stack, const util::thread_sched_params& sched_params);
class udp_application {
public:
virtual void handle_receive(
char* recv_buffer, const std::size_t bytes_transferred,
const endpoint& r_endpoint);
virtual void start_receive(
udp_application* gtp_stack,
const util::thread_sched_params& sched_params);
};
class udp_server
{
public:
class udp_server {
public:
udp_server(const struct in_addr& address, const uint16_t port_num)
: app_(nullptr), port_(port_num)
{
: app_(nullptr), port_(port_num) {
recv_buffer_[0] = 0;
socket_ = create_socket (address, port_);
socket_ = create_socket(address, port_);
if (socket_ > 0) {
Logger::udp().debug( "udp_server::udp_server(%s:%d)", conv::toString(address).c_str(), port_);
Logger::udp().debug(
"udp_server::udp_server(%s:%d)", conv::toString(address).c_str(),
port_);
sa_family = AF_INET;
} else {
Logger::udp().error( "udp_server::udp_server(%s:%d)", conv::toString(address).c_str(), port_);
Logger::udp().error(
"udp_server::udp_server(%s:%d)", conv::toString(address).c_str(),
port_);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
throw std::system_error(socket_, std::generic_category(), "GTPV1-U socket creation failed!");
throw std::system_error(
socket_, std::generic_category(), "GTPV1-U socket creation failed!");
}
}
//------------------------------------------------------------------------------
udp_server(const struct in6_addr& address, const uint16_t port_num)
: app_(nullptr), port_(port_num)
{
: app_(nullptr), port_(port_num) {
recv_buffer_[0] = 0;
socket_ = create_socket (address, port_);
socket_ = create_socket(address, port_);
if (socket_ > 0) {
Logger::udp().debug( "udp_server::udp_server(%s:%d)", conv::toString(address).c_str(), port_);
Logger::udp().debug(
"udp_server::udp_server(%s:%d)", conv::toString(address).c_str(),
port_);
sa_family = AF_INET6;
} else {
Logger::udp().error( "udp_server::udp_server(%s:%d)", conv::toString(address).c_str(), port_);
Logger::udp().error(
"udp_server::udp_server(%s:%d)", conv::toString(address).c_str(),
port_);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
throw std::system_error(socket_, std::generic_category(), "GTPV1-U socket creation failed!");
throw std::system_error(
socket_, std::generic_category(), "GTPV1-U socket creation failed!");
}
}
//------------------------------------------------------------------------------
udp_server(const char * address, const uint16_t port_num)
: app_(nullptr), port_(port_num)
{
udp_server(const char* address, const uint16_t port_num)
: app_(nullptr), port_(port_num) {
recv_buffer_[0] = 0;
socket_ = create_socket (address, port_);
socket_ = create_socket(address, port_);
if (socket_ > 0) {
Logger::udp().debug( "udp_server::udp_server(%s:%d)", address, port_);
Logger::udp().debug("udp_server::udp_server(%s:%d)", address, port_);
} else {
Logger::udp().error( "udp_server::udp_server(%s:%d)", address, port_);
Logger::udp().error("udp_server::udp_server(%s:%d)", address, port_);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
throw std::system_error(socket_, std::generic_category(), "GTPV1-U socket creation failed!");
throw std::system_error(
socket_, std::generic_category(), "GTPV1-U socket creation failed!");
}
}
~udp_server()
{
close(socket_);
}
~udp_server() { close(socket_); }
void udp_read_loop(const util::thread_sched_params& thread_sched_params);
//------------------------------------------------------------------------------
void async_send_to(const char* send_buffer, const ssize_t num_bytes, const endpoint& r_endpoint)
{
ssize_t bytes_written = sendto (socket_, send_buffer, num_bytes, 0, (struct sockaddr *)&r_endpoint.addr_storage, r_endpoint.addr_storage_len);
void async_send_to(
const char* send_buffer, const ssize_t num_bytes,
const endpoint& r_endpoint) {
ssize_t bytes_written = sendto(
socket_, send_buffer, num_bytes, 0,
(struct sockaddr*) &r_endpoint.addr_storage,
r_endpoint.addr_storage_len);
if (bytes_written != num_bytes) {
Logger::udp().error( "sendto failed(%d:%s)\n", errno, strerror (errno));
Logger::udp().error("sendto failed(%d:%s)\n", errno, strerror(errno));
}
}
//------------------------------------------------------------------------------
void async_send_to(const char* send_buffer, const ssize_t num_bytes, const struct sockaddr_in& r_endpoint)
{
ssize_t bytes_written = sendto (socket_, send_buffer, num_bytes, 0, (struct sockaddr *)&r_endpoint, sizeof(struct sockaddr_in));
void async_send_to(
const char* send_buffer, const ssize_t num_bytes,
const struct sockaddr_in& r_endpoint) {
ssize_t bytes_written = sendto(
socket_, send_buffer, num_bytes, 0, (struct sockaddr*) &r_endpoint,
sizeof(struct sockaddr_in));
if (bytes_written != num_bytes) {
Logger::udp().error( "sendto failed(%d:%s)\n", errno, strerror (errno));
Logger::udp().error("sendto failed(%d:%s)\n", errno, strerror(errno));
}
}
//------------------------------------------------------------------------------
void async_send_to(const char* send_buffer, const ssize_t num_bytes, const struct sockaddr_in6& r_endpoint)
{
ssize_t bytes_written = sendto (socket_, send_buffer, num_bytes, 0, (struct sockaddr *)&r_endpoint, sizeof(struct sockaddr_in6));
void async_send_to(
const char* send_buffer, const ssize_t num_bytes,
const struct sockaddr_in6& r_endpoint) {
ssize_t bytes_written = sendto(
socket_, send_buffer, num_bytes, 0, (struct sockaddr*) &r_endpoint,
sizeof(struct sockaddr_in6));
if (bytes_written != num_bytes) {
Logger::udp().error( "sendto failed(%d:%s)\n", errno, strerror (errno));
Logger::udp().error("sendto failed(%d:%s)\n", errno, strerror(errno));
}
}
void start_receive(udp_application * gtp_stack, const util::thread_sched_params& sched_params);
void start_receive(
udp_application* gtp_stack,
const util::thread_sched_params& sched_params);
protected:
int create_socket (const struct in_addr& address, const uint16_t port);
int create_socket (const struct in6_addr& address, const uint16_t port);
int create_socket (const char * address, const uint16_t port_num);
protected:
int create_socket(const struct in_addr& address, const uint16_t port);
int create_socket(const struct in6_addr& address, const uint16_t port);
int create_socket(const char* address, const uint16_t port_num);
static void handle_send(const char *, /*buffer*/
const int& /*error*/,
std::size_t /*bytes_transferred*/)
{
}
static void handle_send(
const char*, /*buffer*/
const int& /*error*/, std::size_t /*bytes_transferred*/) {}
udp_application* app_;
std::thread thread_;
......@@ -162,5 +176,4 @@ protected:
char recv_buffer_[UDP_RECV_BUFFER_SIZE];
};
#endif /* FILE_UDP_HPP_SEEN */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment