rrc_eNB_GTPV1U.c 3.41 KB
Newer Older
gauthier's avatar
 
gauthier committed
1
/*******************************************************************************
nikaeinn's avatar
nikaeinn committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
    OpenAirInterface
    Copyright(c) 1999 - 2014 Eurecom

    OpenAirInterface is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.


    OpenAirInterface is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with OpenAirInterface.The full GNU General Public License is
    included in this distribution in the file called "COPYING". If not,
    see <http://www.gnu.org/licenses/>.

  Contact Information
  OpenAirInterface Admin: openair_admin@eurecom.fr
  OpenAirInterface Tech : openair_tech@eurecom.fr
24
  OpenAirInterface Dev  : openair4g-devel@lists.eurecom.fr
nikaeinn's avatar
nikaeinn committed
25

ghaddab's avatar
ghaddab committed
26
  Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
nikaeinn's avatar
nikaeinn committed
27

gauthier's avatar
 
gauthier committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41
*******************************************************************************/
/*! \file rrc_eNB_GTPV1U.c
 * \brief rrc GTPV1U procedures for eNB
 * \author Lionel GAUTHIER
 * \version 1.0
 * \company Eurecom
 * \email: lionel.gauthier@eurecom.fr
 */

#if defined(ENABLE_USE_MME)
# include "defs.h"
# include "extern.h"
# include "RRC/LITE/MESSAGES/asn1_msg.h"
# include "rrc_eNB_GTPV1U.h"
42
# include "rrc_eNB_UE_context.h"
gauthier's avatar
gauthier committed
43
# include "msc.h"
gauthier's avatar
 
gauthier committed
44 45 46 47 48 49

# if defined(ENABLE_ITTI)
#   include "asn1_conversions.h"
#   include "intertask_interface.h"
# endif

50 51 52
int
rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
  const protocol_ctxt_t* const ctxt_pP,
53
  const gtpv1u_enb_create_tunnel_resp_t * const create_tunnel_resp_pP
54
)
55
{
56
  rnti_t                         rnti;
57
  int                            i;
58
  struct rrc_eNB_ue_context_s*   ue_context_p = NULL;
gauthier's avatar
 
gauthier committed
59

60 61
  if (create_tunnel_resp_pP) {
    LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RX CREATE_TUNNEL_RESP num tunnels %u \n",
62
          PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
63
          create_tunnel_resp_pP->num_tunnels);
gauthier's avatar
 
gauthier committed
64

65
    rnti = create_tunnel_resp_pP->rnti;
66 67 68
    ue_context_p = rrc_eNB_get_ue_context(
                     &eNB_rrc_inst[ctxt_pP->module_id],
                     ctxt_pP->rnti);
gauthier's avatar
 
gauthier committed
69

70
    for (i = 0; i < create_tunnel_resp_pP->num_tunnels; i++) {
71 72
      LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP tunnel %u bearer index %u id %u\n",
            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
73
            create_tunnel_resp_pP->enb_S1u_teid[i],
74
            i,
75 76 77 78
            create_tunnel_resp_pP->eps_bearer_id[i]);
      ue_context_p->ue_context.enb_gtp_teid[i]  = create_tunnel_resp_pP->enb_S1u_teid[i];
      ue_context_p->ue_context.enb_gtp_addrs[i] = create_tunnel_resp_pP->enb_addr;
      ue_context_p->ue_context.enb_gtp_ebi[i]   = create_tunnel_resp_pP->eps_bearer_id[i];
79
    }
gauthier's avatar
gauthier committed
80 81 82 83 84 85
	MSC_LOG_RX_MESSAGE(
			  MSC_RRC_ENB,
			  MSC_GTPU_ENB,
			  NULL,0,
			  MSC_AS_TIME_FMT" CREATE_TUNNEL_RESP RNTI %"PRIx16" ntuns %u ebid %u enb-s1u teid %u",
			  0,0,rnti,
86
			  create_tunnel_resp_pP->num_tunnels,
gauthier's avatar
gauthier committed
87 88
			  ue_context_p->ue_context.enb_gtp_ebi[0],
			  ue_context_p->ue_context.enb_gtp_teid[0]);
89
        (void)rnti; /* avoid gcc warning "set but not used" */
90
    return 0;
gauthier's avatar
 
gauthier committed
91
  } else {
92
    return -1;
gauthier's avatar
 
gauthier committed
93 94 95
  }
}
#endif