[GITLAB] - UPGRADE TO v12 on Wednesday the 18th of December at 11.30AM

flexran_agent_defs.h 5.43 KB
Newer Older
1 2 3 4 5
/*
 * 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
6
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
7 8 9 10 11 12 13 14 15 16 17 18 19 20
 * 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
 */ 
21

22 23
/*! \file flexran_agent_defs.h
 * \brief FlexRAN agent common definitions 
shahab's avatar
shahab committed
24 25
 * \author Navid Nikaein and Xenofon Foukas and shahab SHARIAT BAGHERI
 * \date 2017
26 27
 * \version 0.1
 */
28 29
#ifndef FLEXRAN_AGENT_DEFS_H_
#define FLEXRAN_AGENT_DEFS_H_
30 31 32 33 34

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
35 36
#include <stdbool.h>
#include <time.h>
37 38 39

#include "link_manager.h"

40
#define NUM_MAX_ENB 2
41 42
#define NUM_MAX_DRB 8
#define NUM_MAX_SRB 3
43
#define NUM_MAX_UE 2048
44
#define DEFAULT_DRB 3
45 46 47
#define DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS "127.0.0.1"
#define DEFAULT_FLEXRAN_AGENT_PORT          2210
#define DEFAULT_FLEXRAN_AGENT_CACHE        "/mnt/oai_agent_cache"
48 49 50

typedef enum {
  
51
  FLEXRAN_AGENT_DEFAULT=0,
52
  
53 54 55 56 57 58 59 60 61 62
  FLEXRAN_AGENT_PHY=1,
  FLEXRAN_AGENT_MAC=2,
  FLEXRAN_AGENT_RLC=3,
  FLEXRAN_AGENT_PDCP=4,
  FLEXRAN_AGENT_RRC=5,
  FLEXRAN_AGENT_S1AP=6,
  FLEXRAN_AGENT_GTP=7,
  FLEXRAN_AGENT_X2AP=8,

  FLEXRAN_AGENT_MAX=9,
63 64 65 66 67
    
} agent_id_t;

typedef enum {
  /* no action  */
68
  FLEXRAN_AGENT_ACTION_NONE = 0x0,
69 70

  /* send action  */
71
  FLEXRAN_AGENT_ACTION_SEND = 0x1,
72 73

 /* apply action  */
74
  FLEXRAN_AGENT_ACTION_APPLY = 0x2,
75 76

  /* clear action  */
77
  FLEXRAN_AGENT_ACTION_CLEAR = 0x4,
78 79

  /* write action  */
80
  FLEXRAN_AGENT_ACTION_WRITE = 0x8,
81 82

  /* filter action  */
83
  FLEXRAN_AGENT_ACTION_FILTER = 0x10,
84 85

  /* preprocess action  */
86
  FLEXRAN_AGENT_ACTION_PREPROCESS = 0x20,
87 88

  /* meter action  */
89
  FLEXRAN_AGENT_ACTION_METER = 0x40,
90 91
  
  /* Max number of states available */
92
  FLEXRAN_AGENT_ACTION_MAX = 0x7f,
93 94 95 96 97 98 99 100 101 102 103 104
} agent_action_t;


typedef enum {
  
  RAN_LTE_OAI= 0,
  
 /* Max number of states available */
 RAN_NAME_MAX = 0x7f,
} ran_name_t;

typedef uint8_t xid_t;  
105
typedef uint16_t mid_t;  // module or enb id 
106 107 108
typedef uint8_t lcid_t;
typedef int32_t  err_code_t; 

109

shahab's avatar
shahab committed
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
/*---------Timer Enums --------- */

typedef enum {
  /* oneshot timer:  */
  FLEXRAN_AGENT_TIMER_TYPE_ONESHOT = 0,

  /* periodic timer  */
  FLEXRAN_AGENT_TIMER_TYPE_PERIODIC = 1,

  /* Inactive state: initial state for any timer. */
  FLEXRAN_AGENT_TIMER_TYPE_EVENT_DRIVEN = 2,
  
  /* Max number of states available */
  FLEXRAN_AGENT_TIMER_TYPE_MAX,
} flexran_agent_timer_type_t;


typedef enum {
  /* Inactive state: initial state for any timer. */
  FLEXRAN_AGENT_TIMER_STATE_INACTIVE = 0x0,

  /* Inactive state: initial state for any timer. */
  FLEXRAN_AGENT_TIMER_STATE_ACTIVE = 0x1,

  /* Inactive state: initial state for any timer. */
  FLEXRAN_AGENT_TIMER_STATE_STOPPED = 0x2,
  
  /* Max number of states available */
  FLEXRAN_AGENT_TIMER_STATE_MAX,
} flexran_agent_timer_state_t;

141 142 143 144 145 146 147 148
#define FLEXRAN_CAP_LOPHY 1
#define FLEXRAN_CAP_HIPHY 2
#define FLEXRAN_CAP_LOMAC 4
#define FLEXRAN_CAP_HIMAC 8
#define FLEXRAN_CAP_RLC   16
#define FLEXRAN_CAP_PDCP  32
#define FLEXRAN_CAP_SDAP  64
#define FLEXRAN_CAP_RRC   128
149

150 151 152 153 154 155
typedef enum {
  ENB_NORMAL_OPERATION = 0x0,
  ENB_WAIT             = 0x1,
  ENB_MAKE_WAIT        = 0x2,
} flexran_enb_state_t;

156 157
typedef struct {
  /* general info */ 
158
  int      enabled;
159 160 161 162 163
  char    *interface_name;
  char    *remote_ipv4_addr;
  uint16_t remote_port;
  char    *cache_name;

164 165
  mid_t    mod_id;
  uint64_t agent_id;
166 167
  uint8_t  capability_mask;

168 169 170 171 172
  /* lock for waiting before starting or soft-restart */
  pthread_cond_t      cond_node_ctrl;
  pthread_mutex_t     mutex_node_ctrl;
  flexran_enb_state_t node_ctrl_state;

173 174 175 176 177
  /* stats */

  uint32_t total_rx_msg;
  uint32_t total_tx_msg;
   
178 179
  uint32_t rx_msg[NUM_MAX_ENB];
  uint32_t tx_msg[NUM_MAX_ENB];
180

181
} flexran_agent_info_t;
182

shahab's avatar
shahab committed
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229

/*
rrc triggering
 */


typedef struct {
   char   * trigger_policy;
   uint32_t report_interval;
   uint32_t report_amount;

} agent_reconf_rrc;


/* These structs will be used to give
   instructions for the type of stats reports
   we need to create */


typedef struct {
  uint16_t ue_rnti;
  uint32_t ue_report_flags; /* Indicates the report elements
             required for this UE id. See
             FlexRAN specification 1.2.4.2 */
} ue_report_type_t;

typedef struct {
  uint16_t cc_id;
  uint32_t cc_report_flags; /* Indicates the report elements
            required for this CC index. See
            FlexRAN specification 1.2.4.3 */
} cc_report_type_t;

typedef struct {
  int nr_ue;
  ue_report_type_t *ue_report_type;
  int nr_cc;
  cc_report_type_t *cc_report_type;
} report_config_t;

typedef struct stats_request_config_s{
  uint8_t report_type;
  uint8_t report_frequency;
  uint16_t period; /*In number of subframes*/
  report_config_t *config;
} stats_request_config_t;

230
#endif