From a7e0a0624b2dfc787dda52d2f123241cf98fc3e1 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 23 May 2019 18:35:12 +0100 Subject: [PATCH] Starting to add interface apply_traffic_flow_template between NAS and GW. --- lib/include/srslte/interfaces/ue_interfaces.h | 23 ++++++++++--------- srsue/hdr/stack/upper/gw.h | 3 ++- srsue/src/stack/upper/gw.cc | 6 ++++- srsue/src/stack/upper/nas.cc | 10 ++++++-- srsue/test/upper/nas_test.cc | 5 ++-- 5 files changed, 30 insertions(+), 17 deletions(-) diff --git a/lib/include/srslte/interfaces/ue_interfaces.h b/lib/include/srslte/interfaces/ue_interfaces.h index 40bbf7e17..42f78794b 100644 --- a/lib/include/srslte/interfaces/ue_interfaces.h +++ b/lib/include/srslte/interfaces/ue_interfaces.h @@ -97,7 +97,8 @@ public: class gw_interface_nas { public: - virtual int setup_if_addr(uint32_t lcid, uint8_t pdn_type, uint32_t ip_addr, uint8_t *ipv6_if_id, char *err_str) = 0; + virtual int setup_if_addr(uint32_t lcid, uint8_t pdn_type, uint32_t ip_addr, uint8_t* ipv6_if_id, char* err_str) = 0; + virtual int apply_traffic_flow_template(const LIBLTE_MME_TRAFFIC_FLOW_TEMPLATE_STRUCT* tft) = 0; }; // GW interface for RRC @@ -186,18 +187,18 @@ public: const static int MAX_FOUND_PLMNS = 16; - virtual void write_sdu(srslte::unique_byte_buffer_t sdu) = 0; - virtual uint16_t get_mcc() = 0; - virtual uint16_t get_mnc() = 0; - virtual void enable_capabilities() = 0; - virtual int plmn_search(found_plmn_t found_plmns[MAX_FOUND_PLMNS]) = 0; - virtual void plmn_select(asn1::rrc::plmn_id_s plmn_id) = 0; + virtual void write_sdu(srslte::unique_byte_buffer_t sdu) = 0; + virtual uint16_t get_mcc() = 0; + virtual uint16_t get_mnc() = 0; + virtual void enable_capabilities() = 0; + virtual int plmn_search(found_plmn_t found_plmns[MAX_FOUND_PLMNS]) = 0; + virtual void plmn_select(asn1::rrc::plmn_id_s plmn_id) = 0; virtual bool connection_request(asn1::rrc::establishment_cause_e cause, srslte::unique_byte_buffer_t dedicatedInfoNAS) = 0; - virtual void set_ue_idenity(asn1::rrc::s_tmsi_s s_tmsi) = 0; - virtual bool is_connected() = 0; - virtual std::string get_rb_name(uint32_t lcid) = 0; - virtual uint32_t get_lcid_for_eps_bearer(const uint32_t& eps_bearer_id) = 0; + virtual void set_ue_idenity(asn1::rrc::s_tmsi_s s_tmsi) = 0; + virtual bool is_connected() = 0; + virtual std::string get_rb_name(uint32_t lcid) = 0; + virtual uint32_t get_lcid_for_eps_bearer(const uint32_t& eps_bearer_id) = 0; }; // RRC interface for PDCP diff --git a/srsue/hdr/stack/upper/gw.h b/srsue/hdr/stack/upper/gw.h index fc095ca0b..2d8d6bc4e 100644 --- a/srsue/hdr/stack/upper/gw.h +++ b/srsue/hdr/stack/upper/gw.h @@ -58,7 +58,8 @@ public: void write_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t pdu); // NAS interface - int setup_if_addr(uint32_t lcid, uint8_t pdn_type, uint32_t ip_addr, uint8_t* ipv6_if_addr, char *err_str); + int setup_if_addr(uint32_t lcid, uint8_t pdn_type, uint32_t ip_addr, uint8_t* ipv6_if_addr, char* err_str); + int apply_traffic_flow_template(const LIBLTE_MME_TRAFFIC_FLOW_TEMPLATE_STRUCT* tft); // RRC interface void add_mch_port(uint32_t lcid, uint32_t port); diff --git a/srsue/src/stack/upper/gw.cc b/srsue/src/stack/upper/gw.cc index c97f6cd52..39747557d 100644 --- a/srsue/src/stack/upper/gw.cc +++ b/srsue/src/stack/upper/gw.cc @@ -220,7 +220,11 @@ int gw::setup_if_addr(uint32_t lcid, uint8_t pdn_type, uint32_t ip_addr, uint8_t } - +int gw::apply_traffic_flow_template(const LIBLTE_MME_TRAFFIC_FLOW_TEMPLATE_STRUCT* tft) +{ + int err; + return SRSLTE_SUCCESS; +} /******************************************************************************* RRC interface *******************************************************************************/ diff --git a/srsue/src/stack/upper/nas.cc b/srsue/src/stack/upper/nas.cc index 054f6c6c0..56b493d79 100644 --- a/srsue/src/stack/upper/nas.cc +++ b/srsue/src/stack/upper/nas.cc @@ -1133,14 +1133,17 @@ void nas::parse_activate_dedicated_eps_bearer_context_request(uint32_t lcid, uni { LIBLTE_MME_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT request; liblte_mme_unpack_activate_dedicated_eps_bearer_context_request_msg((LIBLTE_BYTE_MSG_STRUCT*)pdu.get(), &request); - nas_log->info( "Received Activate Dedicated EPS bearer context request (eps_bearer_id=%d, linked_bearer_id=%d, proc_id=%d)\n", request.eps_bearer_id, request.linked_eps_bearer_id, request.proc_transaction_id); - ctxt.rx_count++; + LIBLTE_MME_TRAFFIC_FLOW_TEMPLATE_STRUCT* tft = &request.tft; + nas_log->info("Traffic Flow Template: TFT OP code 0x%x, Filter list size %d, Parameter list size %d\n", + tft->tft_op_code, + tft->packet_filter_list_size, + tft->parameter_list_size); // check the a linked default bearer exists if (eps_bearer.find(request.linked_eps_bearer_id) == eps_bearer.end()) { @@ -1158,6 +1161,9 @@ void nas::parse_activate_dedicated_eps_bearer_context_request(uint32_t lcid, uni return; } + // apply packet filters to GW + gw->apply_traffic_flow_template(tft); + send_activate_dedicated_eps_bearer_context_accept(request.proc_transaction_id, request.eps_bearer_id); } diff --git a/srsue/test/upper/nas_test.cc b/srsue/test/upper/nas_test.cc index fcbc664b4..40f8cc640 100644 --- a/srsue/test/upper/nas_test.cc +++ b/srsue/test/upper/nas_test.cc @@ -143,8 +143,9 @@ class gw_dummy : public gw_interface_nas, public gw_interface_pdcp { return SRSLTE_SUCCESS; } - void write_pdu(uint32_t lcid, unique_byte_buffer_t pdu) {} - void write_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t sdu) {} + int apply_traffic_flow_template(const LIBLTE_MME_TRAFFIC_FLOW_TEMPLATE_STRUCT* tft) { return SRSLTE_SUCCESS; } + void write_pdu(uint32_t lcid, unique_byte_buffer_t pdu) {} + void write_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t sdu) {} }; }