s1ap_eNB_ue_context.h 3.12 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
Cedric Roux's avatar
Cedric Roux committed
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 21
 * 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
 */

22 23 24
#include "tree.h"
#include "queue.h"

25 26
#include "s1ap_eNB_defs.h"

27 28 29 30 31 32 33 34 35
#ifndef S1AP_ENB_UE_CONTEXT_H_
#define S1AP_ENB_UE_CONTEXT_H_

// Forward declarations
struct s1ap_eNB_mme_data_s;
struct s1ap_ue_map;
struct eNB_mme_desc_s;

typedef enum {
36 37 38 39 40 41 42
  /* UE has not been registered to a MME or UE association has failed. */
  S1AP_UE_DECONNECTED = 0x0,
  /* UE s1ap state is waiting for initial context setup request message. */
  S1AP_UE_WAITING_CSR = 0x1,
  /* UE association is ready and bearers are established. */
  S1AP_UE_CONNECTED   = 0x2,
  S1AP_UE_STATE_MAX,
43 44 45
} s1ap_ue_state;

typedef struct s1ap_eNB_ue_context_s {
46 47
  /* Tree related data */
  RB_ENTRY(s1ap_eNB_ue_context_s) entries;
48

49 50 51 52
  /* Uniquely identifies the UE between MME and eNB within the eNB.
   * This id is encoded on 24bits.
   */
  unsigned eNB_ue_s1ap_id:24;
53

54 55
  /* UE id for initial connection to S1AP */
  uint16_t ue_initial_id;
56

57 58
  /* Uniquely identifies the UE within MME. Encoded on 32 bits. */
  uint32_t mme_ue_s1ap_id;
59

60
  /* Stream used for this particular UE */
61 62
  int32_t tx_stream;
  int32_t rx_stream;
63

64 65
  /* Current UE state. */
  s1ap_ue_state ue_state;
66

67 68
  /* Reference to MME data this UE is attached to */
  struct s1ap_eNB_mme_data_s *mme_ref;
69

70 71 72 73 74
  /* Signaled by the UE in RRC Connection Setup Complete and used in NAS Uplink
   * to route NAS messages correctly. 0-based, not 1-based as in TS 36.331
   * 6.2.2 RRC Connection Setup Complete! */
  int selected_plmn_identity;

75 76
  /* Reference to eNB data this UE is attached to */
  s1ap_eNB_instance_t *eNB_instance;
77 78
} s1ap_eNB_ue_context_t;

79
int s1ap_eNB_compare_eNB_ue_s1ap_id(
80
  struct s1ap_eNB_ue_context_s *p1, struct s1ap_eNB_ue_context_s *p2);
81 82 83 84 85 86 87

/* Generate the tree management functions prototypes */
RB_PROTOTYPE(s1ap_ue_map, s1ap_eNB_ue_context_s, entries,
             s1ap_eNB_compare_eNB_ue_s1ap_id);

struct s1ap_eNB_ue_context_s *s1ap_eNB_allocate_new_UE_context(void);

88
struct s1ap_eNB_ue_context_s *s1ap_eNB_get_ue_context(
89 90
  s1ap_eNB_instance_t *instance_p,
  uint32_t eNB_ue_s1ap_id);
91

gauthier's avatar
gauthier committed
92 93 94
void s1ap_eNB_free_ue_context(struct s1ap_eNB_ue_context_s *ue_context_p);


95
#endif /* S1AP_ENB_UE_CONTEXT_H_ */