cucp_cuup_e1ap.c 2.89 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * 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
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
Robert Schmidt's avatar
Robert Schmidt committed
19
 *      contact@openairinterface.org
20 21 22 23 24 25 26 27
 */

#include "cucp_cuup_if.h"
#include "nr_rrc_defs.h"

#include "nr_rrc_proto.h"
#include "nr_rrc_extern.h"
#include "cucp_cuup_if.h"
mir's avatar
mir committed
28

29
static void cucp_cuup_bearer_context_setup_e1ap(sctp_assoc_t assoc_id, const e1ap_bearer_setup_req_t *req)
30
{
31 32 33
  AssertFatal(assoc_id > 0, "illegal assoc_id %d\n", assoc_id);
  MessageDef *msg_p = itti_alloc_new_message(TASK_CUCP_E1, 0, E1AP_BEARER_CONTEXT_SETUP_REQ);
  msg_p->ittiMsgHeader.originInstance = assoc_id;
34 35 36
  e1ap_bearer_setup_req_t *bearer_req = &E1AP_BEARER_CONTEXT_SETUP_REQ(msg_p);
  memcpy(bearer_req, req, sizeof(e1ap_bearer_setup_req_t));

37
  itti_send_msg_to_task (TASK_CUCP_E1, 0, msg_p);
38 39
}

40
static void cucp_cuup_bearer_context_mod_e1ap(sctp_assoc_t assoc_id, const e1ap_bearer_setup_req_t *req)
41
{
42 43 44
  AssertFatal(assoc_id > 0, "illegal assoc_id %d\n", assoc_id);
  MessageDef *msg = itti_alloc_new_message(TASK_CUCP_E1, 0, E1AP_BEARER_CONTEXT_MODIFICATION_REQ);
  msg->ittiMsgHeader.originInstance = assoc_id;
45 46
  e1ap_bearer_setup_req_t *req_msg = &E1AP_BEARER_CONTEXT_SETUP_REQ(msg);
  memcpy(req_msg, req, sizeof(*req));
47
  itti_send_msg_to_task(TASK_CUCP_E1, 0, msg);
48 49
}

50 51 52 53 54 55 56 57 58 59
static void cucp_cuup_bearer_context_release_cmd_e1ap(sctp_assoc_t assoc_id, const e1ap_bearer_release_cmd_t *cmd)
{
  AssertFatal(assoc_id > 0, "illegal assoc_id %d\n", assoc_id);
  MessageDef *msg = itti_alloc_new_message(TASK_CUCP_E1, 0, E1AP_BEARER_CONTEXT_RELEASE_CMD);
  msg->ittiMsgHeader.originInstance = assoc_id;
  e1ap_bearer_release_cmd_t *cmd_msg = &E1AP_BEARER_CONTEXT_RELEASE_CMD(msg);
  memcpy(cmd_msg, cmd, sizeof(*cmd));
  itti_send_msg_to_task(TASK_CUCP_E1, 0, msg);
}

60 61 62
void cucp_cuup_message_transfer_e1ap_init(gNB_RRC_INST *rrc) {
  rrc->cucp_cuup.bearer_context_setup = cucp_cuup_bearer_context_setup_e1ap;
  rrc->cucp_cuup.bearer_context_mod = cucp_cuup_bearer_context_mod_e1ap;
63
  rrc->cucp_cuup.bearer_context_release = cucp_cuup_bearer_context_release_cmd_e1ap;
64
}