asn1_msg.h 7.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 * 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:
 *      contact@openairinterface.org
 */

/*! \file asn1_msg.h
* \brief primitives to build the asn1 messages
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
24 25
* \author Raymond Knopp and Navid Nikaein, WIE-TAI CHEN
* \date 2011, 2018
26
* \version 1.0
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
27 28
* \company Eurecom, NTUST
* \email: raymond.knopp@eurecom.fr and  navid.nikaein@eurecom.fr, kroempa@gmail.com
29 30 31 32 33 34 35 36 37 38 39 40 41
*/

#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h> /* for atoi(3) */
#include <unistd.h> /* for getopt(3) */
#include <string.h> /* for strerror(3) */
#include <sysexits.h> /* for EX_* exit codes */
#include <errno.h>  /* for errno */

#include <asn_application.h>
#include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */

42
#include "RRC/NR/nr_rrc_defs.h"
43 44
#include "RRC/NR/nr_rrc_config.h"

45 46 47 48 49 50 51 52 53 54 55

/*
 * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC)
 * output into the chosen string buffer.
 * RETURN VALUES:
 *       0: The structure is printed.
 *      -1: Problem printing the structure.
 * WARNING: No sensible errno value is returned.
 */
int xer_sprint_NR(char *string, size_t string_size, struct asn_TYPE_descriptor_s *td, void *sptr);

56 57
uint8_t do_MIB_NR(gNB_RRC_INST *rrc,
                  uint32_t frame);
58 59

/**
60
\brief Generate configuration for SIB1 (gNB).
61 62 63
@param carrier pointer to Carrier information
@param configuration Pointer Configuration Request structure  
@return size of encoded bit stream in bytes*/
64 65
uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
  gNB_RrcConfigurationReq *configuration
66
                  );
67

68 69 70
uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier,
                    gNB_RrcConfigurationReq *configuration);

71
void do_RLC_BEARER(uint8_t Mod_id,
72 73 74
                    int CC_id,
                    struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_BearerToAddModList,
                    rlc_bearer_config_t  *rlc_config);
75 76 77 78
void do_MAC_CELLGROUP(uint8_t Mod_id,
                      int CC_id,
                      NR_MAC_CellGroupConfig_t *mac_CellGroupConfig,
                      mac_cellgroup_t *mac_cellgroup_config);
79

80 81 82 83
void do_PHYSICALCELLGROUP(uint8_t Mod_id,
                          int CC_id,
                          NR_PhysicalCellGroupConfig_t *physicalCellGroupConfig,
                          physicalcellgroup_t *physicalcellgroup_config);
84

85

86
void do_SpCellConfig(gNB_RRC_INST *rrc,
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
87
                      struct NR_SpCellConfig  *spconfig);
88 89 90

uint8_t do_RRCReject(uint8_t Mod_id,
                     uint8_t *const buffer);
Xue Song's avatar
Xue Song committed
91

92 93
void fill_initial_SpCellConfig(rnti_t rnti,
			       NR_SpCellConfig_t *SpCellConfig,
Eurecom's avatar
Eurecom committed
94 95
			       NR_ServingCellConfigCommon_t *scc,
                               rrc_gNB_carrier_data_t *carrier);
96 97 98

void fill_initial_cellGroupConfig(rnti_t rnti,
				  NR_CellGroupConfig_t *cellGroupConfig,
Eurecom's avatar
Eurecom committed
99 100
				  NR_ServingCellConfigCommon_t *scc,
                                  rrc_gNB_carrier_data_t *carrier);
101

102
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup);
103

104
uint8_t do_RRCSetup(rrc_gNB_ue_context_t         *const ue_context_pP,
Xue Song's avatar
Xue Song committed
105 106
                    uint8_t                      *const buffer,
                    const uint8_t                transaction_id,
107
                    OCTET_STRING_t               *masterCellGroup_from_DU,
Eurecom's avatar
Eurecom committed
108 109
                    NR_ServingCellConfigCommon_t *scc,
                    rrc_gNB_carrier_data_t *carrier);
110

heshanyun's avatar
heshanyun committed
111 112 113 114 115 116
uint8_t do_NR_SecurityModeCommand(
                    const protocol_ctxt_t *const ctxt_pP,
                    uint8_t *const buffer,
                    const uint8_t Transaction_id,
                    const uint8_t cipheringAlgorithm,
                    NR_IntegrityProtAlgorithm_t *integrityProtAlgorithm);
heshanyun's avatar
heshanyun committed
117

Xue Song's avatar
Xue Song committed
118
uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
Xue Song's avatar
Xue Song committed
119 120 121
                                   uint8_t               *const buffer,
                                   const uint8_t                Transaction_id);

Xue Song's avatar
Xue Song committed
122 123
uint8_t do_NR_RRCRelease(uint8_t *buffer,
                         uint8_t Transaction_id);
124

125
int16_t do_RRCReconfiguration(
126 127 128 129 130 131 132 133 134
    const protocol_ctxt_t        *const ctxt_pP,
    uint8_t                      *buffer,
    uint8_t                       Transaction_id,
    NR_SRB_ToAddModList_t        *SRB_configList,
    NR_DRB_ToAddModList_t        *DRB_configList,
    NR_DRB_ToReleaseList_t       *DRB_releaseList,
    NR_SecurityConfig_t          *security_config,
    NR_SDAP_Config_t             *sdap_config,
    NR_MeasConfig_t              *meas_config,
135
    struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList,
136 137
    NR_MAC_CellGroupConfig_t     *mac_CellGroupConfig,
    NR_CellGroupConfig_t         *cellGroupConfig);
Qiu Dezhi's avatar
Qiu Dezhi committed
138 139 140 141 142 143
                    
uint8_t do_RRCSetupComplete(uint8_t Mod_id, 
                            uint8_t *buffer, 
                            const uint8_t Transaction_id, 
                            uint8_t sel_plmn_id, 
                            const int dedicatedInfoNASLength, 
yaojie's avatar
yaojie committed
144 145
                            const char *dedicatedInfoNAS);

Xue Song's avatar
Xue Song committed
146 147 148 149 150 151 152
uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv);

uint8_t do_NR_RRCReconfigurationComplete(
                        const protocol_ctxt_t *const ctxt_pP,
                        uint8_t *buffer,
                        const uint8_t Transaction_id
                      );
Xue Song's avatar
Xue Song committed
153 154 155 156 157 158 159 160 161 162 163 164

uint8_t 
do_NR_DLInformationTransfer(
    uint8_t Mod_id,
    uint8_t **buffer,
    uint8_t transaction_id,
    uint32_t pdu_length,
    uint8_t *pdu_buffer
);

uint8_t do_NR_ULInformationTransfer(uint8_t **buffer, 
                        uint32_t pdu_length,
165 166
                        uint8_t *pdu_buffer);

167
uint8_t do_RRCReestablishmentRequest(uint8_t Mod_id, uint8_t *buffer, uint16_t c_rnti);
yaojie's avatar
yaojie committed
168 169 170 171 172 173 174 175

uint8_t
do_RRCReestablishment(
  const protocol_ctxt_t     *const ctxt_pP,
  rrc_gNB_ue_context_t      *const ue_context_pP,
  int                              CC_id,
  uint8_t                   *const buffer,
  //const uint8_t                    transmission_mode,
176 177
  const uint8_t                    Transaction_id,
  NR_SRB_ToAddModList_t               **SRB_configList
yaojie's avatar
yaojie committed
178
);
179 180 181 182 183 184

uint8_t 
do_RRCReestablishmentComplete(
    uint8_t *buffer, 
    int64_t rrc_TransactionIdentifier);